diff --git a/Makefile.ctr b/Makefile.ctr index 1539ba72aa..506361742f 100644 --- a/Makefile.ctr +++ b/Makefile.ctr @@ -25,233 +25,80 @@ APP_USE_SVCHAX = 0 include ctr/Makefile.cores -OBJS := -OBJS += gfx/drivers/ctr_shaders/ctr_sprite.o -OBJS += ctr/ctr_system.o -OBJS += ctr/ctr_memory.o -OBJS += ctr/ctr_linear.o +OBJ := +OBJ += gfx/drivers/ctr_shaders/ctr_sprite.o +OBJ += ctr/ctr_system.o +OBJ += ctr/ctr_memory.o +OBJ += ctr/ctr_linear.o +OBJ += ctr/gpu_old.o ifeq ($(APP_BIG_TEXT_SECTION), 1) APP_USE_SVCHAX = 1 - LDFLAGS += -Wl,--defsym,__ctr_patch_services=__service_ptr + LDFLAGS += -Wl,--defsym,__ctr_patch_services=__service_ptr endif ifeq ($(APP_USE_SVCHAX), 1) - OBJS += ctr/ctr_svchax.o + OBJ += ctr/ctr_svchax.o endif +DEFINES := ifeq ($(GRIFFIN_BUILD), 1) - OBJS += griffin/griffin.o + OBJ += griffin/griffin.o + DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI + DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_BUILTIN_AUTOCONFIG else - CFLAGS += -DHAVE_COMPRESSION - OBJS += libretro-common/file/archive_file.o - OBJS += libretro-common/file/archive_file_zlib.o - OBJS += libretro-common/file/archive_file_7z.o - OBJS += libretro-common/encodings/encoding_utf.o - OBJS += verbosity.o - OBJS += performance.o - OBJS += libretro-common/compat/compat_getopt.o - OBJS += libretro-common/compat/compat_strcasestr.o - OBJS += libretro-common/compat/compat_strl.o - OBJS += libretro-common/compat/compat_fnmatch.o - OBJS += libretro-common/memmap/memalign.o - OBJS += libretro-common/file/config_file.o - OBJS += config_file_userdata.o - OBJS += core_options.o - OBJS += cheats.o - OBJS += libretro-common/hash/rhash.o - OBJS += gfx/video_context_driver.o - OBJS += gfx/drivers_context/gfx_null_ctx.o - OBJS += libretro-common/formats/image_texture.o - OBJS += libretro-common/formats/tga/rtga.o - OBJS += libretro-common/formats/png/rpng.o - OBJS += libretro-common/formats/png/rpng_encode.o - OBJS += libretro-common/formats/bmp/rbmp_encode.o - OBJS += libretro-common/gfx/math/matrix_4x4.o - OBJS += libretro-common/gfx/math/matrix_3x3.o - OBJS += gfx/drivers/ctr_gfx.o - OBJS += gfx/drivers/nullgfx.o - OBJS += gfx/font_driver.o - OBJS += gfx/drivers_font_renderer/bitmapfont.o - OBJS += input/input_autodetect.o - OBJS += input/input_joypad_driver.o - OBJS += input/input_hid_driver.o - OBJS += input/input_config.o - OBJS += input/input_keymaps.o - OBJS += input/input_remapping.o - OBJS += input/input_keyboard.o - OBJS += input/drivers/ctr_input.o - OBJS += input/drivers_joypad/ctr_joypad.o - OBJS += input/autoconf/builtin_ctr.o - OBJS += input/drivers/nullinput.o - OBJS += input/drivers_joypad/null_joypad.o - OBJS += input/drivers_joypad/hid_joypad.o - OBJS += input/drivers_hid/null_hid.o - OBJS += gfx/video_state_tracker.o - OBJS += libretro-common/queues/fifo_queue.o - OBJS += audio/audio_resampler_driver.o - OBJS += audio/drivers_resampler/sinc_resampler.o - OBJS += audio/drivers_resampler/nearest_resampler.o - OBJS += audio/drivers_resampler/null_resampler.o - OBJS += audio/drivers_resampler/cc_resampler.o - OBJS += camera/drivers/nullcamera.o - OBJS += location/drivers/nulllocation.o - OBJS += audio/drivers/ctr_csnd_audio.o - OBJS += audio/drivers/ctr_dsp_audio.o - OBJS += audio/drivers/nullaudio.o - OBJS += gfx/video_driver.o - OBJS += gfx/video_coord_array.o - OBJS += input/input_driver.o - OBJS += audio/audio_driver.o - OBJS += camera/camera_driver.o - OBJS += location/location_driver.o - OBJS += driver.o - OBJS += libretro-common/gfx/scaler/scaler_filter.o - OBJS += libretro-common/gfx/scaler/pixconv.o - OBJS += libretro-common/gfx/scaler/scaler.o - OBJS += libretro-common/gfx/scaler/scaler_int.o - OBJS += gfx/video_filters/2xsai.o - OBJS += gfx/video_filters/super2xsai.o - OBJS += gfx/video_filters/supereagle.o - OBJS += gfx/video_filters/2xbr.o - OBJS += gfx/video_filters/darken.o - OBJS += gfx/video_filters/epx.o - OBJS += gfx/video_filters/scale2x.o - OBJS += gfx/video_filters/blargg_ntsc_snes.o - OBJS += gfx/video_filters/lq2x.o - OBJS += gfx/video_filters/phosphor2x.o - OBJS += audio/audio_filters/echo.o - OBJS += audio/audio_filters/eq.o - OBJS += audio/audio_filters/chorus.o - OBJS += audio/audio_filters/iir.o - OBJS += audio/audio_filters/panning.o - OBJS += audio/audio_filters/phaser.o - OBJS += audio/audio_filters/reverb.o - OBJS += audio/audio_filters/wahwah.o - OBJS += libretro-common/dynamic/dylib.o - OBJS += dynamic.o - OBJS += gfx/video_filter.o - OBJS += audio/audio_dsp_filter.o - OBJS += cores/dynamic_dummy.o - OBJS += content.o - OBJS += libretro-common/file/file_path.o - OBJS += file_path_special.o - OBJS += libretro-common/lists/dir_list.o - OBJS += libretro-common/file/retro_dirent.o - OBJS += libretro-common/streams/file_stream.o - OBJS += libretro-common/file/retro_stat.o - OBJS += list_special.o - OBJS += libretro-common/lists/string_list.o - OBJS += libretro-common/string/stdstring.o - OBJS += libretro-common/file/nbio/nbio_stdio.o - OBJS += libretro-common/lists/file_list.o - OBJS += libretro-common/queues/message_queue.o - OBJS += patch.o - OBJS += configuration.o - OBJS += rewind.o - OBJS += frontend/frontend_driver.o - OBJS += frontend/drivers/platform_ctr.o - OBJS += frontend/drivers/platform_null.o - OBJS += core_info.o - OBJS += ui/ui_companion_driver.o - OBJS += ui/drivers/ui_null.o - OBJS += frontend/frontend.o - OBJS += libretro_version_1.o - OBJS += retroarch.o - OBJS += runloop.o - OBJS += libretro-common/queues/task_queue.o - OBJS += tasks/tasks_internal.o - OBJS += msg_hash.o - OBJS += intl/msg_hash_de.o - OBJS += intl/msg_hash_es.o - OBJS += intl/msg_hash_eo.o - OBJS += intl/msg_hash_fr.o - OBJS += intl/msg_hash_it.o - OBJS += intl/msg_hash_nl.o - OBJS += intl/msg_hash_pt.o - OBJS += intl/msg_hash_pl.o - OBJS += intl/msg_hash_us.o - OBJS += movie.o - OBJS += record/record_driver.o - OBJS += record/drivers/record_null.o - OBJS += tasks/task_content.o - OBJS += tasks/task_file_transfer.o - OBJS += tasks/task_decompress.o - OBJS += screenshot.o - OBJS += playlist.o - OBJS += menu/menu_driver.o - OBJS += menu/menu_hash.o - OBJS += menu/menu_input.o - OBJS += menu/menu_entry.o - OBJS += menu/menu_entries.o - OBJS += menu/menu_setting.o - OBJS += menu/menu_cbs.o - OBJS += menu/menu_content.o - OBJS += menu/cbs/menu_cbs_ok.o - OBJS += menu/cbs/menu_cbs_cancel.o - OBJS += menu/cbs/menu_cbs_select.o - OBJS += menu/cbs/menu_cbs_start.o - OBJS += menu/cbs/menu_cbs_info.o - OBJS += menu/cbs/menu_cbs_refresh.o - OBJS += menu/cbs/menu_cbs_left.o - OBJS += menu/cbs/menu_cbs_right.o - OBJS += menu/cbs/menu_cbs_title.o - OBJS += menu/cbs/menu_cbs_deferred_push.o - OBJS += menu/cbs/menu_cbs_scan.o - OBJS += menu/cbs/menu_cbs_get_value.o - OBJS += menu/cbs/menu_cbs_up.o - OBJS += menu/cbs/menu_cbs_down.o - OBJS += menu/cbs/menu_cbs_contentlist_switch.o - OBJS += menu/menu_shader.o - OBJS += menu/menu_navigation.o - OBJS += menu/menu_display.o - OBJS += menu/menu_displaylist.o - OBJS += menu/menu_animation.o - OBJS += menu/intl/menu_hash_de.o - OBJS += menu/intl/menu_hash_es.o - OBJS += menu/intl/menu_hash_eo.o - OBJS += menu/intl/menu_hash_fr.o - OBJS += menu/intl/menu_hash_it.o - OBJS += menu/intl/menu_hash_nl.o - OBJS += menu/intl/menu_hash_pl.o - OBJS += menu/intl/menu_hash_pt.o - OBJS += menu/intl/menu_hash_us.o - OBJS += menu/drivers/null.o - OBJS += menu/drivers/menu_generic.o - OBJS += menu/drivers_display/menu_display_null.o - OBJS += menu/drivers/rgui.o - OBJS += command_event.o - OBJS += deps/zlib/adler32.o - OBJS += deps/zlib/compress.o - OBJS += deps/zlib/crc32.o - OBJS += deps/zlib/deflate.o - OBJS += deps/zlib/gzclose.o - OBJS += deps/zlib/gzlib.o - OBJS += deps/zlib/gzread.o - OBJS += deps/zlib/gzwrite.o - OBJS += deps/zlib/inffast.o - OBJS += deps/zlib/inflate.o - OBJS += deps/zlib/inftrees.o - OBJS += deps/zlib/trees.o - OBJS += deps/zlib/uncompr.o - OBJS += deps/zlib/zutil.o - OBJS += audio/audio_utils.o + HAVE_MENU_COMMON = 1 + HAVE_RTGA = 1 + HAVE_RPNG = 1 + HAVE_RJPEG = 1 + HAVE_RBMP = 1 + HAVE_RGUI = 1 + HAVE_ZLIB = 1 + HAVE_7ZIP = 1 + HAVE_BUILTINZLIB = 1 + HAVE_BUILTIN_AUTOCONFIG = 1 + + include Makefile.common + BLACKLIST := + BLACKLIST += input/input_overlay.o + BLACKLIST += tasks/task_overlay.o + OBJ := $(filter-out $(BLACKLIST),$(OBJ)) + + OBJ += gfx/drivers/ctr_gfx.o + OBJ += input/drivers/ctr_input.o + OBJ += input/drivers_joypad/ctr_joypad.o + OBJ += audio/drivers/ctr_csnd_audio.o + OBJ += audio/drivers/ctr_dsp_audio.o + OBJ += frontend/drivers/platform_ctr.o + OBJ += gfx/video_filters/2xsai.o + OBJ += gfx/video_filters/super2xsai.o + OBJ += gfx/video_filters/supereagle.o + OBJ += gfx/video_filters/2xbr.o + OBJ += gfx/video_filters/darken.o + OBJ += gfx/video_filters/epx.o + OBJ += gfx/video_filters/scale2x.o + OBJ += gfx/video_filters/blargg_ntsc_snes.o + OBJ += gfx/video_filters/lq2x.o + OBJ += gfx/video_filters/phosphor2x.o + OBJ += audio/audio_filters/echo.o + OBJ += audio/audio_filters/eq.o + OBJ += audio/audio_filters/chorus.o + OBJ += audio/audio_filters/iir.o + OBJ += audio/audio_filters/panning.o + OBJ += audio/audio_filters/phaser.o + OBJ += audio/audio_filters/reverb.o + OBJ += audio/audio_filters/wahwah.o endif -ifeq ($(strip $(DEVKITARM)),) -$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") +ifeq ($(strip $(DEVKITPRO)),) +$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitpro") endif ifeq ($(strip $(CTRULIB)),) -$(error "Please set CTRULIB in your environment. export CTRULIB=ctrulib") + CTRULIB = $(DEVKITPRO)/ctrulib endif -ifeq ($(strip $(AEMSTRO)),) -$(error "Please set AEMSTRO in your environment. export AEMSTRO=aemstro") -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) @@ -292,8 +139,7 @@ endif CFLAGS += -I. -Ideps/zlib -Ideps/7zip -Ilibretro-common/include CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE -DSINC_LOWEST_QUALITY -CFLAGS += -DHAVE_GRIFFIN=1 -DHAVE_FILTERS_BUILTIN -DHAVE_MENU -DHAVE_RGUI -CFLAGS += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_BUILTIN_AUTOCONFIG +CFLAGS += -DHAVE_FILTERS_BUILTIN $(DEFINES) CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 @@ -324,9 +170,9 @@ all: $(TARGET) $(TARGET): $(TARGET_3DSX) $(TARGET_3DS) $(TARGET_CIA) $(TARGET).3dsx: $(TARGET).elf -$(TARGET).elf: $(OBJS) libretro_ctr.a +$(TARGET).elf: $(OBJ) libretro_ctr.a -PREFIX := $(DEVKITARM)/bin/arm-none-eabi- +PREFIX := $(DEVKITPRO)/devkitARM/bin/arm-none-eabi- CC := $(PREFIX)gcc CXX := $(PREFIX)g++ @@ -349,13 +195,13 @@ else endif %.o: %.vsh %.gsh - $(DEVKITARM)/bin/picasso $^ -o $*.shbin - $(DEVKITARM)/bin/bin2s $*.shbin | $(PREFIX)as -o $@ + $(DEVKITPRO)/devkitARM/bin/picasso $^ -o $*.shbin + $(DEVKITPRO)/devkitARM/bin/bin2s $*.shbin | $(PREFIX)as -o $@ rm $*.shbin %.o: %.vsh - $(DEVKITARM)/bin/picasso $^ -o $*.shbin - $(DEVKITARM)/bin/bin2s $*.shbin | $(PREFIX)as -o $@ + $(DEVKITPRO)/devkitARM/bin/picasso $^ -o $*.shbin + $(DEVKITPRO)/devkitARM/bin/bin2s $*.shbin | $(PREFIX)as -o $@ rm $*.shbin %.o: %.cpp @@ -387,7 +233,7 @@ endif -3dsxtool $< $@ $(_3DSXFLAGS) $(TARGET).elf: ctr/3dsx_custom_crt0.o - $(LD) $(LDFLAGS) $(OBJS) $(LIBDIRS) $(LIBS) -o $@ + $(LD) $(LDFLAGS) $(OBJ) $(LIBDIRS) $(LIBS) -o $@ $(NM) -CSn $@ > $(notdir $*.lst) $(TARGET).bnr: $(APP_BANNER) $(APP_AUDIO) @@ -404,7 +250,7 @@ $(TARGET).cia: $(TARGET).elf $(TARGET).bnr $(TARGET).icn $(APP_RSF) clean: - rm -f $(OBJS) + rm -f $(OBJ) rm -f $(TARGET).3dsx rm -f $(TARGET).elf rm -f $(TARGET).3ds @@ -417,3 +263,4 @@ clean: .PHONY: clean + diff --git a/audio/drivers/ctr_csnd_audio.c b/audio/drivers/ctr_csnd_audio.c index a1bc9e3bad..f6a2e248aa 100644 --- a/audio/drivers/ctr_csnd_audio.c +++ b/audio/drivers/ctr_csnd_audio.c @@ -15,6 +15,7 @@ #include <3ds.h> #include +#include #include "../audio_driver.h" #include "../../configuration.h" diff --git a/audio/drivers/ctr_dsp_audio.c b/audio/drivers/ctr_dsp_audio.c index 67df567226..9465e46984 100644 --- a/audio/drivers/ctr_dsp_audio.c +++ b/audio/drivers/ctr_dsp_audio.c @@ -15,6 +15,7 @@ #include <3ds.h> #include +#include #include "../audio_driver.h" #include "../../configuration.h" diff --git a/ctr/ctr_svchax.c b/ctr/ctr_svchax.c index cadea4ecc5..b02fccf1d4 100644 --- a/ctr/ctr_svchax.c +++ b/ctr/ctr_svchax.c @@ -19,7 +19,6 @@ u32 __ctr_svchax = 0; u32 __ctr_svchax_srv = 0; extern void* __service_ptr; -extern Handle gspEvents[GSPGPU_EVENT_MAX]; typedef u32(*backdoor_fn)(u32 arg0, u32 arg1); @@ -108,7 +107,7 @@ typedef struct typedef struct { u32 old_cpu_time_limit; - u8 isNew3DS; + bool isNew3DS; u32 kernel_fcram_mapping_offset; Handle arbiter; @@ -212,11 +211,9 @@ static void do_memchunkhax2(void) for (i = 0; i < MCH2_THREAD_COUNT_MAX; i++) mch2.threads[i].stack_top = (u32*)((u32)thread_stacks + (i + 1) * (MCH2_THREAD_STACKS_SIZE / MCH2_THREAD_COUNT_MAX)); - aptOpenSession(); APT_CheckNew3DS(&mch2.isNew3DS); APT_GetAppCpuTimeLimit(&mch2.old_cpu_time_limit); APT_SetAppCpuTimeLimit(5); - aptCloseSession(); for (i = 0; i < mch2.threads_limit; i++) { @@ -295,7 +292,13 @@ static void do_memchunkhax2(void) GSPGPU_InvalidateDataCache((void*)dst_memchunk, 16); GSPGPU_FlushDataCache((void*)linear_buffer, 16); memcpy(flush_buffer, flush_buffer + 0x4000, 0x4000); - svcClearEvent(gspEvents[GSPGPU_EVENT_PPF]); + +/* can't clear gspEvents[GSPGPU_EVENT_PPF]), directly so execute a dummy copy + * and use gspWaitForEvent to clear it. */ + +/* LightEvent_Clear(&gspEvents[GSPGPU_EVENT_PPF]); */ + GX_TextureCopy((void*)linear_buffer, 0, (void*)dst_memchunk, 0, 16, 8); + gspWaitForEvent(GSPGPU_EVENT_PPF, false); svcCreateThread(&mch2.alloc_thread, (ThreadFunc)alloc_thread_entry, (u32)&mch2, mch2.threads[MCH2_THREAD_COUNT_MAX - 1].stack_top, 0x3F, 1); @@ -305,7 +308,7 @@ static void do_memchunkhax2(void) GX_TextureCopy((void*)linear_buffer, 0, (void*)dst_memchunk, 0, 16, 8); memcpy(flush_buffer, flush_buffer + 0x4000, 0x4000); - svcWaitSynchronization(gspEvents[GSPGPU_EVENT_PPF], U64_MAX); + gspWaitForEvent(GSPGPU_EVENT_PPF, false); svcWaitSynchronization(mch2.alloc_thread, U64_MAX); svcCloseHandle(mch2.alloc_thread); @@ -373,9 +376,7 @@ static void do_memchunkhax2(void) svcControlMemory(&tmp, linear_buffer, 0, 0x1000, MEMOP_FREE, MEMPERM_DONTCARE); - aptOpenSession(); APT_SetAppCpuTimeLimit(mch2.old_cpu_time_limit); - aptCloseSession(); } @@ -388,9 +389,8 @@ static void gspwn(u32 dst, u32 src, u32 size, u8* flush_buffer) GSPGPU_FlushDataCache((void*)src, size); memcpy(flush_buffer, flush_buffer + 0x4000, 0x4000); - svcClearEvent(gspEvents[GSPGPU_EVENT_PPF]); GX_TextureCopy((void*)src, 0, (void*)dst, 0, size, 8); - svcWaitSynchronization(gspEvents[GSPGPU_EVENT_PPF], U64_MAX); + gspWaitForEvent(GSPGPU_EVENT_PPF, false); memcpy(flush_buffer, flush_buffer + 0x4000, 0x4000); } @@ -467,10 +467,8 @@ static void do_memchunkhax1(void) Result svchax_init(bool patch_srv) { - u8 isNew3DS; - aptOpenSession(); + bool isNew3DS; APT_CheckNew3DS(&isNew3DS); - aptCloseSession(); u32 kver = osGetKernelVersion(); diff --git a/ctr/gpu_old.c b/ctr/gpu_old.c new file mode 100644 index 0000000000..7822f6308f --- /dev/null +++ b/ctr/gpu_old.c @@ -0,0 +1,308 @@ +/* originally from from https://github.com/smealum/ctrulib */ + +/* + gpu-old.c _ Legacy GPU commands. +*/ + +#include +#include +#include <3ds/types.h> +#include <3ds/gpu/gpu.h> +#include <3ds/gpu/gx.h> +#include <3ds/gpu/shbin.h> + +#include "gpu_old.h" + +void GPU_Init(Handle *gsphandle) +{ + gpuCmdBuf=NULL; + gpuCmdBufSize=0; + gpuCmdBufOffset=0; +} + +void GPU_Reset(u32* gxbuf, u32* gpuBuf, u32 gpuBufSize) +{ + GPUCMD_SetBuffer(gpuBuf, gpuBufSize, 0); +} + +void GPU_SetFloatUniform(GPU_SHADER_TYPE type, u32 startreg, u32* data, u32 numreg) +{ + if(!data)return; + + int regOffset=(type==GPU_GEOMETRY_SHADER)?(-0x30):(0x0); + + GPUCMD_AddWrite(GPUREG_VSH_FLOATUNIFORM_CONFIG+regOffset, 0x80000000|startreg); + GPUCMD_AddWrites(GPUREG_VSH_FLOATUNIFORM_DATA+regOffset, data, numreg*4); +} + + +//takes PAs as arguments +void GPU_SetViewport(u32* depthBuffer, u32* colorBuffer, u32 x, u32 y, u32 w, u32 h) +{ + u32 param[0x4]; + float fw=(float)w; + float fh=(float)h; + + GPUCMD_AddWrite(GPUREG_FRAMEBUFFER_FLUSH, 0x00000001); + GPUCMD_AddWrite(GPUREG_FRAMEBUFFER_INVALIDATE, 0x00000001); + + u32 f116e=0x01000000|(((h-1)&0xFFF)<<12)|(w&0xFFF); + + param[0x0]=((u32)depthBuffer)>>3; + param[0x1]=((u32)colorBuffer)>>3; + param[0x2]=f116e; + GPUCMD_AddIncrementalWrites(GPUREG_DEPTHBUFFER_LOC, param, 0x00000003); + + GPUCMD_AddWrite(GPUREG_RENDERBUF_DIM, f116e); + GPUCMD_AddWrite(GPUREG_DEPTHBUFFER_FORMAT, 0x00000003); //depth buffer format + GPUCMD_AddWrite(GPUREG_COLORBUFFER_FORMAT, 0x00000002); //color buffer format + GPUCMD_AddWrite(GPUREG_FRAMEBUFFER_BLOCK32, 0x00000000); //? + + param[0x0]=f32tof24(fw/2); + param[0x1]=f32tof31(2.0f / fw) << 1; + param[0x2]=f32tof24(fh/2); + param[0x3]=f32tof31(2.0f / fh) << 1; + GPUCMD_AddIncrementalWrites(GPUREG_VIEWPORT_WIDTH, param, 0x00000004); + + GPUCMD_AddWrite(GPUREG_VIEWPORT_XY, (y<<16)|(x&0xFFFF)); + + param[0x0]=0x00000000; + param[0x1]=0x00000000; + param[0x2]=((h-1)<<16)|((w-1)&0xFFFF); + GPUCMD_AddIncrementalWrites(GPUREG_SCISSORTEST_MODE, param, 0x00000003); + + //enable depth buffer + param[0x0]=0x0000000F; + param[0x1]=0x0000000F; + param[0x2]=0x00000002; + param[0x3]=0x00000002; + GPUCMD_AddIncrementalWrites(GPUREG_COLORBUFFER_READ, param, 0x00000004); +} + +void GPU_SetScissorTest(GPU_SCISSORMODE mode, u32 left, u32 bottom, u32 right, u32 top) +{ + u32 param[3]; + + param[0x0] = mode; + param[0x1] = (bottom<<16)|(left&0xFFFF); + param[0x2] = ((top-1)<<16)|((right-1)&0xFFFF); + GPUCMD_AddIncrementalWrites(GPUREG_SCISSORTEST_MODE, param, 0x00000003); +} + +void GPU_DepthMap(float zScale, float zOffset) +{ + GPUCMD_AddWrite(GPUREG_DEPTHMAP_ENABLE, 0x00000001); + GPUCMD_AddWrite(GPUREG_DEPTHMAP_SCALE, f32tof24(zScale)); + GPUCMD_AddWrite(GPUREG_DEPTHMAP_OFFSET, f32tof24(zOffset)); +} + +void GPU_SetAlphaTest(bool enable, GPU_TESTFUNC function, u8 ref) +{ + GPUCMD_AddWrite(GPUREG_FRAGOP_ALPHA_TEST, (enable&1)|((function&7)<<4)|(ref<<8)); +} + +void GPU_SetStencilTest(bool enable, GPU_TESTFUNC function, u8 ref, u8 input_mask, u8 write_mask) +{ + GPUCMD_AddWrite(GPUREG_STENCIL_TEST, (enable&1)|((function&7)<<4)|(write_mask<<8)|(ref<<16)|(input_mask<<24)); +} + +void GPU_SetStencilOp(GPU_STENCILOP sfail, GPU_STENCILOP dfail, GPU_STENCILOP pass) +{ + GPUCMD_AddWrite(GPUREG_STENCIL_OP, sfail | (dfail << 4) | (pass << 8)); +} + +void GPU_SetDepthTestAndWriteMask(bool enable, GPU_TESTFUNC function, GPU_WRITEMASK writemask) +{ + GPUCMD_AddWrite(GPUREG_DEPTH_COLOR_MASK, (enable&1)|((function&7)<<4)|(writemask<<8)); +} + +void GPU_SetAlphaBlending(GPU_BLENDEQUATION colorEquation, GPU_BLENDEQUATION alphaEquation, + GPU_BLENDFACTOR colorSrc, GPU_BLENDFACTOR colorDst, + GPU_BLENDFACTOR alphaSrc, GPU_BLENDFACTOR alphaDst) +{ + GPUCMD_AddWrite(GPUREG_BLEND_FUNC, colorEquation | (alphaEquation<<8) | (colorSrc<<16) | (colorDst<<20) | (alphaSrc<<24) | (alphaDst<<28)); + GPUCMD_AddMaskedWrite(GPUREG_COLOR_OPERATION, 0x2, 0x00000100); +} + +void GPU_SetColorLogicOp(GPU_LOGICOP op) +{ + GPUCMD_AddWrite(GPUREG_LOGIC_OP, op); + GPUCMD_AddMaskedWrite(GPUREG_COLOR_OPERATION, 0x2, 0x00000000); +} + +void GPU_SetBlendingColor(u8 r, u8 g, u8 b, u8 a) +{ + GPUCMD_AddWrite(GPUREG_BLEND_COLOR, r | (g << 8) | (b << 16) | (a << 24)); +} + +void GPU_SetTextureEnable(GPU_TEXUNIT units) +{ + GPUCMD_AddMaskedWrite(GPUREG_SH_OUTATTR_CLOCK, 0x2, units<<8); // enables texcoord outputs + GPUCMD_AddWrite(GPUREG_TEXUNIT_CONFIG, 0x00011000|units); // enables texture units +} + +void GPU_SetTexture(GPU_TEXUNIT unit, u32* data, u16 width, u16 height, u32 param, GPU_TEXCOLOR colorType) +{ + switch (unit) + { + case GPU_TEXUNIT0: + GPUCMD_AddWrite(GPUREG_TEXUNIT0_TYPE, colorType); + GPUCMD_AddWrite(GPUREG_TEXUNIT0_ADDR1, ((u32)data)>>3); + GPUCMD_AddWrite(GPUREG_TEXUNIT0_DIM, (width<<16)|height); + GPUCMD_AddWrite(GPUREG_TEXUNIT0_PARAM, param); + break; + + case GPU_TEXUNIT1: + GPUCMD_AddWrite(GPUREG_TEXUNIT1_TYPE, colorType); + GPUCMD_AddWrite(GPUREG_TEXUNIT1_ADDR, ((u32)data)>>3); + GPUCMD_AddWrite(GPUREG_TEXUNIT1_DIM, (width<<16)|height); + GPUCMD_AddWrite(GPUREG_TEXUNIT1_PARAM, param); + break; + + case GPU_TEXUNIT2: + GPUCMD_AddWrite(GPUREG_TEXUNIT2_TYPE, colorType); + GPUCMD_AddWrite(GPUREG_TEXUNIT2_ADDR, ((u32)data)>>3); + GPUCMD_AddWrite(GPUREG_TEXUNIT2_DIM, (width<<16)|height); + GPUCMD_AddWrite(GPUREG_TEXUNIT2_PARAM, param); + break; + } +} + +void GPU_SetTextureBorderColor(GPU_TEXUNIT unit,u32 borderColor) +{ + switch (unit) + { + case GPU_TEXUNIT0: + GPUCMD_AddWrite(GPUREG_TEXUNIT0_BORDER_COLOR, borderColor); + break; + + case GPU_TEXUNIT1: + GPUCMD_AddWrite(GPUREG_TEXUNIT1_BORDER_COLOR, borderColor); + break; + + case GPU_TEXUNIT2: + GPUCMD_AddWrite(GPUREG_TEXUNIT2_BORDER_COLOR, borderColor); + break; + } +} + +const u8 GPU_FORMATSIZE[4]={1,1,2,4}; + +void GPU_SetAttributeBuffers(u8 totalAttributes, u32* baseAddress, u64 attributeFormats, u16 attributeMask, u64 attributePermutation, u8 numBuffers, u32 bufferOffsets[], u64 bufferPermutations[], u8 bufferNumAttributes[]) +{ + u32 param[0x28]; + + memset(param, 0x00, 0x28*4); + + param[0x0]=((u32)baseAddress)>>3; + param[0x1]=attributeFormats&0xFFFFFFFF; + param[0x2]=((totalAttributes-1)<<28)|((attributeMask&0xFFF)<<16)|((attributeFormats>>32)&0xFFFF); + + int i, j; + u8 sizeTable[0xC]; + for(i=0;i>2)+1); + attributeFormats>>=4; + } + + for(i=0;i>(4*j))&0xF]; + param[3*(i+1)+2]=(bufferNumAttributes[i]<<28)|((stride&0xFFF)<<16)|((bufferPermutations[i]>>32)&0xFFFF); + } + + GPUCMD_AddIncrementalWrites(GPUREG_ATTRIBBUFFERS_LOC, param, 0x00000027); + + GPUCMD_AddMaskedWrite(GPUREG_VSH_INPUTBUFFER_CONFIG, 0xB, 0xA0000000|(totalAttributes-1)); + GPUCMD_AddWrite(GPUREG_VSH_NUM_ATTR, (totalAttributes-1)); + + GPUCMD_AddIncrementalWrites(GPUREG_VSH_ATTRIBUTES_PERMUTATION_LOW, ((u32[]){attributePermutation&0xFFFFFFFF, (attributePermutation>>32)&0xFFFF}), 2); +} + +void GPU_SetAttributeBuffersAddress(u32* baseAddress) +{ + GPUCMD_AddWrite(GPUREG_ATTRIBBUFFERS_LOC, ((u32)baseAddress)>>3); +} + +void GPU_SetFaceCulling(GPU_CULLMODE mode) +{ + GPUCMD_AddWrite(GPUREG_FACECULLING_CONFIG, mode&0x3); +} + +void GPU_SetCombinerBufferWrite(u8 rgb_config, u8 alpha_config) +{ + GPUCMD_AddMaskedWrite(GPUREG_TEXENV_UPDATE_BUFFER, 0x2, (rgb_config << 8) | (alpha_config << 12)); +} + +const u8 GPU_TEVID[]={0xC0,0xC8,0xD0,0xD8,0xF0,0xF8}; + +void GPU_SetTexEnv(u8 id, u16 rgbSources, u16 alphaSources, u16 rgbOperands, u16 alphaOperands, GPU_COMBINEFUNC rgbCombine, GPU_COMBINEFUNC alphaCombine, u32 constantColor) +{ + if(id>6)return; + u32 param[0x5]; + memset(param, 0x00, 5*4); + + param[0x0]=(alphaSources<<16)|(rgbSources); + param[0x1]=(alphaOperands<<12)|(rgbOperands); + param[0x2]=(alphaCombine<<16)|(rgbCombine); + param[0x3]=constantColor; + param[0x4]=0x00000000; // ? + + GPUCMD_AddIncrementalWrites(GPUREG_0000|GPU_TEVID[id], param, 0x00000005); +} + +void GPU_DrawArray(GPU_Primitive_t primitive, u32 first, u32 count) +{ + //set primitive type + GPUCMD_AddMaskedWrite(GPUREG_PRIMITIVE_CONFIG, 0x2, primitive); + GPUCMD_AddMaskedWrite(GPUREG_RESTART_PRIMITIVE, 0x2, 0x00000001); + //index buffer address register should be cleared (except bit 31) before drawing + GPUCMD_AddWrite(GPUREG_INDEXBUFFER_CONFIG, 0x80000000); + //pass number of vertices + GPUCMD_AddWrite(GPUREG_NUMVERTICES, count); + //set first vertex + GPUCMD_AddWrite(GPUREG_VERTEX_OFFSET, first); + + //all the following except 0x000F022E might be useless + GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 0x1, 0x00000001); + GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 0x1, 0x00000000); + GPUCMD_AddWrite(GPUREG_DRAWARRAYS, 0x00000001); + GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 0x1, 0x00000001); + GPUCMD_AddWrite(GPUREG_VTX_FUNC, 0x00000001); + GPUCMD_AddWrite(GPUREG_FRAMEBUFFER_FLUSH, 0x00000001); +} + +void GPU_DrawElements(GPU_Primitive_t primitive, u32* indexArray, u32 n) +{ + //set primitive type + GPUCMD_AddMaskedWrite(GPUREG_PRIMITIVE_CONFIG, 0x2, primitive); + GPUCMD_AddMaskedWrite(GPUREG_RESTART_PRIMITIVE, 0x2, 0x00000001); + //index buffer (TODO : support multiple types) + GPUCMD_AddWrite(GPUREG_INDEXBUFFER_CONFIG, 0x80000000|((u32)indexArray)); + //pass number of vertices + GPUCMD_AddWrite(GPUREG_NUMVERTICES, n); + + GPUCMD_AddWrite(GPUREG_VERTEX_OFFSET, 0x00000000); + + GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG, 0x2, 0x00000100); + GPUCMD_AddMaskedWrite(GPUREG_GEOSTAGE_CONFIG2, 0x2, 0x00000100); + + GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 0x1, 0x00000000); + GPUCMD_AddWrite(GPUREG_DRAWELEMENTS, 0x00000001); + GPUCMD_AddMaskedWrite(GPUREG_START_DRAW_FUNC0, 0x1, 0x00000001); + GPUCMD_AddWrite(GPUREG_VTX_FUNC, 0x00000001); + + // CHECKME: does this one also require GPUREG_FRAMEBUFFER_FLUSH at the end? +} + +void GPU_FinishDrawing() +{ + GPUCMD_AddWrite(GPUREG_FRAMEBUFFER_FLUSH, 0x00000001); + GPUCMD_AddWrite(GPUREG_FRAMEBUFFER_INVALIDATE, 0x00000001); + GPUCMD_AddWrite(GPUREG_EARLYDEPTH_CLEAR, 0x00000001); +} diff --git a/ctr/gpu_old.h b/ctr/gpu_old.h new file mode 100644 index 0000000000..673a2a7e5c --- /dev/null +++ b/ctr/gpu_old.h @@ -0,0 +1,237 @@ +/* originally from from https://github.com/smealum/ctrulib */ + +/** + * @file gpu-old.h + * @brief Deprecated GPU functions which should not be used in new code. + * @description These functions have been superseeded by direct GPU register writes, or external GPU libraries. + * @deprecated + */ +#pragma once + +#include <3ds/gpu/gpu.h> + +/** + * @brief Initializes the GPU. + * @param gsphandle GSP handle to use. + * @deprecated + */ +void GPU_Init(Handle *gsphandle) DEPRECATED; + +/** + * @brief Resets the GPU. + * @param gxbuf GX command buffer to use. + * @param gpuBuf GPU command buffer to use. + * @param gpuBufSize GPU command buffer size. + * @deprecated + */ +void GPU_Reset(u32* gxbuf, u32* gpuBuf, u32 gpuBufSize) DEPRECATED; + +/** + * @brief Sets a shader float uniform. + * @param type Type of shader to set the uniform of. + * @param startreg Start of the uniform register to set. + * @param data Data to set. + * @param numreg Number of registers to set. + * @deprecated + */ +void GPU_SetFloatUniform(GPU_SHADER_TYPE type, u32 startreg, u32* data, u32 numreg) DEPRECATED; + +/** + * @brief Sets the viewport. + * @param depthBuffer Buffer to output depth data to. + * @param colorBuffer Buffer to output color data to. + * @param x X of the viewport. + * @param y Y of the viewport. + * @param w Width of the viewport. + * @param h Height of the viewport. + * @deprecated + */ +void GPU_SetViewport(u32* depthBuffer, u32* colorBuffer, u32 x, u32 y, u32 w, u32 h) DEPRECATED; + +/** + * @brief Sets the current scissor test mode. + * @param mode Scissor test mode to use. + * @param x X of the scissor region. + * @param y Y of the scissor region. + * @param w Width of the scissor region. + * @param h Height of the scissor region. + * @deprecated + */ +void GPU_SetScissorTest(GPU_SCISSORMODE mode, u32 left, u32 bottom, u32 right, u32 top) DEPRECATED; + +/** + * @brief Sets the depth map. + * @param zScale Z scale to use. + * @param zOffset Z offset to use. + * @deprecated + */ +void GPU_DepthMap(float zScale, float zOffset) DEPRECATED; + +/** + * @brief Sets the alpha test parameters. + * @param enable Whether to enable alpha testing. + * @param function Test function to use. + * @param ref Reference value to use. + * @deprecated + */ +void GPU_SetAlphaTest(bool enable, GPU_TESTFUNC function, u8 ref) DEPRECATED; + +/** + * @brief Sets the depth test parameters and pixel write mask. + * @note GPU_WRITEMASK values can be ORed together. + * @param enable Whether to enable depth testing. + * @param function Test function to use. + * @param writemask Pixel write mask to use. + * @deprecated + */ +void GPU_SetDepthTestAndWriteMask(bool enable, GPU_TESTFUNC function, GPU_WRITEMASK writemask) DEPRECATED; + +/** + * @brief Sets the stencil test parameters. + * @param enable Whether to enable stencil testing. + * @param function Test function to use. + * @param ref Reference value to use. + * @param input_mask Input mask to use. + * @param write_mask Write mask to use. + * @deprecated + */ +void GPU_SetStencilTest(bool enable, GPU_TESTFUNC function, u8 ref, u8 input_mask, u8 write_mask) DEPRECATED; + +/** + * @brief Sets the stencil test operators. + * @param sfail Operator to use on source test failure. + * @param dfail Operator to use on destination test failure. + * @param pass Operator to use on test passing. + * @deprecated + */ +void GPU_SetStencilOp(GPU_STENCILOP sfail, GPU_STENCILOP dfail, GPU_STENCILOP pass) DEPRECATED; + +/** + * @brief Sets the face culling mode. + * @param mode Face culling mode to use. + * @deprecated + */ +void GPU_SetFaceCulling(GPU_CULLMODE mode) DEPRECATED; + +/** + * @brief Sets the combiner buffer write parameters. + * @note Use GPU_TEV_BUFFER_WRITE_CONFIG to build the parameters. + * @note Only the first four TEV stages can write to the combiner buffer. + * @param rgb_config RGB configuration to use. + * @param alpha_config Alpha configuration to use. + * @deprecated + */ +void GPU_SetCombinerBufferWrite(u8 rgb_config, u8 alpha_config) DEPRECATED; + +/** + * @brief Sets the alpha blending parameters. + * @note Cannot be used with GPU_SetColorLogicOp. + * @param colorEquation Blend equation to use for color components. + * @param alphaEquation Blend equation to use for the alpha component. + * @param colorSrc Source factor of color components. + * @param colorDst Destination factor of color components. + * @param alphaSrc Source factor of the alpha component. + * @param alphaDst Destination factor of the alpha component. + * @deprecated + */ +void GPU_SetAlphaBlending(GPU_BLENDEQUATION colorEquation, GPU_BLENDEQUATION alphaEquation, + GPU_BLENDFACTOR colorSrc, GPU_BLENDFACTOR colorDst, + GPU_BLENDFACTOR alphaSrc, GPU_BLENDFACTOR alphaDst) DEPRECATED; + +/** + * @brief Sets the color logic operator. + * @note Cannot be used with GPU_SetAlphaBlending. + * @param op Operator to set. + * @deprecated + */ +void GPU_SetColorLogicOp(GPU_LOGICOP op) DEPRECATED; + +/** + * @brief Sets the blending color. + * @param r Red component. + * @param g Green component. + * @param b Blue component. + * @param a Alpha component. + * @deprecated + */ +void GPU_SetBlendingColor(u8 r, u8 g, u8 b, u8 a) DEPRECATED; + +/** + * @brief Sets the VBO attribute buffers. + * @param totalAttributes Total number of attributes. + * @param baseAddress Base address of the VBO. + * @param attributeFormats Attribute format data. + * @param attributeMask Attribute mask. + * @param attributePermutation Attribute permutations. + * @param numBuffers Number of buffers. + * @param bufferOffsets Offsets of the buffers. + * @param bufferPermutations Buffer permutations. + * @param bufferNumAttributes Numbers of attributes of the buffers. + * @deprecated + */ +void GPU_SetAttributeBuffers(u8 totalAttributes, u32* baseAddress, u64 attributeFormats, u16 attributeMask, u64 attributePermutation, u8 numBuffers, u32 bufferOffsets[], u64 bufferPermutations[], u8 bufferNumAttributes[]) DEPRECATED; + +/** + * @brief Sets the enabled texture units. + * @param units Units to enable. OR texture unit values together to create this value. + * @deprecated + */ +void GPU_SetTextureEnable(GPU_TEXUNIT units) DEPRECATED; + +/** + * @brief Sets the texture data of a texture unit. + * @param unit Texture unit to use. + * @param data Data to load. Must be in linear memory or VRAM. + * @param width Width of the texture. + * @param height Height of the texture. + * @param Parameters of the texture, such as filters and wrap modes. + * @param colorType Color type of the texture. + * @deprecated + */ +void GPU_SetTexture(GPU_TEXUNIT unit, u32* data, u16 width, u16 height, u32 param, GPU_TEXCOLOR colorType) DEPRECATED; + +/** + * @brief Sets the border color of a texture unit. + * @param unit Texture unit to use. + * @param borderColor The color used for the border when using the @ref GPU_CLAMP_TO_BORDER wrap mode. + * @deprecated + */ +void GPU_SetTextureBorderColor(GPU_TEXUNIT unit,u32 borderColor) DEPRECATED; + +/** + * @brief Sets the parameters of a texture combiner. + * @param id ID of the combiner. + * @param rgbSources RGB source configuration. + * @param alphaSources Alpha source configuration. + * @param rgbOperands RGB operand configuration. + * @param alphaOperands Alpha operand configuration. + * @param rgbCombine RGB combiner function. + * @param alphaCombine Alpha combiner function. + * @param constantColor Constant color to provide. + * @deprecated + */ +void GPU_SetTexEnv(u8 id, u16 rgbSources, u16 alphaSources, u16 rgbOperands, u16 alphaOperands, GPU_COMBINEFUNC rgbCombine, GPU_COMBINEFUNC alphaCombine, u32 constantColor) DEPRECATED; + +/** + * @brief Draws an array of vertex data. + * @param primitive Primitive to draw. + * @param first First vertex to draw. + * @param count Number of vertices to draw. + * @deprecated + */ +void GPU_DrawArray(GPU_Primitive_t primitive, u32 first, u32 count) DEPRECATED; + +/** + * @brief Draws vertex elements. + * @param primitive Primitive to draw. + * @param indexArray Array of vertex indices to use. + * @param n Number of vertices to draw. + * @deprecated + */ +void GPU_DrawElements(GPU_Primitive_t primitive, u32* indexArray, u32 n) DEPRECATED; + +/** + * @brief Finishes drawing. + * @deprecated + */ +void GPU_FinishDrawing() DEPRECATED; diff --git a/frontend/drivers/platform_ctr.c b/frontend/drivers/platform_ctr.c index a172d449bf..88128fd7bf 100644 --- a/frontend/drivers/platform_ctr.c +++ b/frontend/drivers/platform_ctr.c @@ -36,6 +36,7 @@ #include "../../verbosity.h" #include "../../defaults.h" #include "retroarch.h" +#include "file_path_special.h" #include "audio/audio_driver.h" #include "ctr/ctr_debug.h" diff --git a/gfx/drivers/ctr_gfx.c b/gfx/drivers/ctr_gfx.c index d56d6dbeff..9714e4330e 100644 --- a/gfx/drivers/ctr_gfx.c +++ b/gfx/drivers/ctr_gfx.c @@ -25,6 +25,7 @@ #include "../../config.h" #endif +#include "../../ctr/gpu_old.h" #include "ctr_gu.h" #include "../../configuration.h" @@ -463,7 +464,10 @@ static void* ctr_init(const video_info_t* video, sizeof(ctr_vertex_t)); GPUCMD_Finalize(); ctrGuFlushAndRun(true); - gspWaitForEvent(GSPGPU_EVENT_P3D, false); + + ctrGuDisplayTransfer(true, CTR_TOP_FRAMEBUFFER, 240, 400, CTRGU_RGBA8, + gfxTopLeftFramebuffers[ctr->current_buffer_top], + 240,CTRGU_RGB8, CTRGU_MULTISAMPLE_NONE); if (input && input_data) { @@ -550,17 +554,13 @@ static bool ctr_frame(void* data, const void* frame, ctr->lcd_buttom_on = !ctr->lcd_buttom_on; } - svcWaitSynchronization(gspEvents[GSPGPU_EVENT_P3D], 20000000); - svcClearEvent(gspEvents[GSPGPU_EVENT_P3D]); - svcWaitSynchronization(gspEvents[GSPGPU_EVENT_PPF], 20000000); - svcClearEvent(gspEvents[GSPGPU_EVENT_PPF]); + gspWaitForEvent(GSPGPU_EVENT_P3D, false); + gspWaitForEvent(GSPGPU_EVENT_PPF, false); frames++; if (ctr->vsync) - svcWaitSynchronization(gspEvents[GSPGPU_EVENT_VBlank0], U64_MAX); - - svcClearEvent(gspEvents[GSPGPU_EVENT_VBlank0]); + gspWaitForEvent(GSPGPU_EVENT_VBlank0, false); currentTick = svcGetSystemTick(); diff = currentTick - lastTick; @@ -806,7 +806,6 @@ static bool ctr_frame(void* data, const void* frame, // Swap buffers : - ctr->current_buffer_top ^= 1; extern GSPGPU_FramebufferInfo topFramebufferInfo; extern u8* gfxSharedMemory; extern u8 gfxThreadID; @@ -835,6 +834,8 @@ static bool ctr_frame(void* data, const void* frame, framebufferInfo[framebufferInfoHeader[0x0]] = topFramebufferInfo; framebufferInfoHeader[0x1]=1; + ctr->current_buffer_top ^= 1; + performance_counter_stop(&ctrframe_f); return true; diff --git a/gfx/drivers/ctr_gu.h b/gfx/drivers/ctr_gu.h index eee562c4a9..fb70f52137 100644 --- a/gfx/drivers/ctr_gu.h +++ b/gfx/drivers/ctr_gu.h @@ -61,7 +61,6 @@ void wait_for_input(void); #endif -extern Handle gspEvents[GSPGPU_EVENT_MAX]; extern u32* gpuCmdBuf; extern u32 gpuCmdBufOffset; extern u32 __linear_heap_size; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 8618e202fe..d5ce9a16d2 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -26,6 +26,7 @@ #include #include #include +#include #ifdef HAVE_CONFIG_H #include "../config.h" diff --git a/libretro-common/features/features_cpu.c b/libretro-common/features/features_cpu.c index a866a39cb4..c5e4b3007e 100644 --- a/libretro-common/features/features_cpu.c +++ b/libretro-common/features/features_cpu.c @@ -73,6 +73,11 @@ #include #endif +#if defined(_3DS) +#include <3ds/svc.h> +#include <3ds/os.h> +#endif + /* iOS/OSX specific. Lacks clock_gettime(), so implement it. */ #ifdef __MACH__ #include