(CTR/3DS) update code to use ctrulib/great-refactor

This commit is contained in:
aliaspider 2015-10-21 15:41:06 +01:00
parent 35b18801ac
commit 339acfecf1
4 changed files with 20 additions and 17 deletions

View File

@ -244,6 +244,9 @@ ifeq ($(strip $(AEMSTRO)),)
$(error "Please set AEMSTRO in your environment. export AEMSTRO=<path to>aemstro")
endif
ifeq ($(wildcard $(CTRULIB)/include/3ds/ndsp),)
$(error "Please update ctrulib to the great-refactor branch")
endif
APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128)

View File

@ -121,8 +121,8 @@ static void *ctr_audio_init(const char *device, unsigned rate, unsigned latency)
ctr->pos = 0;
GSPGPU_FlushDataCache(NULL, (u8*)ctr->l_paddr, CTR_AUDIO_SIZE);
GSPGPU_FlushDataCache(NULL, (u8*)ctr->r_paddr, CTR_AUDIO_SIZE);
GSPGPU_FlushDataCache(ctr->l_paddr, CTR_AUDIO_SIZE);
GSPGPU_FlushDataCache(ctr->r_paddr, CTR_AUDIO_SIZE);
csndPlaySound_custom(0x8, SOUND_LOOPMODE(CSND_LOOPMODE_NORMAL)| SOUND_FORMAT(CSND_ENCODING_PCM16),
1.0, -1.0, ctr->l, ctr->l, CTR_AUDIO_SIZE);
@ -196,8 +196,8 @@ static ssize_t ctr_audio_write(void *data, const void *buf, size_t size)
ctr->pos &= CTR_AUDIO_COUNT_MASK;
}
GSPGPU_FlushDataCache(NULL, (u8*)ctr->l, CTR_AUDIO_SIZE);
GSPGPU_FlushDataCache(NULL, (u8*)ctr->r, CTR_AUDIO_SIZE);
GSPGPU_FlushDataCache(ctr->l, CTR_AUDIO_SIZE);
GSPGPU_FlushDataCache(ctr->r, CTR_AUDIO_SIZE);
retro_perf_stop(&ctraudio_f);

View File

@ -277,7 +277,7 @@ static void* ctr_init(const video_info_t* video,
ctr->frame_coords->y1 = CTR_TOP_FRAMEBUFFER_HEIGHT;
ctr->frame_coords->u = CTR_TOP_FRAMEBUFFER_WIDTH;
ctr->frame_coords->v = CTR_TOP_FRAMEBUFFER_HEIGHT;
GSPGPU_FlushDataCache(NULL, (u8*)ctr->frame_coords, sizeof(ctr_vertex_t));
GSPGPU_FlushDataCache(ctr->frame_coords, sizeof(ctr_vertex_t));
ctr->menu.texture_width = 512;
ctr->menu.texture_height = 512;
@ -294,7 +294,7 @@ static void* ctr_init(const video_info_t* video,
ctr->menu.frame_coords->y1 = CTR_TOP_FRAMEBUFFER_HEIGHT;
ctr->menu.frame_coords->u = CTR_TOP_FRAMEBUFFER_WIDTH - 80;
ctr->menu.frame_coords->v = CTR_TOP_FRAMEBUFFER_HEIGHT;
GSPGPU_FlushDataCache(NULL, (u8*)ctr->menu.frame_coords, sizeof(ctr_vertex_t));
GSPGPU_FlushDataCache(ctr->menu.frame_coords, sizeof(ctr_vertex_t));
ctr_set_scale_vector(&ctr->scale_vector,
CTR_TOP_FRAMEBUFFER_WIDTH, CTR_TOP_FRAMEBUFFER_HEIGHT,
@ -510,7 +510,7 @@ static bool ctr_frame(void* data, const void* frame,
dst += ctr->texture_width * (ctr->rgb32? 4: 2);
src += pitch;
}
GSPGPU_FlushDataCache(NULL, ctr->texture_linear,
GSPGPU_FlushDataCache(ctr->texture_linear,
ctr->texture_width * ctr->texture_height * (ctr->rgb32? 4: 2));
ctrGuCopyImage(false, ctr->texture_linear, ctr->texture_width, ctr->texture_height, ctr->rgb32 ? CTRGU_RGBA8: CTRGU_RGB565, false,
@ -528,7 +528,7 @@ static bool ctr_frame(void* data, const void* frame,
ctr->frame_coords->u = width;
ctr->frame_coords->v = height;
GSPGPU_FlushDataCache(NULL, (u8*)ctr->frame_coords, sizeof(ctr_vertex_t));
GSPGPU_FlushDataCache(ctr->frame_coords, sizeof(ctr_vertex_t));
ctrGuSetAttributeBuffersAddress(VIRT_TO_PHYS(ctr->frame_coords));
ctrGuSetVertexShaderFloatUniform(0, (float*)&ctr->scale_vector, 1);
@ -559,7 +559,7 @@ static bool ctr_frame(void* data, const void* frame,
0xFF0000);
}
GPU_DrawArray(GPU_UNKPRIM, 0, 1);
GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1);
/* restore */
if (ctr->rgb32)
@ -578,7 +578,7 @@ static bool ctr_frame(void* data, const void* frame,
if (ctr->menu_texture_enable)
{
GSPGPU_FlushDataCache(NULL, ctr->menu.texture_linear,
GSPGPU_FlushDataCache(ctr->menu.texture_linear,
ctr->menu.texture_width * ctr->menu.texture_height * sizeof(uint16_t));
ctrGuCopyImage(false, ctr->menu.texture_linear, ctr->menu.texture_width, ctr->menu.texture_height, CTRGU_RGBA4444,false,
@ -592,7 +592,7 @@ static bool ctr_frame(void* data, const void* frame,
ctrGuSetAttributeBuffersAddress(VIRT_TO_PHYS(ctr->menu.frame_coords));
ctrGuSetVertexShaderFloatUniform(0, (float*)&ctr->menu.scale_vector, 1);
GPU_DrawArray(GPU_UNKPRIM, 0, 1);
GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1);
}
GPU_FinishDrawing();
@ -694,7 +694,7 @@ static void ctr_set_texture_frame(void* data, const void* frame, bool rgb32,
ctr->menu.frame_coords->y1 = ctr->menu.frame_coords->y0 + height;
ctr->menu.frame_coords->u = width;
ctr->menu.frame_coords->v = height;
GSPGPU_FlushDataCache(NULL, (u8*)ctr->menu.frame_coords, sizeof(ctr_vertex_t));
GSPGPU_FlushDataCache(ctr->menu.frame_coords, sizeof(ctr_vertex_t));
}
static void ctr_set_texture_enable(void* data, bool state, bool full_screen)

View File

@ -115,7 +115,7 @@ static INLINE Result ctrGuSetCommandList_First(bool queued, u32* buf0a, u32 buf0
gxCommand[6]=(u32)buf2s; //buf2 size
gxCommand[7]=0x0;
return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand, NULL);
return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand);
}
__attribute__((always_inline))
@ -129,7 +129,7 @@ static INLINE Result ctrGuSetCommandList_Last(bool queued, u32* buf0a, u32 buf0s
gxCommand[4]=gxCommand[5]=gxCommand[6]=0x0;
gxCommand[7]=(flags>>1)&1; //when non-zero, call svcFlushProcessDataCache() with the specified buffer
return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand, NULL);
return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand);
}
__attribute__((always_inline))
@ -153,7 +153,7 @@ static INLINE Result ctrGuSetMemoryFill(bool queued, u32* buf0a, u32 buf0v, u32*
gxCommand[6]=(u32)buf1e; //buf1 end addr
gxCommand[7]=(width0)|(width1<<16);
return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand, NULL);
return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand);
}
__attribute__((always_inline))
@ -175,7 +175,7 @@ static INLINE Result ctrGuCopyImage
| ((dst_w > src_w) ? CTRGU_DMA_TRUNCATE : 0);
gxCommand[6]=gxCommand[7]=0x0;
return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand, NULL);
return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand);
}
@ -194,7 +194,7 @@ static INLINE Result ctrGuDisplayTransfer
gxCommand[5]=(src_fmt << 8) | (dst_fmt << 12) | multisample_lvl;
gxCommand[6]=gxCommand[7]=0x0;
return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand, NULL);
return GSPGPU_SubmitGxCommand(gxCmdBuf, gxCommand);
}