diff --git a/Makefile.ctr b/Makefile.ctr index bde79c9f5f..7a9b04414a 100644 --- a/Makefile.ctr +++ b/Makefile.ctr @@ -8,6 +8,7 @@ BUILD_3DSX = 1 BUILD_3DS = 0 BUILD_CIA = 1 LIBCTRU_NO_DEPRECATION = 1 +USE_CTRULIB_2 = 0 APP_TITLE = RetroArch 3DS APP_DESCRIPTION = RetroArch 3DS @@ -35,8 +36,7 @@ OBJ += ctr/exec-3dsx/exec_cia.o \ ctr/exec-3dsx/exec_3dsx.o \ ctr/exec-3dsx/mini-hb-menu/launch.o \ ctr/exec-3dsx/mini-hb-menu/loaders/rosalina.o \ - ctr/exec-3dsx/mini-hb-menu/loaders/hax2.o \ - ctr/exec-3dsx/mini-hb-menu/loaders/ninjhax1.o + ctr/exec-3dsx/mini-hb-menu/loaders/hax2.o ifeq ($(APP_BIG_TEXT_SECTION), 1) APP_USE_SVCHAX = 1 @@ -104,6 +104,18 @@ ifeq ($(strip $(CTRULIB)),) CTRULIB = $(DEVKITPRO)/libctru endif +ifeq ($(strip $(USE_CTRULIB_2)),1) + CFLAGS += -DUSE_CTRULIB_2 +endif + +ifeq ($(strip $(DEVKITTOOLS)),) + ifeq ($(strip $(USE_CTRULIB_2)),1) + DEVKITTOOLS = $(DEVKITPRO)/tools + else + DEVKITTOOLS = $(DEVKITARM) + endif +endif + APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128) APP_DESCRIPTION := $(shell echo "$(APP_DESCRIPTION)" | cut -c1-256) APP_AUTHOR := $(shell echo "$(APP_AUTHOR)" | cut -c1-128) @@ -225,13 +237,13 @@ else endif %.o: %.vsh %.gsh - $(DEVKITARM)/bin/picasso $^ -o $*.shbin - $(DEVKITARM)/bin/bin2s $*.shbin | $(PREFIX)as -o $@ + $(DEVKITTOOLS)/bin/picasso $^ -o $*.shbin + $(DEVKITTOOLS)/bin/bin2s $*.shbin | $(PREFIX)as -o $@ rm $*.shbin %.o: %.vsh - $(DEVKITARM)/bin/picasso $^ -o $*.shbin - $(DEVKITARM)/bin/bin2s $*.shbin | $(PREFIX)as -o $@ + $(DEVKITTOOLS)/bin/picasso $^ -o $*.shbin + $(DEVKITTOOLS)/bin/bin2s $*.shbin | $(PREFIX)as -o $@ rm $*.shbin %.o: %.cpp @@ -252,7 +264,7 @@ endif %.vsh: $(TARGET).smdh: $(APP_ICON) - $(DEVKITARM)/bin/smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@ + $(DEVKITTOOLS)/bin/smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@ $(TARGET).3dsx: $(TARGET).elf ifeq ($(APP_BIG_TEXT_SECTION), 1) @@ -260,7 +272,7 @@ ifeq ($(APP_BIG_TEXT_SECTION), 1) else rm -f $(TARGET).xml endif - $(DEVKITARM)/bin/3dsxtool $< $@ $(_3DSXFLAGS) + $(DEVKITTOOLS)/bin/3dsxtool $< $@ $(_3DSXFLAGS) $(TARGET).elf: ctr/3dsx_custom_crt0.o $(LD) $(LDFLAGS) $(OBJ) $(LIBDIRS) $(LIBS) -o $@ diff --git a/Makefile.ctr.salamander b/Makefile.ctr.salamander index ffd3082f3f..6716fb3dce 100644 --- a/Makefile.ctr.salamander +++ b/Makefile.ctr.salamander @@ -5,6 +5,7 @@ DEBUG = 0 BUILD_3DSX = 1 BUILD_3DS = 0 BUILD_CIA = 1 +USE_CTRULIB_2 = 0 APP_TITLE = RetroArch 3DS APP_DESCRIPTION = RetroArch 3DS @@ -46,13 +47,24 @@ OBJ += ctr/exec-3dsx/exec_cia.o \ ctr/exec-3dsx/exec_3dsx.o \ ctr/exec-3dsx/mini-hb-menu/launch.o \ ctr/exec-3dsx/mini-hb-menu/loaders/rosalina.o \ - ctr/exec-3dsx/mini-hb-menu/loaders/hax2.o \ - ctr/exec-3dsx/mini-hb-menu/loaders/ninjhax1.o + ctr/exec-3dsx/mini-hb-menu/loaders/hax2.o ifeq ($(strip $(DEVKITPRO)),) $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitpro") endif +ifeq ($(strip $(USE_CTRULIB_2)),1) + CFLAGS += -DUSE_CTRULIB_2 +endif + +ifeq ($(strip $(DEVKITTOOLS)),) + ifeq ($(strip $(USE_CTRULIB_2)),1) + DEVKITTOOLS = $(DEVKITPRO)/tools + else + DEVKITTOOLS = $(DEVKITARM) + endif +endif + ifeq ($(strip $(CTRULIB)),) CTRULIB = $(DEVKITPRO)/libctru endif @@ -154,13 +166,13 @@ else endif %.o: %.vsh %.gsh - $(DEVKITARM)/bin/picasso $^ -o $*.shbin - $(DEVKITARM)/bin/bin2s $*.shbin | $(PREFIX)as -o $@ + $(DEVKITTOOLS)/bin/picasso $^ -o $*.shbin + $(DEVKITTOOLS)/bin/bin2s $*.shbin | $(PREFIX)as -o $@ rm $*.shbin %.o: %.vsh - $(DEVKITARM)/bin/picasso $^ -o $*.shbin - $(DEVKITARM)/bin/bin2s $*.shbin | $(PREFIX)as -o $@ + $(DEVKITTOOLS)/bin/picasso $^ -o $*.shbin + $(DEVKITTOOLS)/bin/bin2s $*.shbin | $(PREFIX)as -o $@ rm $*.shbin %.o: %.cpp @@ -181,7 +193,7 @@ endif %.vsh: $(TARGET).smdh: $(APP_ICON) - $(DEVKITARM)/bin/smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@ + $(DEVKITTOOLS)/bin/smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@ $(TARGET).3dsx: $(TARGET).elf ifeq ($(APP_BIG_TEXT_SECTION), 1) @@ -189,7 +201,7 @@ ifeq ($(APP_BIG_TEXT_SECTION), 1) else rm -f $(TARGET).xml endif - $(DEVKITARM)/bin/3dsxtool $< $@ $(_3DSXFLAGS) + $(DEVKITTOOLS)/bin/3dsxtool $< $@ $(_3DSXFLAGS) $(TARGET).elf: ctr/3dsx_custom_crt0.o $(LD) $(LDFLAGS) $(OBJ) $(LIBDIRS) $(LIBS) -o $@ diff --git a/audio/drivers/ctr_dsp_audio.c b/audio/drivers/ctr_dsp_audio.c index 58ec8a13e3..8575bcc6ec 100644 --- a/audio/drivers/ctr_dsp_audio.c +++ b/audio/drivers/ctr_dsp_audio.c @@ -108,6 +108,15 @@ static ssize_t ctr_dsp_audio_write(void *data, const void *buf, size_t size) { do{ svcSleepThread(100000); + + /* Run aptMainLoop to update APT state if DSP state + * changed, this prevents a hang on sleep. */ + if(!aptMainLoop()) + { + command_event(CMD_EVENT_QUIT, NULL); + return true; + } + sample_pos = ndspChnGetSamplePos(ctr->channel); }while (((sample_pos - (ctr->pos + (size >>2))) & CTR_DSP_AUDIO_COUNT_MASK) > (CTR_DSP_AUDIO_COUNT >> 1) || (((ctr->pos - (CTR_DSP_AUDIO_COUNT >> 4) - sample_pos) & CTR_DSP_AUDIO_COUNT_MASK) > (CTR_DSP_AUDIO_COUNT >> 1))); diff --git a/ctr/ctr_linear.cpp b/ctr/ctr_linear.cpp index 2dc6f80c2a..f73a4b7723 100644 --- a/ctr/ctr_linear.cpp +++ b/ctr/ctr_linear.cpp @@ -201,8 +201,7 @@ void* linearMemAlign(size_t size, size_t alignment) void* linearAlloc(size_t size) { #if 0 - extern PrintConsole* currentConsole; - if(currentConsole->consoleInitialised) + if(ctrConsole && ctrConsole->consoleInitialised) { printf("linearAlloc : 0x%08X\n", size); DEBUG_HOLD(); diff --git a/ctr/ctr_svchax.c b/ctr/ctr_svchax.c index 53f96d367a..7614417c31 100644 --- a/ctr/ctr_svchax.c +++ b/ctr/ctr_svchax.c @@ -44,7 +44,9 @@ typedef struct bool isNew3DS; u32 kernel_fcram_mapping_offset; +#ifndef USE_CTRULIB_2 Handle arbiter; +#endif volatile u32 alloc_address; volatile u32 alloc_size; u8* flush_buffer; @@ -263,7 +265,9 @@ static void do_memchunkhax2(void) svcCloseHandle(mch2.dummy_threads_lock); +#ifndef USE_CTRULIB_2 mch2.arbiter = __sync_get_arbiter(); +#endif svcControlMemory(&linear_buffer, 0, 0, 0x1000, MEMOP_ALLOC_LINEAR, MEMPERM_READ | MEMPERM_WRITE); @@ -327,9 +331,14 @@ static void do_memchunkhax2(void) (ThreadFunc)alloc_thread_entry, (u32)&mch2, mch2.threads[MCH2_THREAD_COUNT_MAX - 1].stack_top, 0x3F, 1); +#ifdef USE_CTRULIB_2 + while ((u32) syncArbitrateAddress((s32 *)mch2.alloc_address, + ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT, 0) == 0xD9001814); +#else while ((u32) svcArbitrateAddress(mch2.arbiter, mch2.alloc_address, ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT, 0, 0) == 0xD9001814); +#endif GX_TextureCopy((void*)linear_buffer, 0, (void*)dst_memchunk, 0, 16, 8); memcpy(flush_buffer, flush_buffer + 0x4000, 0x4000); diff --git a/ctr/ctr_system.c b/ctr/ctr_system.c index 4f690d6eaa..544a6ae327 100644 --- a/ctr/ctr_system.c +++ b/ctr/ctr_system.c @@ -21,6 +21,8 @@ u32 __heapBase; u32 __stack_bottom; u32 __stack_size_extra; +u32 __saved_stack; + extern u32 __linear_heap_size_hbl; extern u32 __heap_size_hbl; extern void* __service_ptr; @@ -74,6 +76,11 @@ void __system_allocateHeaps(void) /* Allocate the linear heap */ svcControlMemory(&__linear_heap, 0x0, 0x0, __linear_heap_size, MEMOP_ALLOC_LINEAR, MEMPERM_READ | MEMPERM_WRITE); +#ifdef USE_CTRULIB_2 + /* Mappable allocator init */ + mappableInit(OS_MAP_AREA_BEGIN, OS_MAP_AREA_END); +#endif + /* Set up newlib heap */ fake_heap_end = (char*)0x13F00000; } @@ -240,6 +247,9 @@ void __system_initArgv(void) void initSystem(void (*retAddr)(void)) { + register u32 sp_val __asm__("sp"); + __saved_stack = sp_val; + __libctru_init(retAddr); __appInit(); __system_initArgv(); @@ -250,6 +260,7 @@ void __attribute__((noreturn)) __ctru_exit(int rc) { __libc_fini_array(); __appExit(); + asm ("mov sp, %[saved_stack] \n\t" : : [saved_stack] "r" (__saved_stack) : "sp"); __libctru_exit(rc); } diff --git a/ctr/exec-3dsx/exec_3dsx.c b/ctr/exec-3dsx/exec_3dsx.c index c23c990904..39fa80511e 100644 --- a/ctr/exec-3dsx/exec_3dsx.c +++ b/ctr/exec-3dsx/exec_3dsx.c @@ -5,7 +5,6 @@ #include "mini-hb-menu/common.h" -extern const loaderFuncs_s loader_Ninjhax1; extern const loaderFuncs_s loader_Ninjhax2; extern const loaderFuncs_s loader_Rosalina; @@ -69,12 +68,6 @@ static int exec_3dsx_actual(const char* path, launch_3dsx = loader_Ninjhax2.launchFile; } - if (!inited) - { - inited = loader_Ninjhax1.init(); - launch_3dsx = loader_Ninjhax1.launchFile; - } - if (inited) { osSetSpeedupEnable(false); diff --git a/ctr/exec-3dsx/mini-hb-menu/loaders/ninjhax1.c b/ctr/exec-3dsx/mini-hb-menu/loaders/ninjhax1.c deleted file mode 100644 index 8fd05663d3..0000000000 --- a/ctr/exec-3dsx/mini-hb-menu/loaders/ninjhax1.c +++ /dev/null @@ -1,43 +0,0 @@ -#include "../common.h" - -static void (*callBootloader_1x)(Handle hb, Handle file); -static void (*setArgs_1x)(u32* src, u32 length); -static Handle fileHandle; - -static bool init(void) -{ - Result res = hbInit(); - if (R_FAILED(res)) - return false; - - HB_GetBootloaderAddresses((void**)&callBootloader_1x, (void**)&setArgs_1x); - return true; -} - -static void deinit(void) -{ - hbExit(); -} - -static void bootloaderJump(void) -{ - callBootloader_1x(0x00000000, fileHandle); -} - -static void launchFile(const char* path, argData_s* args, executableMetadata_s* em) -{ - fileHandle = launchOpenFile(path); - if (fileHandle==0) - return; - setArgs_1x(args->buf, sizeof(args->buf)); - __system_retAddr = bootloaderJump; -} - -const loaderFuncs_s loader_Ninjhax1 = -{ - .name = "ninjhax 1.x", - .flags = LOADER_SHOW_REBOOT, - .init = init, - .deinit = deinit, - .launchFile = launchFile, -}; diff --git a/frontend/drivers/platform_ctr.c b/frontend/drivers/platform_ctr.c index dcf654b89f..e664ac43c2 100644 --- a/frontend/drivers/platform_ctr.c +++ b/frontend/drivers/platform_ctr.c @@ -60,6 +60,8 @@ static enum frontend_fork ctr_fork_mode = FRONTEND_FORK_NONE; static const char* elf_path_cst = "sdmc:/retroarch/retroarch.3dsx"; +extern bool ctr_bottom_screen_enabled; + #ifdef IS_SALAMANDER static void get_first_valid_core(char* path_return, size_t len) { @@ -135,8 +137,6 @@ static void frontend_ctr_deinit(void* data) u8 not_2DS; u8 device_model = 0xFF; - extern PrintConsole* currentConsole; - (void)data; #ifndef IS_SALAMANDER @@ -153,8 +153,7 @@ static void frontend_ctr_deinit(void* data) verbosity_enable(); retro_main_log_file_init(NULL, false); - if ((gfxBottomFramebuffers[0] == (u8*)currentConsole->frameBuffer) - && (ctr_fork_mode == FRONTEND_FORK_NONE)) + if (ctr_bottom_screen_enabled && (ctr_fork_mode == FRONTEND_FORK_NONE)) wait_for_input(); CFGU_GetModelNintendo2DS(¬_2DS); @@ -394,6 +393,36 @@ __attribute__((weak)) u32 __ctr_patch_services; void gfxSetFramebufferInfo(gfxScreen_t screen, u8 id); +#ifdef USE_CTRULIB_2 +u8* gfxTopLeftFramebuffers[2]; +u8* gfxTopRightFramebuffers[2]; +u8* gfxBottomFramebuffers[2]; + +void gfxSetFramebufferInfo(gfxScreen_t screen, u8 id) +{ + if(screen==GFX_TOP) + { + u8 enable3d = 0; + u8 bit5=(enable3d != 0); + gspPresentBuffer(GFX_TOP, + id, + (u32*)gfxTopLeftFramebuffers[id], + enable3d ? (u32*)gfxTopRightFramebuffers[id] : (u32*)gfxTopLeftFramebuffers[id], + 240 * 3, + ((1)<<8)|((1^bit5)<<6)|((bit5)<<5)|GSP_BGR8_OES); + } else { + gspPresentBuffer(GFX_BOTTOM, + id, + (u32*)gfxBottomFramebuffers[id], + (u32*)gfxBottomFramebuffers[id], + 240 * 2, + GSP_RGB565_OES); + } +} +#endif + +PrintConsole* ctrConsole; + static void frontend_ctr_init(void* data) { #ifndef IS_SALAMANDER @@ -407,12 +436,25 @@ static void frontend_ctr_init(void* data) u32 topSize = 400 * 240 * 3; u32 bottomSize = 320 * 240 * 2; + +#ifdef USE_CTRULIB_2 + linearFree(gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL)); + linearFree(gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, NULL, NULL)); + linearFree(gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL)); + gfxSwapBuffers(); + + linearFree(gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL)); + linearFree(gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, NULL, NULL)); + linearFree(gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL)); + gfxSwapBuffers(); +#else linearFree(gfxTopLeftFramebuffers [0]); linearFree(gfxTopLeftFramebuffers [1]); linearFree(gfxBottomFramebuffers [0]); linearFree(gfxBottomFramebuffers [1]); linearFree(gfxTopRightFramebuffers[0]); linearFree(gfxTopRightFramebuffers[1]); +#endif gfxTopLeftFramebuffers [0] = linearAlloc(topSize * 2); gfxTopRightFramebuffers[0] = gfxTopLeftFramebuffers[0] + topSize; @@ -427,7 +469,7 @@ static void frontend_ctr_init(void* data) gfxSetFramebufferInfo(GFX_BOTTOM, 0); gfxSet3D(true); - consoleInit(GFX_BOTTOM, NULL); + ctrConsole = consoleInit(GFX_BOTTOM, NULL); /* enable access to all service calls when possible. */ if (svchax_init) @@ -518,7 +560,11 @@ static enum frontend_powerstate frontend_ctr_get_powerstate( u8 battery_percent = 0; u8 charging = 0; +#ifdef USE_CTRULIB_2 + MCUHWC_GetBatteryLevel(&battery_percent); +#else mcuHwcGetBatteryLevel(&battery_percent); +#endif *percent = battery_percent; /* 3DS does not support seconds of charge remaining */ diff --git a/gfx/common/ctr_common.h b/gfx/common/ctr_common.h index 17ce294a2b..8bd3547150 100644 --- a/gfx/common/ctr_common.h +++ b/gfx/common/ctr_common.h @@ -24,6 +24,14 @@ #define CTR_TOP_FRAMEBUFFER_WIDTH 400 #define CTR_TOP_FRAMEBUFFER_HEIGHT 240 +#ifdef USE_CTRULIB_2 +extern u8* gfxTopLeftFramebuffers[2]; +extern u8* gfxTopRightFramebuffers[2]; +extern u8* gfxBottomFramebuffers[2]; +#endif + +extern PrintConsole* ctrConsole; + extern const u8 ctr_sprite_shbin[]; extern const u32 ctr_sprite_shbin_size; diff --git a/gfx/drivers/ctr_gfx.c b/gfx/drivers/ctr_gfx.c index 4b7584b615..665cb72c58 100644 --- a/gfx/drivers/ctr_gfx.c +++ b/gfx/drivers/ctr_gfx.c @@ -51,7 +51,7 @@ * Have to keep track of bottom screen enable state * externally, otherwise cannot detect current state * when reinitialising... */ -static bool ctr_bottom_screen_enabled = true; +bool ctr_bottom_screen_enabled = true; static INLINE void ctr_check_3D_slider(ctr_video_t* ctr, ctr_video_mode_enum video_mode) { @@ -325,13 +325,12 @@ static void ctr_set_bottom_screen_enable(void* data, bool enabled) { Handle lcd_handle; u8 not_2DS; - extern PrintConsole* currentConsole; ctr_video_t *ctr = (ctr_video_t*)data; - if (!ctr) - return; + if (!ctr) + return; - gfxBottomFramebuffers[0] = enabled ? (u8*)currentConsole->frameBuffer: + gfxBottomFramebuffers[0] = enabled ? (u8*)ctrConsole->frameBuffer: (u8*)ctr->empty_framebuffer; CFGU_GetModelNintendo2DS(¬_2DS); @@ -916,6 +915,32 @@ static bool ctr_frame(void* data, const void* frame, /* Swap buffers : */ +#ifdef USE_CTRULIB_2 + u32 *buf0, *buf1; + u32 stride; + + buf0 = (u32*)gfxTopLeftFramebuffers[ctr->current_buffer_top]; + + if(ctr->video_mode == CTR_VIDEO_MODE_2D_800X240) + { + buf1 = (u32*)(gfxTopLeftFramebuffers[ctr->current_buffer_top] + 240 * 3); + stride = 240 * 3 * 2; + } + else + { + if (ctr->enable_3d) + buf1 = (u32*)gfxTopRightFramebuffers[ctr->current_buffer_top]; + else + buf1 = buf0; + + stride = 240 * 3; + } + + u8 bit5 = (ctr->enable_3d != 0); + + gspPresentBuffer(GFX_TOP, ctr->current_buffer_top, buf0, buf1, + stride, (1<<8)|((1^bit5)<<6)|((bit5)<<5)|GSP_BGR8_OES); +#else topFramebufferInfo. active_framebuf = ctr->current_buffer_top; topFramebufferInfo. @@ -953,6 +978,7 @@ static bool ctr_frame(void* data, const void* frame, framebufferInfoHeader[0x0] ^= 1; framebufferInfo[framebufferInfoHeader[0x0]] = topFramebufferInfo; framebufferInfoHeader[0x1] = 1; +#endif ctr->current_buffer_top ^= 1; ctr->p3d_event_pending = true; diff --git a/gfx/drivers/ctr_gu.h b/gfx/drivers/ctr_gu.h index 0307604ddd..317f2b8753 100644 --- a/gfx/drivers/ctr_gu.h +++ b/gfx/drivers/ctr_gu.h @@ -58,6 +58,20 @@ extern u32 gpuCmdBufOffset; extern u32 __linear_heap_size; extern u32 __linear_heap; +#ifdef USE_CTRULIB_2 +__attribute__((always_inline)) +static INLINE Result ctrGspSubmitGxCommand(u32 gxCommand[0x8]) +{ + return gspSubmitGxCommand(gxCommand); +} +#else +__attribute__((always_inline)) +static INLINE Result ctrGspSubmitGxCommand(u32 gxCommand[0x8]) +{ + return gspSubmitGxCommand(gxCmdBuf, gxCommand); +} +#endif + __attribute__((always_inline)) static INLINE Result ctr_set_parallax_layer(bool state) { @@ -107,7 +121,7 @@ static INLINE Result ctrGuSetCommandList_First(bool queued, u32* buf0a, u32 buf0 gxCommand[6]=(u32)buf2s; //buf2 size gxCommand[7]=0x0; - return gspSubmitGxCommand(gxCmdBuf, gxCommand); + return ctrGspSubmitGxCommand(gxCommand); } __attribute__((always_inline)) @@ -121,7 +135,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 gspSubmitGxCommand(gxCmdBuf, gxCommand); + return ctrGspSubmitGxCommand(gxCommand); } __attribute__((always_inline)) @@ -145,7 +159,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 gspSubmitGxCommand(gxCmdBuf, gxCommand); + return ctrGspSubmitGxCommand(gxCommand); } __attribute__((always_inline)) @@ -167,7 +181,7 @@ static INLINE Result ctrGuCopyImage | ((dst_w > src_w) ? CTRGU_DMA_TRUNCATE : 0); gxCommand[6]=gxCommand[7]=0x0; - return gspSubmitGxCommand(gxCmdBuf, gxCommand); + return ctrGspSubmitGxCommand(gxCommand); } @@ -186,7 +200,7 @@ static INLINE Result ctrGuDisplayTransfer gxCommand[5]=(src_fmt << 8) | (dst_fmt << 12) | multisample_lvl; gxCommand[6]=gxCommand[7]=0x0; - return gspSubmitGxCommand(gxCmdBuf, gxCommand); + return ctrGspSubmitGxCommand(gxCommand); } diff --git a/libretro-common/features/features_cpu.c b/libretro-common/features/features_cpu.c index a0dda815d2..0ad815e2a0 100644 --- a/libretro-common/features/features_cpu.c +++ b/libretro-common/features/features_cpu.c @@ -234,6 +234,8 @@ retro_time_t cpu_features_get_time_usec(void) return ticks_to_us(OSGetSystemTime()); #elif defined(SWITCH) || defined(HAVE_LIBNX) return (svcGetSystemTick() * 10) / 192; +#elif defined(_3DS) + return osGetTime() * 1000; #elif defined(_POSIX_MONOTONIC_CLOCK) || defined(__QNX__) || defined(ANDROID) || defined(__MACH__) || defined(DJGPP) struct timespec tv = {0}; if (ra_clock_gettime(CLOCK_MONOTONIC, &tv) < 0) @@ -245,8 +247,6 @@ retro_time_t cpu_features_get_time_usec(void) return ps2_clock() / PS2_CLOCKS_PER_MSEC * 1000; #elif defined(VITA) || defined(PSP) return sceKernelGetSystemTimeWide(); -#elif defined(_3DS) - return osGetTime() * 1000; #else #error "Your platform does not have a timer function implemented in cpu_features_get_time_usec(). Cannot continue." #endif diff --git a/pkg/ctr/tools/makerom-linux b/pkg/ctr/tools/makerom-linux index f3f6cd5469..b9580da614 100755 Binary files a/pkg/ctr/tools/makerom-linux and b/pkg/ctr/tools/makerom-linux differ diff --git a/pkg/ctr/tools/makerom-mac b/pkg/ctr/tools/makerom-mac index 8d246131bd..d95560721c 100755 Binary files a/pkg/ctr/tools/makerom-mac and b/pkg/ctr/tools/makerom-mac differ diff --git a/pkg/ctr/tools/makerom.exe b/pkg/ctr/tools/makerom.exe index b8741b7f75..6073c403d7 100755 Binary files a/pkg/ctr/tools/makerom.exe and b/pkg/ctr/tools/makerom.exe differ