Correct osConvertVirtToPhys/osConvertOldLINEARMemToNew parameter type
This commit is contained in:
parent
699748da98
commit
10c7711ce5
@ -37,8 +37,8 @@ void gpuFrameBegin(void)
|
|||||||
{
|
{
|
||||||
// Configure the viewport and the depth linear conversion function
|
// Configure the viewport and the depth linear conversion function
|
||||||
GPU_SetViewport(
|
GPU_SetViewport(
|
||||||
(u32*)osConvertVirtToPhys((u32)depthBuf),
|
(u32*)osConvertVirtToPhys(depthBuf),
|
||||||
(u32*)osConvertVirtToPhys((u32)colorBuf),
|
(u32*)osConvertVirtToPhys(colorBuf),
|
||||||
0, 0, 240, 400); // The top screen is physically 240x400 pixels
|
0, 0, 240, 400); // The top screen is physically 240x400 pixels
|
||||||
GPU_DepthMap(-1.0f, 0.0f); // calculate the depth value from the Z coordinate in the following way: -1.0*z + 0.0
|
GPU_DepthMap(-1.0f, 0.0f); // calculate the depth value from the Z coordinate in the following way: -1.0*z + 0.0
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ static void sceneRender(void)
|
|||||||
// Configure the "attribute buffers" (that is, the vertex input buffers)
|
// Configure the "attribute buffers" (that is, the vertex input buffers)
|
||||||
GPU_SetAttributeBuffers(
|
GPU_SetAttributeBuffers(
|
||||||
2, // Number of inputs per vertex
|
2, // Number of inputs per vertex
|
||||||
(u32*)osConvertVirtToPhys((u32)vbo_data), // Location of the VBO
|
(u32*)osConvertVirtToPhys(vbo_data), // Location of the VBO
|
||||||
GPU_ATTRIBFMT(0, 3, GPU_FLOAT) |
|
GPU_ATTRIBFMT(0, 3, GPU_FLOAT) |
|
||||||
GPU_ATTRIBFMT(1, 4, GPU_FLOAT), // Format of the inputs (in this case the only input is a 3-element float vector)
|
GPU_ATTRIBFMT(1, 4, GPU_FLOAT), // Format of the inputs (in this case the only input is a 3-element float vector)
|
||||||
0xFFC, // Unused attribute mask, in our case bit 0 is cleared since it is used
|
0xFFC, // Unused attribute mask, in our case bit 0 is cleared since it is used
|
||||||
|
@ -37,8 +37,8 @@ void gpuFrameBegin(void)
|
|||||||
{
|
{
|
||||||
// Configure the viewport and the depth linear conversion function
|
// Configure the viewport and the depth linear conversion function
|
||||||
GPU_SetViewport(
|
GPU_SetViewport(
|
||||||
(u32*)osConvertVirtToPhys((u32)depthBuf),
|
(u32*)osConvertVirtToPhys(depthBuf),
|
||||||
(u32*)osConvertVirtToPhys((u32)colorBuf),
|
(u32*)osConvertVirtToPhys(colorBuf),
|
||||||
0, 0, 240, 400); // The top screen is physically 240x400 pixels
|
0, 0, 240, 400); // The top screen is physically 240x400 pixels
|
||||||
GPU_DepthMap(-1.0f, 0.0f); // calculate the depth value from the Z coordinate in the following way: -1.0*z + 0.0
|
GPU_DepthMap(-1.0f, 0.0f); // calculate the depth value from the Z coordinate in the following way: -1.0*z + 0.0
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ void gpuFrameBegin(void)
|
|||||||
{
|
{
|
||||||
// Configure the viewport and the depth linear conversion function
|
// Configure the viewport and the depth linear conversion function
|
||||||
GPU_SetViewport(
|
GPU_SetViewport(
|
||||||
(u32*)osConvertVirtToPhys((u32)depthBuf),
|
(u32*)osConvertVirtToPhys(depthBuf),
|
||||||
(u32*)osConvertVirtToPhys((u32)colorBuf),
|
(u32*)osConvertVirtToPhys(colorBuf),
|
||||||
0, 0, 240, 400); // The top screen is physically 240x400 pixels
|
0, 0, 240, 400); // The top screen is physically 240x400 pixels
|
||||||
GPU_DepthMap(-1.0f, 0.0f); // calculate the depth value from the Z coordinate in the following way: -1.0*z + 0.0
|
GPU_DepthMap(-1.0f, 0.0f); // calculate the depth value from the Z coordinate in the following way: -1.0*z + 0.0
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ static void sceneRender(void)
|
|||||||
GPU_SetTextureEnable(GPU_TEXUNIT0);
|
GPU_SetTextureEnable(GPU_TEXUNIT0);
|
||||||
GPU_SetTexture(
|
GPU_SetTexture(
|
||||||
GPU_TEXUNIT0,
|
GPU_TEXUNIT0,
|
||||||
(u32*)osConvertVirtToPhys((u32)tex_data),
|
(u32*)osConvertVirtToPhys(tex_data),
|
||||||
64, // Width
|
64, // Width
|
||||||
64, // Height
|
64, // Height
|
||||||
GPU_TEXTURE_MAG_FILTER(GPU_LINEAR) | GPU_TEXTURE_WRAP_S(GPU_REPEAT) | GPU_TEXTURE_WRAP_T(GPU_REPEAT), // Flags
|
GPU_TEXTURE_MAG_FILTER(GPU_LINEAR) | GPU_TEXTURE_WRAP_S(GPU_REPEAT) | GPU_TEXTURE_WRAP_T(GPU_REPEAT), // Flags
|
||||||
@ -155,7 +155,7 @@ static void sceneRender(void)
|
|||||||
// Configure the "attribute buffers" (that is, the vertex input buffers)
|
// Configure the "attribute buffers" (that is, the vertex input buffers)
|
||||||
GPU_SetAttributeBuffers(
|
GPU_SetAttributeBuffers(
|
||||||
3, // Number of inputs per vertex
|
3, // Number of inputs per vertex
|
||||||
(u32*)osConvertVirtToPhys((u32)vbo_data), // Location of the VBO
|
(u32*)osConvertVirtToPhys(vbo_data), // Location of the VBO
|
||||||
GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | // Format of the inputs
|
GPU_ATTRIBFMT(0, 3, GPU_FLOAT) | // Format of the inputs
|
||||||
GPU_ATTRIBFMT(1, 2, GPU_FLOAT) |
|
GPU_ATTRIBFMT(1, 2, GPU_FLOAT) |
|
||||||
GPU_ATTRIBFMT(2, 3, GPU_FLOAT),
|
GPU_ATTRIBFMT(2, 3, GPU_FLOAT),
|
||||||
|
@ -57,7 +57,7 @@ struct tag_ndspWaveBuf
|
|||||||
s8* data_pcm8; ///< Pointer to PCM8 sample data.
|
s8* data_pcm8; ///< Pointer to PCM8 sample data.
|
||||||
s16* data_pcm16; ///< Pointer to PCM16 sample data.
|
s16* data_pcm16; ///< Pointer to PCM16 sample data.
|
||||||
u8* data_adpcm; ///< Pointer to DSPADPCM sample data.
|
u8* data_adpcm; ///< Pointer to DSPADPCM sample data.
|
||||||
u32 data_vaddr; ///< Data virtual address.
|
void* data_vaddr; ///< Data virtual address.
|
||||||
};
|
};
|
||||||
u32 nsamples; ///< Total number of samples (PCM8=bytes, PCM16=halfwords, DSPADPCM=nibbles without frame headers)
|
u32 nsamples; ///< Total number of samples (PCM8=bytes, PCM16=halfwords, DSPADPCM=nibbles without frame headers)
|
||||||
ndspAdpcmData* adpcm_data; ///< ADPCM data.
|
ndspAdpcmData* adpcm_data; ///< ADPCM data.
|
||||||
|
@ -34,14 +34,14 @@ typedef struct
|
|||||||
* @return The corresponding physical address.
|
* @return The corresponding physical address.
|
||||||
* It is sometimes required by services or when using the GPU command buffer.
|
* It is sometimes required by services or when using the GPU command buffer.
|
||||||
*/
|
*/
|
||||||
u32 osConvertVirtToPhys(u32 vaddr);
|
u32 osConvertVirtToPhys(const void* vaddr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Converts 0x14* vmem to 0x30*.
|
* @brief Converts 0x14* vmem to 0x30*.
|
||||||
* @param addr Input address.
|
* @param vaddr Input virtual address.
|
||||||
* @return The corresponding address in the 0x30* range, the input address if it's already within the new vmem, or 0 if it's outside of both ranges.
|
* @return The corresponding address in the 0x30* range, the input address if it's already within the new vmem, or 0 if it's outside of both ranges.
|
||||||
*/
|
*/
|
||||||
u32 osConvertOldLINEARMemToNew(u32 addr);
|
void* osConvertOldLINEARMemToNew(const void* vaddr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Retrieves basic information about a service error.
|
* @brief Retrieves basic information about a service error.
|
||||||
|
@ -28,8 +28,9 @@ typedef struct {
|
|||||||
__attribute__((weak)) bool __ctru_speedup = false;
|
__attribute__((weak)) bool __ctru_speedup = false;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
u32 osConvertVirtToPhys(u32 vaddr) {
|
u32 osConvertVirtToPhys(const void* addr) {
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
|
u32 vaddr = (u32)addr;
|
||||||
if(vaddr >= 0x14000000 && vaddr < 0x1c000000)
|
if(vaddr >= 0x14000000 && vaddr < 0x1c000000)
|
||||||
return vaddr + 0x0c000000; // LINEAR heap
|
return vaddr + 0x0c000000; // LINEAR heap
|
||||||
if(vaddr >= 0x1F000000 && vaddr < 0x1F600000)
|
if(vaddr >= 0x1F000000 && vaddr < 0x1F600000)
|
||||||
@ -42,10 +43,11 @@ u32 osConvertVirtToPhys(u32 vaddr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
u32 osConvertOldLINEARMemToNew(u32 vaddr) {
|
void* osConvertOldLINEARMemToNew(const void* addr) {
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
if(vaddr >= 0x30000000 && vaddr < 0x40000000)return vaddr;
|
u32 vaddr = (u32)addr;
|
||||||
if(vaddr >= 0x14000000 && vaddr < 0x1c000000)return vaddr+=0x1c000000;
|
if(vaddr >= 0x30000000 && vaddr < 0x40000000)return (void*)vaddr;
|
||||||
|
if(vaddr >= 0x14000000 && vaddr < 0x1c000000)return (void*)(vaddr+0x1c000000);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,8 +524,8 @@ Result csndPlaySound(int chn, u32 flags, u32 sampleRate, float vol, float pan, v
|
|||||||
|
|
||||||
if (encoding != CSND_ENCODING_PSG)
|
if (encoding != CSND_ENCODING_PSG)
|
||||||
{
|
{
|
||||||
if (data0) paddr0 = osConvertVirtToPhys((u32)data0);
|
if (data0) paddr0 = osConvertVirtToPhys(data0);
|
||||||
if (data1) paddr1 = osConvertVirtToPhys((u32)data1);
|
if (data1) paddr1 = osConvertVirtToPhys(data1);
|
||||||
|
|
||||||
if (data0 && encoding == CSND_ENCODING_ADPCM)
|
if (data0 && encoding == CSND_ENCODING_ADPCM)
|
||||||
{
|
{
|
||||||
|
@ -117,7 +117,7 @@ Result mvdstdInit(MVDSTD_Mode mode, MVDSTD_InputFormat input_type, MVDSTD_Output
|
|||||||
mvdstd_workbuf = linearAlloc(mvdstd_workbufsize);
|
mvdstd_workbuf = linearAlloc(mvdstd_workbufsize);
|
||||||
if(mvdstd_workbuf==NULL) goto cleanup1;
|
if(mvdstd_workbuf==NULL) goto cleanup1;
|
||||||
|
|
||||||
ret = MVDSTD_Initialize((u32*) osConvertOldLINEARMemToNew((u32) mvdstd_workbuf), mvdstd_workbufsize);
|
ret = MVDSTD_Initialize((u32*) osConvertOldLINEARMemToNew(mvdstd_workbuf), mvdstd_workbufsize);
|
||||||
if(R_FAILED(ret)) goto cleanup2;
|
if(R_FAILED(ret)) goto cleanup2;
|
||||||
|
|
||||||
ret = MVDSTD_cmd18();
|
ret = MVDSTD_cmd18();
|
||||||
@ -161,7 +161,7 @@ void mvdstdGenerateDefaultConfig(MVDSTD_Config*config, u32 input_width, u32 inpu
|
|||||||
config->inwidth = input_width;
|
config->inwidth = input_width;
|
||||||
config->inheight = input_height;
|
config->inheight = input_height;
|
||||||
|
|
||||||
if(mvdstd_mode==MVDMODE_COLORFORMATCONV)config->physaddr_colorconv_indata = osConvertVirtToPhys((u32)vaddr_colorconv_indata);
|
if(mvdstd_mode==MVDMODE_COLORFORMATCONV)config->physaddr_colorconv_indata = osConvertVirtToPhys(vaddr_colorconv_indata);
|
||||||
|
|
||||||
if(mvdstd_mode==MVDMODE_VIDEOPROCESSING)
|
if(mvdstd_mode==MVDMODE_VIDEOPROCESSING)
|
||||||
{
|
{
|
||||||
@ -175,8 +175,8 @@ void mvdstdGenerateDefaultConfig(MVDSTD_Config*config, u32 input_width, u32 inpu
|
|||||||
config->outwidth1 = output_width;
|
config->outwidth1 = output_width;
|
||||||
config->outheight1 = output_height;
|
config->outheight1 = output_height;
|
||||||
|
|
||||||
config->physaddr_outdata0 = osConvertVirtToPhys((u32)vaddr_outdata0);
|
config->physaddr_outdata0 = osConvertVirtToPhys(vaddr_outdata0);
|
||||||
if(mvdstd_mode==MVDMODE_COLORFORMATCONV)config->physaddr_outdata1_colorconv = osConvertVirtToPhys((u32)vaddr_outdata1_colorconv);
|
if(mvdstd_mode==MVDMODE_COLORFORMATCONV)config->physaddr_outdata1_colorconv = osConvertVirtToPhys(vaddr_outdata1_colorconv);
|
||||||
|
|
||||||
config->unk_x6c[0] = 0x1;
|
config->unk_x6c[0] = 0x1;
|
||||||
config->unk_x6c[(0x84-0x6c)>>2] = 0x12a;
|
config->unk_x6c[(0x84-0x6c)>>2] = 0x12a;
|
||||||
|
Loading…
Reference in New Issue
Block a user