├── .clang-format ├── .github └── workflows │ └── build.yml ├── .gitignore ├── .gitmodules ├── Android.mk ├── LICENSE.md ├── Makefile ├── Makefile.3ds ├── README.md ├── RSDKv3 ios.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── RSDKv3.xcscheme ├── RSDKv3.sln ├── RSDKv3.vita ├── CMakeLists.txt ├── build-internal.sh ├── build.sh └── sce_sys │ └── livearea │ └── contents │ └── template.xml ├── RSDKv3.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── RSDKv3.xcscheme ├── RSDKv3 ├── 3ds │ ├── audio_3ds.cpp │ ├── audio_3ds.hpp │ ├── c2d_internal.h │ ├── debug_3ds.cpp │ ├── debug_3ds.hpp │ ├── render_3ds.cpp │ ├── render_3ds.hpp │ ├── video_3ds.cpp │ └── video_3ds.hpp ├── Animation.cpp ├── Animation.hpp ├── Audio.cpp ├── Audio.hpp ├── Collision.cpp ├── Collision.hpp ├── Debug.cpp ├── Debug.hpp ├── Drawing.cpp ├── Drawing.hpp ├── Ini.cpp ├── Ini.hpp ├── Input.cpp ├── Input.hpp ├── Math.cpp ├── Math.hpp ├── Object.cpp ├── Object.hpp ├── Palette.cpp ├── Palette.hpp ├── Player.cpp ├── Player.hpp ├── RSDKv3 Decomp Icon.ico ├── RSDKv3.rc ├── RSDKv3.vcxproj ├── RSDKv3.vcxproj.filters ├── RSDKv3SDL1.vcxproj ├── RSDKv3SDL1.vcxproj.filters ├── Reader.cpp ├── Reader.hpp ├── RetroEngine.cpp ├── RetroEngine.hpp ├── Scene.cpp ├── Scene.hpp ├── Scene3D.cpp ├── Scene3D.hpp ├── Script.cpp ├── Script.hpp ├── Sprite.cpp ├── Sprite.hpp ├── String.cpp ├── String.hpp ├── Text.cpp ├── Text.hpp ├── Userdata.cpp ├── Userdata.hpp ├── Video.cpp ├── Video.hpp ├── fcaseopen.c ├── fcaseopen.h ├── main.cpp └── resource.h ├── RSDKv3SDL1.sln ├── RSDKv3UWP.sln ├── RSDKv3UWP ├── Package.appxmanifest ├── PropertySheet.props ├── RSDKv3UWP.vcxproj ├── RSDKv3UWP.vcxproj.filters ├── WinRTIncludes.hpp ├── main.cpp └── packages.config ├── android ├── app │ ├── build.gradle │ ├── jni │ │ ├── Android.mk │ │ ├── Application.mk │ │ ├── CMakeLists.txt │ │ ├── SDL │ │ └── src │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ ├── com │ │ │ └── decomp │ │ │ │ └── rsdkv3 │ │ │ │ └── RSDKv3.java │ │ └── org │ │ │ └── libsdl │ │ │ └── app │ │ │ ├── HIDDevice.java │ │ │ ├── HIDDeviceBLESteamController.java │ │ │ ├── HIDDeviceManager.java │ │ │ ├── HIDDeviceUSB.java │ │ │ ├── SDL.java │ │ │ ├── SDLActivity.java │ │ │ ├── SDLAudioManager.java │ │ │ └── SDLControllerManager.java │ │ └── res │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── values-v27 │ │ └── styles.xml │ │ └── values │ │ ├── colors.xml │ │ ├── ic_launcher_background.xml │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── dependencies ├── all │ ├── dependencies.txt │ └── theoraplay │ │ ├── .hg_archival.txt │ │ ├── .hgignore │ │ ├── 3ds_utils.h │ │ ├── LICENSE.txt │ │ ├── pthread3ds.h │ │ ├── test │ │ ├── maketest.sh │ │ ├── sdltheoraplay.c │ │ ├── simplesdl.c │ │ └── testtheoraplay.c │ │ ├── theoraplay.c │ │ ├── theoraplay.h │ │ └── theoraplay_cvtrgb.h ├── android │ └── dependencies.txt ├── ios │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── Default.png │ ├── Info.plist │ └── dependencies.txt ├── mac │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── RSDKv3 Decomp Icon-1024.png │ │ │ ├── RSDKv3 Decomp Icon-128.png │ │ │ ├── RSDKv3 Decomp Icon-16.png │ │ │ ├── RSDKv3 Decomp Icon-256.png │ │ │ ├── RSDKv3 Decomp Icon-257.png │ │ │ ├── RSDKv3 Decomp Icon-32.png │ │ │ ├── RSDKv3 Decomp Icon-33.png │ │ │ ├── RSDKv3 Decomp Icon-512.png │ │ │ ├── RSDKv3 Decomp Icon-513.png │ │ │ └── RSDKv3 Decomp Icon-64.png │ │ └── Contents.json │ ├── Info.plist │ ├── RSDKv3.entitlements │ ├── cocoaHelpers.hpp │ ├── cocoaHelpers.mm │ ├── dependencies.txt │ └── icons │ │ ├── RSDKv3 Decomp Icon-1024.png │ │ ├── RSDKv3 Decomp Icon-128.png │ │ ├── RSDKv3 Decomp Icon-16.png │ │ ├── RSDKv3 Decomp Icon-256.png │ │ ├── RSDKv3 Decomp Icon-32.png │ │ ├── RSDKv3 Decomp Icon-512.png │ │ └── RSDKv3 Decomp Icon-64.png ├── win-uwp │ └── dependencies.txt └── windows │ ├── ValveFileVDF │ └── vdf_parser.hpp │ └── dependencies.txt ├── header.png ├── props ├── winactions.props ├── winactions_HW.props ├── winactions_x64.props └── winactions_x64_HW.props └── resources ├── 24x24.png ├── 48x48.png ├── SonicCD.rsf ├── banner.png └── jingle.wav /.clang-format: -------------------------------------------------------------------------------- 1 | IndentWidth: 4 2 | Language: Cpp 3 | AlignAfterOpenBracket: Align 4 | SortIncludes: false 5 | ColumnLimit: 150 6 | PointerAlignment: Right 7 | AccessModifierOffset: -4 8 | AllowShortFunctionsOnASingleLine: All 9 | AllowShortCaseLabelsOnASingleLine: true 10 | #AllowShortLambdasOnASingleLine: All 11 | AllowShortLoopsOnASingleLine: true 12 | BinPackArguments: true 13 | BinPackParameters: true 14 | SpaceAfterCStyleCast: false 15 | BreakBeforeBraces: Attach 16 | BreakBeforeTernaryOperators: true 17 | BreakBeforeBinaryOperators: NonAssignment 18 | Cpp11BracedListStyle: false 19 | IndentCaseLabels: true 20 | AlignTrailingComments: true 21 | AlignOperands: true 22 | AlignConsecutiveAssignments: true 23 | AlignConsecutiveDeclarations: false 24 | AlignConsecutiveMacros: true 25 | UseTab: Never 26 | BreakBeforeBraces: Custom 27 | BraceWrapping: 28 | AfterClass: true 29 | AfterControlStatement: false 30 | AfterEnum: false 31 | AfterFunction: true 32 | AfterNamespace: true 33 | AfterObjCDeclaration: false 34 | AfterStruct: false 35 | AfterUnion: false 36 | BeforeCatch: false 37 | BeforeElse: true 38 | IndentBraces: false 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # VitaSDK artifacts 5 | dependencies/vita 6 | *.self* 7 | *.vpk* 8 | *.velf 9 | 10 | # CMake artifacts 11 | CMakeFiles/ 12 | cmake_install.cmake 13 | CMakeCache.txt 14 | SonicCD.Vita/Makefile 15 | 16 | # User-specific files 17 | *.suo 18 | *.user 19 | *.userosscache 20 | *.sln.docstates 21 | *.swp 22 | 23 | # User-specific files (MonoDevelop/Xamarin Studio) 24 | *.userprefs 25 | 26 | # Build results 27 | [Dd]ebug/ 28 | [Dd]ebugPublic/ 29 | [Rr]elease/ 30 | [Rr]eleases/ 31 | [Bb]uild/ 32 | x64/ 33 | x86/ 34 | bld/ 35 | bin/ 36 | [Bb]in/ 37 | [Oo]bj/ 38 | 39 | #safety 40 | *.rsdk 41 | *.ogv 42 | 43 | #OSX files 44 | *.DS_Store 45 | .DS_Store 46 | *.xactivitylog 47 | *.xcuserstate 48 | *.dia 49 | *.xbuild 50 | *.db 51 | *.plist 52 | *.idx 53 | *.pcm 54 | *.timestamp 55 | *.xcbkptlist 56 | *.xcsettings 57 | 58 | #dependencies 59 | [Dd]ependencies/win-uwp/** 60 | [Dd]ependencies/windows/* 61 | [Dd]ependencies/android/* 62 | [Dd]ependencies/mac/libogg/ 63 | [Dd]ependencies/mac/libtheora/ 64 | [Dd]ependencies/mac/libvorbis/ 65 | [Dd]ependencies/mac/SDL2.framework/ 66 | ![Dd]ependencies/mac/[Ii]nfo.plist 67 | [Dd]ependencies/ios/Ogg.Framework/ 68 | [Dd]ependencies/ios/Theora.framework/ 69 | [Dd]ependencies/ios/Vorbis.framework/ 70 | [Dd]ependencies/ios/SDL2.framework/ 71 | [Dd]ependencies/ios/libSDLMain.a 72 | ![Dd]ependencies/ios/[Ii]nfo.plist 73 | [Dd]ependencies/all/* 74 | ![Dd]ependencies/all/dependencies.txt 75 | ![Dd]ependencies/windows/dependencies.txt 76 | ![Dd]ependencies/ios/dependencies.txt 77 | ![Dd]ependencies/mac/dependencies.txt 78 | ![Dd]ependencies/windows-uwp/dependencies.txt 79 | ![Dd]ependencies/android/dependencies.txt 80 | ![Dd]ependencies/android/libogg/include/ogg/config_types.h 81 | 82 | SonicCDDecompUWP/Generated Files 83 | SonicCDDecompUWP/BundleArtifacts 84 | SonicCDDecompUWP/Assets/*.png 85 | 86 | # Visual Studio 2015 cache/options directory 87 | .vs/ 88 | 89 | # MSTest test Results 90 | [Tt]est[Rr]esult*/ 91 | [Bb]uild[Ll]og.* 92 | 93 | # NUNIT 94 | *.VisualState.xml 95 | TestResult.xml 96 | 97 | # Build Results of an ATL Project 98 | [Dd]ebugPS/ 99 | [Rr]eleasePS/ 100 | dlldata.c 101 | 102 | # DNX 103 | project.lock.json 104 | artifacts/ 105 | 106 | *_i.c 107 | *_p.c 108 | *_i.h 109 | *.ilk 110 | *.meta 111 | *.obj 112 | *.pch 113 | *.pdb 114 | *.pgc 115 | *.pgd 116 | *.rsp 117 | *.sbr 118 | *.tlb 119 | *.tli 120 | *.tlh 121 | *.tmp 122 | *.tmp_proj 123 | *.log 124 | *.vspscc 125 | *.vssscc 126 | .builds 127 | *.pidb 128 | *.svclog 129 | *.scc 130 | 131 | # Chutzpah Test files 132 | _Chutzpah* 133 | 134 | # Visual C++ cache files 135 | ipch/ 136 | *.aps 137 | *.ncb 138 | *.opensdf 139 | *.sdf 140 | *.cachefile 141 | 142 | # Visual Studio profiler 143 | *.psess 144 | *.vsp 145 | *.vspx 146 | 147 | # TFS 2012 Local Workspace 148 | $tf/ 149 | 150 | # Guidance Automation Toolkit 151 | *.gpState 152 | 153 | # ReSharper is a .NET coding add-in 154 | _ReSharper*/ 155 | *.[Rr]e[Ss]harper 156 | *.DotSettings.user 157 | 158 | # JustCode is a .NET coding add-in 159 | .JustCode 160 | 161 | # TeamCity is a build add-in 162 | _TeamCity* 163 | 164 | # DotCover is a Code Coverage Tool 165 | *.dotCover 166 | 167 | # NCrunch 168 | _NCrunch_* 169 | .*crunch*.local.xml 170 | 171 | # MightyMoose 172 | *.mm.* 173 | AutoTest.Net/ 174 | 175 | # Web workbench (sass) 176 | .sass-cache/ 177 | 178 | # Installshield output folder 179 | [Ee]xpress/ 180 | 181 | # DocProject is a documentation generator add-in 182 | DocProject/buildhelp/ 183 | DocProject/Help/*.HxT 184 | DocProject/Help/*.HxC 185 | DocProject/Help/*.hhc 186 | DocProject/Help/*.hhk 187 | DocProject/Help/*.hhp 188 | DocProject/Help/Html2 189 | DocProject/Help/html 190 | 191 | # Click-Once directory 192 | publish/ 193 | 194 | # Publish Web Output 195 | *.[Pp]ublish.xml 196 | *.azurePubxml 197 | ## TODO: Comment the next line if you want to checkin your 198 | ## web deploy settings but do note that will include unencrypted 199 | ## passwords 200 | #*.pubxml 201 | 202 | *.publishproj 203 | 204 | # NuGet Packages 205 | *.nupkg 206 | # The packages folder can be ignored because of Package Restore 207 | **/packages/* 208 | # except build/, which is used as an MSBuild target. 209 | !**/packages/build/ 210 | # Uncomment if necessary however generally it will be regenerated when needed 211 | #!**/packages/repositories.config 212 | 213 | # Windows Azure Build Output 214 | csx/ 215 | *.build.csdef 216 | 217 | # Windows Store app package directory 218 | AppPackages/ 219 | 220 | # Visual Studio cache files 221 | # files ending in .cache can be ignored 222 | *.[Cc]ache 223 | # but keep track of directories ending in .cache 224 | !*.[Cc]ache/ 225 | 226 | # Others 227 | ClientBin/ 228 | [Ss]tyle[Cc]op.* 229 | ~$* 230 | *~ 231 | *.dbmdl 232 | *.dbproj.schemaview 233 | *.pfx 234 | *.publishsettings 235 | node_modules/ 236 | orleans.codegen.cs 237 | 238 | # RIA/Silverlight projects 239 | Generated_Code/ 240 | 241 | # Backup & report files from converting an old project file 242 | # to a newer Visual Studio version. Backup files are not needed, 243 | # because we have git ;-) 244 | _UpgradeReport_Files/ 245 | Backup*/ 246 | UpgradeLog*.XML 247 | UpgradeLog*.htm 248 | 249 | # SQL Server files 250 | *.mdf 251 | *.ldf 252 | 253 | # Business Intelligence projects 254 | *.rdl.data 255 | *.bim.layout 256 | *.bim_*.settings 257 | 258 | # Microsoft Fakes 259 | FakesAssemblies/ 260 | 261 | # Node.js Tools for Visual Studio 262 | .ntvs_analysis.dat 263 | 264 | # Visual Studio 6 build log 265 | *.plg 266 | 267 | # Visual Studio 6 workspace options file 268 | *.opt 269 | 270 | # LightSwitch generated files 271 | GeneratedArtifacts/ 272 | _Pvt_Extensions/ 273 | ModelManifest.xml 274 | 275 | Ignored/ 276 | 277 | # Android specific 278 | .gradle/ 279 | .idea/ 280 | android/key/ 281 | android/local.properties 282 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "SonicCDDecomp/ghc"] 2 | path = SonicCDDecomp/ghc 3 | url = https://github.com/gulrak/filesystem 4 | [submodule "RSDKv3/3ds/3ds-theoraplayer"] 5 | path = RSDKv3/3ds/3ds-theoraplayer 6 | url = https://github.com/SaturnSH2x2/3ds-theoraplayer 7 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | OGG_DIR := dependencies/android/libogg 4 | VORBIS_DIR := dependencies/android/libvorbis 5 | THEORA_DIR := dependencies/android/libtheora 6 | 7 | OGG_INCLUDES := $(LOCAL_PATH)/$(OGG_DIR)/include 8 | VORBIS_INCLUDES := $(LOCAL_PATH)/$(VORBIS_DIR)/include \ 9 | $(LOCAL_PATH)/$(VORBIS_DIR)/lib 10 | THEORA_INCLUDES := $(LOCAL_PATH)/$(THEORA_DIR)/include \ 11 | $(LOCAL_PATH)/$(THEORA_DIR)/lib 12 | 13 | ###################################################################### 14 | # OGG 15 | include $(CLEAR_VARS) 16 | 17 | LOCAL_ARM_MODE := arm 18 | LOCAL_MODULE := libogg 19 | LOCAL_CFLAGS := -ffast-math -fsigned-char -O2 -fPIC -DPIC \ 20 | -DBYTE_ORDER=LITTLE_ENDIAN -D_ARM_ASSEM_ 21 | 22 | LOCAL_C_INCLUDES := $(OGG_INCLUDES) 23 | 24 | WILDCARD_SETUP := \ 25 | $(wildcard $(LOCAL_PATH)/$(OGG_DIR)/src/*.c) 26 | 27 | 28 | LOCAL_SRC_FILES := \ 29 | $(subst jni/src/, , $(WILDCARD_SETUP)) 30 | 31 | include $(BUILD_STATIC_LIBRARY) 32 | 33 | ###################################################################### 34 | # VORBIS 35 | include $(CLEAR_VARS) 36 | 37 | LOCAL_ARM_MODE := arm 38 | LOCAL_MODULE := libvorbis 39 | LOCAL_CFLAGS := -ffast-math -fsigned-char -O2 -fPIC -DPIC \ 40 | -DBYTE_ORDER=LITTLE_ENDIAN -D_ARM_ASSEM_ 41 | 42 | LOCAL_C_INCLUDES := $(OGG_INCLUDES) $(VORBIS_INCLUDES) 43 | 44 | WILDCARD_SETUP := \ 45 | $(wildcard $(LOCAL_PATH)/$(VORBIS_DIR)/lib/*.c) 46 | FILTERED := $(filter-out $(LOCAL_PATH)/$(VORBIS_DIR)/lib/psytune.c, $(WILDCARD_SETUP)) 47 | 48 | LOCAL_SRC_FILES := \ 49 | $(subst jni/src/, , $(FILTERED)) 50 | 51 | include $(BUILD_STATIC_LIBRARY) 52 | 53 | ###################################################################### 54 | # THEORA 55 | include $(CLEAR_VARS) 56 | 57 | LOCAL_ARM_MODE := arm 58 | LOCAL_MODULE := libtheora 59 | LOCAL_CFLAGS := -ffast-math -fsigned-char -O2 -fPIC -DPIC \ 60 | -DBYTE_ORDER=LITTLE_ENDIAN -D_ARM_ASSEM_ 61 | 62 | LOCAL_C_INCLUDES := $(OGG_INCLUDES) $(THEORA_INCLUDES) 63 | 64 | WILDCARD_SETUP := \ 65 | $(wildcard $(LOCAL_PATH)/$(THEORA_DIR)/lib/*.c) 66 | 67 | LOCAL_SRC_FILES := \ 68 | $(subst jni/src/, , $(WILDCARD_SETUP)) 69 | 70 | include $(BUILD_STATIC_LIBRARY) 71 | 72 | ###################################################################### 73 | 74 | include $(CLEAR_VARS) 75 | 76 | LOCAL_MODULE := main 77 | 78 | SDL_PATH := ../SDL 79 | 80 | LOCAL_CFLAGS := -fexceptions 81 | 82 | LOCAL_C_INCLUDES := \ 83 | $(LOCAL_PATH)/$(SDL_PATH)/include \ 84 | $(LOCAL_PATH)/dependencies/all \ 85 | $(LOCAL_PATH)/$(VORBIS_DIR)/include \ 86 | $(LOCAL_PATH)/$(OGG_DIR)/include \ 87 | $(LOCAL_PATH)/$(THEORA_DIR)/include \ 88 | $(LOCAL_PATH)/dependencies/all/theoraplay \ 89 | 90 | 91 | WILDCARD_SETUP := \ 92 | $(wildcard $(LOCAL_PATH)/dependencies/all/theoraplay/*.c) \ 93 | $(wildcard $(LOCAL_PATH)/RSDKv3/*.cpp) 94 | 95 | LOCAL_SRC_FILES := $(subst jni/src/, , $(WILDCARD_SETUP)) 96 | 97 | LOCAL_SHARED_LIBRARIES := SDL2 libogg libvorbis libtheora 98 | 99 | LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog 100 | 101 | include $(BUILD_SHARED_LIBRARY) 102 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # RSDKv3/v4 DECOMPILATION SOURCE CODE LICENSE v1 2 | 3 | The code in this repository is a decompilation of RSDK (Retro-Engine) version 3 or 4. 4 | There is original code in this repo, but most of the code is to be functionally the same as the version of RSDK this repo specifies. 5 | 6 | This code is provided as-is, that is to say, without liability or warranty. 7 | Original authors of RSDK and authors of the decompilation are not held responsible for any damages or other claims said. 8 | 9 | You may copy, modify, contribute, and distribute, for public or private use, **as long as the following are followed:** 10 | - You may not use the decompilation for commercial (any sort of profit) use. 11 | - You must clearly specify that the decompilation and original code are not yours: the developers of both must be credited. 12 | - You may not distribute assets used to run the game not directly provided by the repository (other than unique, modded assets). 13 | - This license must be in all modified copies of source code, and all forks must follow this license. 14 | 15 | Original RSDK author: Christian "Taxman" Whitehead 16 | 17 | Decompilation authors: Rubberduckycooly and RMGRich 18 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(STATIC),1) 2 | PKG_CONFIG_STATIC_FLAG = --static 3 | CXXFLAGS_ALL += -static 4 | endif 5 | 6 | CXXFLAGS_ALL += -MMD -MP -MF objects/$*.d $(shell pkg-config --cflags $(PKG_CONFIG_STATIC_FLAG) sdl2 vorbisfile vorbis theoradec) $(CXXFLAGS) \ 7 | -Idependencies/all/filesystem/include \ 8 | -Idependencies/all/theoraplay \ 9 | -Idependencies/all/upng 10 | LDFLAGS_ALL += $(LDFLAGS) 11 | LIBS_ALL += $(shell pkg-config --libs $(PKG_CONFIG_STATIC_FLAG) sdl2 vorbisfile vorbis theoradec) -pthread $(LIBS) 12 | 13 | 14 | SOURCES = \ 15 | dependencies/all/theoraplay/theoraplay.c \ 16 | RSDKv3/Animation.cpp \ 17 | RSDKv3/Audio.cpp \ 18 | RSDKv3/Collision.cpp \ 19 | RSDKv3/Debug.cpp \ 20 | RSDKv3/Drawing.cpp \ 21 | RSDKv3/Ini.cpp \ 22 | RSDKv3/Input.cpp \ 23 | RSDKv3/main.cpp \ 24 | RSDKv3/Math.cpp \ 25 | RSDKv3/Object.cpp \ 26 | RSDKv3/Palette.cpp \ 27 | RSDKv3/Player.cpp \ 28 | RSDKv3/Reader.cpp \ 29 | RSDKv3/RetroEngine.cpp \ 30 | RSDKv3/Scene.cpp \ 31 | RSDKv3/Scene3D.cpp \ 32 | RSDKv3/Script.cpp \ 33 | RSDKv3/Sprite.cpp \ 34 | RSDKv3/String.cpp \ 35 | RSDKv3/Text.cpp \ 36 | RSDKv3/Userdata.cpp \ 37 | RSDKv3/Video.cpp 38 | 39 | 40 | ifeq ($(FORCE_CASE_INSENSITIVE),1) 41 | CXXFLAGS_ALL += -DFORCE_CASE_INSENSITIVE 42 | SOURCES += RSDKv3/fcaseopen.c 43 | endif 44 | 45 | ifeq ($(USE_HW_REN),1) 46 | CXXFLAGS_ALL += -DUSE_HW_REN 47 | LIBS_ALL += -lGL -lGLEW 48 | endif 49 | 50 | OBJECTS = $(SOURCES:%=objects/%.o) 51 | DEPENDENCIES = $(SOURCES:%=objects/%.d) 52 | 53 | include $(wildcard $(DEPENDENCIES)) 54 | 55 | objects/%.o: % 56 | mkdir -p $(@D) 57 | $(CXX) $(CXXFLAGS_ALL) -std=c++17 $< -o $@ -c 58 | 59 | bin/soniccd: $(SOURCES:%=objects/%.o) 60 | mkdir -p $(@D) 61 | $(CXX) $(CXXFLAGS_ALL) $(LDFLAGS_ALL) $^ -o $@ $(LIBS_ALL) 62 | 63 | install: bin/soniccd 64 | install -Dp -m755 bin/soniccd $(prefix)/bin/soniccd 65 | 66 | clean: 67 | rm -r -f bin && rm -r -f objects 68 | -------------------------------------------------------------------------------- /Makefile.3ds: -------------------------------------------------------------------------------- 1 | ifeq ($(strip $(DEVKITARM)),) 2 | $(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") 3 | endif 4 | 5 | TOPDIR ?= $(CURDIR) 6 | include $(DEVKITARM)/3ds_rules 7 | 8 | BUILDDIR=objects_3ds 9 | 10 | LIBS_ALL = -lSDL_mixer -lSDL -lmikmod -lmad -ltheoradec -lvorbisidec -logg -lcitro2d -lcitro3d -lctru -lm 11 | LIBDIRS = $(CTRULIB) $(PORTLIBS) 12 | export LIBPATHS = $(foreach dir,$(LIBDIRS),-L$(dir)/lib) 13 | 14 | export COMMIT = $(shell git rev-parse --short HEAD) 15 | 16 | ARCH = -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft 17 | CFLAGS_ALL = $(INCLUDE) $(ARCH) -DARM_ASM_CLIP15=1 -O2 -g -DARM11 -D_3DS -D__3DS__ -DCOMMIT=\"$(COMMIT)\" -DFORCE_CASE_INSENSITIVE 18 | CXXFLAGS_ALL = $(CFLAGS_ALL) $(LIBS_ALL) -fno-rtti -std=gnu++17 -Idependencies/all/theoraplay 19 | LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) 20 | LDFLAGS_ALL = $(LDFLAGS) 21 | 22 | TARGET = SonicCD 23 | 24 | APP_TITLE := Sonic CD 25 | APP_DESCRIPTION := Sonic CD (2011) 26 | APP_AUTHOR := Rubberduckycooly, SaturnSH2x2 27 | APP_ICON := resources/48x48.png 28 | 29 | export INCLUDE = $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ 30 | -I$(CURDIR)/$(BUILD) 31 | 32 | export LD = $(CXX) 33 | 34 | SOURCES = dependencies/all/theoraplay/theoraplay.c \ 35 | RSDKv3/3ds/debug_3ds.cpp \ 36 | RSDKv3/3ds/audio_3ds.cpp \ 37 | RSDKv3/3ds/render_3ds.cpp \ 38 | RSDKv3/3ds/video_3ds.cpp \ 39 | RSDKv3/3ds/3ds-theoraplayer/source/video.c \ 40 | RSDKv3/3ds/3ds-theoraplayer/source/frame.c \ 41 | RSDKv3/fcaseopen.c \ 42 | RSDKv3/Animation.cpp \ 43 | RSDKv3/Audio.cpp \ 44 | RSDKv3/Collision.cpp \ 45 | RSDKv3/Debug.cpp \ 46 | RSDKv3/Drawing.cpp \ 47 | RSDKv3/Ini.cpp \ 48 | RSDKv3/Input.cpp \ 49 | RSDKv3/main.cpp \ 50 | RSDKv3/Math.cpp \ 51 | RSDKv3/Object.cpp \ 52 | RSDKv3/Palette.cpp \ 53 | RSDKv3/Player.cpp \ 54 | RSDKv3/Reader.cpp \ 55 | RSDKv3/RetroEngine.cpp \ 56 | RSDKv3/Scene.cpp \ 57 | RSDKv3/Scene3D.cpp \ 58 | RSDKv3/Script.cpp \ 59 | RSDKv3/Sprite.cpp \ 60 | RSDKv3/String.cpp \ 61 | RSDKv3/Text.cpp \ 62 | RSDKv3/Userdata.cpp \ 63 | RSDKv3/Video.cpp 64 | 65 | OBJS = $(BUILDDIR)/dependencies/all/theoraplay/theoraplay.c.o \ 66 | $(BUILDDIR)/RSDKv3/3ds/debug_3ds.cpp.o \ 67 | $(BUILDDIR)/RSDKv3/3ds/audio_3ds.cpp.o \ 68 | $(BUILDDIR)/RSDKv3/3ds/render_3ds.cpp.o \ 69 | $(BUILDDIR)/RSDKv3/3ds/video_3ds.cpp.o \ 70 | $(BUILDDIR)/RSDKv3/3ds/3ds-theoraplayer/source/video.c.o \ 71 | $(BUILDDIR)/RSDKv3/3ds/3ds-theoraplayer/source/frame.c.o \ 72 | $(BUILDDIR)/RSDKv3/fcaseopen.c.o \ 73 | $(BUILDDIR)/RSDKv3/Animation.cpp.o \ 74 | $(BUILDDIR)/RSDKv3/Audio.cpp.o \ 75 | $(BUILDDIR)/RSDKv3/Collision.cpp.o \ 76 | $(BUILDDIR)/RSDKv3/Debug.cpp.o \ 77 | $(BUILDDIR)/RSDKv3/Drawing.cpp.o \ 78 | $(BUILDDIR)/RSDKv3/Ini.cpp.o \ 79 | $(BUILDDIR)/RSDKv3/Input.cpp.o \ 80 | $(BUILDDIR)/RSDKv3/main.cpp.o \ 81 | $(BUILDDIR)/RSDKv3/Math.cpp.o \ 82 | $(BUILDDIR)/RSDKv3/Object.cpp.o \ 83 | $(BUILDDIR)/RSDKv3/Palette.cpp.o \ 84 | $(BUILDDIR)/RSDKv3/Player.cpp.o \ 85 | $(BUILDDIR)/RSDKv3/Reader.cpp.o \ 86 | $(BUILDDIR)/RSDKv3/RetroEngine.cpp.o \ 87 | $(BUILDDIR)/RSDKv3/Scene.cpp.o \ 88 | $(BUILDDIR)/RSDKv3/Scene3D.cpp.o \ 89 | $(BUILDDIR)/RSDKv3/Script.cpp.o \ 90 | $(BUILDDIR)/RSDKv3/Sprite.cpp.o \ 91 | $(BUILDDIR)/RSDKv3/String.cpp.o \ 92 | $(BUILDDIR)/RSDKv3/Text.cpp.o \ 93 | $(BUILDDIR)/RSDKv3/Userdata.cpp.o \ 94 | $(BUILDDIR)/RSDKv3/Video.cpp.o 95 | 96 | export _3DSXDEPS := $(if $(NO_SMDH),,$(TARGET).smdh) 97 | 98 | ifeq ($(strip $(NO_SMDH)),) 99 | export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh 100 | endif 101 | 102 | ifneq ($(ROMFS),) 103 | export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS) 104 | endif 105 | 106 | $(BUILDDIR)/%.o: % 107 | mkdir -p $(@D) 108 | $(CXX) $(CXXFLAGS_ALL) $^ -o $@ -c 109 | 110 | $(TARGET).3dsx: $(TARGET).elf $(_3DSXDEPS) 111 | 112 | $(TARGET).elf: $(SOURCES:%=objects_3ds/%.o) 113 | $(SILENTMSG) linking $(notdir $@) 114 | $(LD) $(LDFLAGS) $(OBJS) $(LIBPATHS) $(LIBS_ALL) -o $@ 115 | 116 | clean: 117 | @echo "cleaning..." 118 | @rm -rf objects_3ds 119 | @rm -f SonicCD.3dsx 120 | @rm -f SonicCD.smdh 121 | @rm -f SonicCD.elf 122 | @rm -f SonicCD.cia 123 | 124 | cia: $(TARGET).elf 125 | @bannertool makebanner -i resources/banner.png -a resources/jingle.wav -o "$(BUILDDIR)/banner.bnr" 126 | @bannertool makesmdh -s "$(APP_TITLE)" -l "$(APP_DESCRIPTION)" -p "$(APP_AUTHOR)" -i "$(APP_ICON)" -o "$(BUILDDIR)/icon.icn" 127 | @makerom -f cia -o "$(TARGET).cia" -DAPP_ENCRYPTED=false -elf "$(TARGET).elf" -rsf resources/SonicCD.rsf -exefslogo -target t -icon "$(BUILDDIR)/icon.icn" -banner "$(BUILDDIR)/banner.bnr" 128 | @echo "built cia" 129 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](header.png?raw=true) 2 | # **THIS PORT IS DEPRECATED** 3 | + This port is no longer maintained. Please use Voxel9's [Sonic CD port](https://github.com/Voxel9/Sonic-CD-11-3DS-Redux/releases) instead. 4 | 5 | # **SUPPORT THE OFFICIAL RELEASE OF SONIC CD** 6 | + Without assets from the official release this decompilation will not run. 7 | 8 | + You can get the official release of Sonic CD from: 9 | * [Windows (Via Steam)](https://store.steampowered.com/app/200940/Sonic_CD/) 10 | * [IOS (Via the App Store)](https://apps.apple.com/us/app/sonic-cd-classic/id454316134) 11 | * [Android (Via Google Play)](https://play.google.com/store/apps/details?id=com.sega.soniccd.classic&hl=en&gl=US) 12 | * [Android (Via Amazon)](https://www.amazon.com/Sega-of-America-Sonic-CD/dp/B008K9UZY4/ref=sr_1_2?dchild=1&keywords=Sonic+CD&qid=1607930514&sr=8-2) 13 | 14 | Even if your platform isn't supported by the official releases, you **must** buy it for the assets (you dont need to run the official release, you just need the game assets) 15 | 16 | # Features/Tweaks 17 | * Complete stereoscopic 3D (HW build only) 18 | * Video playback support courtesy @Oreo639's [3ds-theoraplayer](https://github.com/Oreo639/3ds-theoraplayer) 19 | * Built-in mod support, accessible from the Dev Menu 20 | * There is now a settings.ini file that the game uses to load all settings, similar to Sonic Mania 21 | * Dev menu can now be accessed from anywhere by pressing the SELECT button if enabled in the config 22 | * If `devMenu` is enabled in the config, pressing the R button will activate a palette overlay that shows the game's 8 internal palettes in real time 23 | 24 | # How to build: 25 | * Set up a working 3DS Homebrew Environment. You can find more information on this [here](https://www.3dbrew.org/wiki/Setting_up_Development_Environment). 26 | * Make sure `SDL`, `SDL_mixer`, `3ds-dev`, `3ds-libvorbisidec`, `3ds-libtheora`, `3ds-mikmod`, and `3ds-libmad` are installed. 27 | * Edit `RetroEngine.hpp` as necessary depending on what version of the port you want to build. If you want to build the software rendered version, set `RETRO_USING_C2D` to 0. 28 | * Run `make -f Makefile.3ds`. Run `make -f Makefile.3ds cia` to build a `.cia` file. 29 | 30 | # FAQ 31 | ### Q: What's the difference between HW and SW builds? 32 | A: SW builds use software rendering, using the same basic rendering backend that the PC/console 33 | ports of Sonic CD used. Rendering is more accurate, and all effects like scanline deformation and 34 | realtime palettes are supported. However, its rather CPU-intensive, and requires a N3DS to run at 35 | full-speed. HW builds use a completely custom Citro2D-based backend, using the 3DS's PICA200 36 | to get graphics on-screen, and thus can run at full-speed on O3DS systems, in addition to 37 | supporting features like stereosopic 3D, however, certain features like realtime palettes aren't 38 | supported. tl;dr use HW if on O3DS or if you care about 3D, use SW if on N3DS. 39 | 40 | ### Q: Why is the port separated into HW and SW builds? 41 | A: Because that's how the base decomp was set up initially, at the time the port was started. 42 | I plan on integrating both backends into a single build eventually, however, this probably won't 43 | happen until the HW backend is complete. 44 | 45 | ### Q: Why dont some buttons in the menu work? 46 | A: Buttons like leaderboards & achievements require code to be added to support online functionality & menus (though they are saved anyways), and other buttons like the controls button on PC or privacy button on mobile have no game code and are instead hardcoded through callbacks, and I just didnt feel like going through the effort to decompile all that, since its not really worth it 47 | 48 | ### Q: I found a bug/I have a feature request! 49 | A: Submit an issue in the issues tab and I'll fix/add it (if possible). Keep in mind, however, I won't fix bugs that aren't exclusive to the 3DS port; if the issue also occurs on the base decomp (i.e. on PC), you're better off submitting the issue to the [main branch](https://github.com/Rubberduckycooly/Sonic-CD-11-Decompilation). 50 | 51 | ### Q: Is there a port of the Sonic 1/Sonic 2 decompilation? 52 | A: Yes! You can check out @JeffRuLz's RSDKv4 port [here](https://github.com/JeffRuLz/Sonic-1-2-2013-Decompilation). 53 | 54 | ### Q: Why is video playback so slow? 55 | A: You're going to want to scale down your videos for them to run well on 3DS. You can find pre-scaled versions of the videos [here](https://gamebanana.com/mods/313570). 56 | 57 | # Special Thanks 58 | * [Rubberduckycooly](https://github.com/Rubberduckycooly): For decompiling CD in the first place, as well as helping me out with a few aspects of the port. 59 | * [JeffRuLz](https://github.com/JeffRuLz): For implementing frame limiting and helping out with the SW backend, as well as for porting OpenHCL to the 3DS, which helped immensely in developing the Citro2D backend. 60 | * [Oreo639](https://github.com/Oreo639): For helping out with the Makefile, as well as being behind [3ds-theoraplayer](https://github.com/Oreo639/3ds-theoraplayer), which the port uses to play back videos. 61 | 62 | # Contact: 63 | Join the [Retro Engine Modding Discord Server](https://dc.railgun.works/retroengine) for any extra questions you may need to know about the decompilation or modding it. My Discord is saturnsh2x2#3840, and while I'm not the most active on there, ping me if you have a question and I'll see what I can do. 64 | -------------------------------------------------------------------------------- /RSDKv3 ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RSDKv3 ios.xcodeproj/xcshareddata/xcschemes/RSDKv3.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /RSDKv3.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29806.167 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RSDKv3", "RSDKv3\RSDKv3.vcxproj", "{BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug_HW|x64 = Debug_HW|x64 11 | Debug_HW|x86 = Debug_HW|x86 12 | Debug_SW|x64 = Debug_SW|x64 13 | Debug_SW|x86 = Debug_SW|x86 14 | Release_HW|x64 = Release_HW|x64 15 | Release_HW|x86 = Release_HW|x86 16 | Release_SW|x64 = Release_SW|x64 17 | Release_SW|x86 = Release_SW|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Debug_HW|x64.ActiveCfg = Debug_HW|x64 21 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Debug_HW|x64.Build.0 = Debug_HW|x64 22 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Debug_HW|x86.ActiveCfg = Debug_HW|Win32 23 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Debug_HW|x86.Build.0 = Debug_HW|Win32 24 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Debug_SW|x64.ActiveCfg = Debug|x64 25 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Debug_SW|x64.Build.0 = Debug|x64 26 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Debug_SW|x86.ActiveCfg = Debug|Win32 27 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Debug_SW|x86.Build.0 = Debug|Win32 28 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Release_HW|x64.ActiveCfg = Release_HW|x64 29 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Release_HW|x64.Build.0 = Release_HW|x64 30 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Release_HW|x86.ActiveCfg = Release_HW|Win32 31 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Release_HW|x86.Build.0 = Release_HW|Win32 32 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Release_SW|x64.ActiveCfg = Release|x64 33 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Release_SW|x64.Build.0 = Release|x64 34 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Release_SW|x86.ActiveCfg = Release|Win32 35 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Release_SW|x86.Build.0 = Release|Win32 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | GlobalSection(ExtensibilityGlobals) = postSolution 41 | SolutionGuid = {CEEC6B21-D41E-4C5C-8B97-9FAAD7974615} 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /RSDKv3.vita/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## This file is a quick tutorial on writing CMakeLists for targeting the Vita 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | ## This includes the Vita toolchain, must go before project definition 5 | # It is a convenience so you do not have to type 6 | # -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake for cmake. It is 7 | # highly recommended that you include this block for all projects. 8 | if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) 9 | if(DEFINED ENV{VITASDK}) 10 | set(CMAKE_TOOLCHAIN_FILE "$ENV{VITASDK}/share/vita.toolchain.cmake" CACHE PATH "toolchain file") 11 | else() 12 | message(FATAL_ERROR "Please define VITASDK to point to your SDK path!") 13 | endif() 14 | endif() 15 | 16 | ## Define project parameters here 17 | # Name of the project 18 | project(SonicCD) 19 | # This line adds Vita helper macros, must go after project definition in order 20 | # to build Vita specific artifacts (self/vpk). 21 | include("${VITASDK}/share/vita.cmake" REQUIRED) 22 | 23 | ## Configuration options for this app 24 | # Display name (under bubble in LiveArea) 25 | set(VITA_APP_NAME "Sonic CD") 26 | # Unique ID must be exactly 9 characters. Recommended: XXXXYYYYY where X = 27 | # unique string of developer and Y = a unique number for this app 28 | set(VITA_TITLEID "RSDK00001") 29 | # Optional version string to show in LiveArea's more info screen 30 | set(VITA_VERSION "01.00") 31 | 32 | ## Flags and includes for building 33 | # Note that we make sure not to overwrite previous flags 34 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -fsigned-char -fno-lto") 35 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -fsigned-char -fno-lto -fno-rtti -fno-exceptions") 36 | # Optional. You can specify more param.sfo flags this way. 37 | set(VITA_MKSFOEX_FLAGS "${VITA_MKSFOEX_FLAGS} -d PARENTAL_LEVEL=1") 38 | 39 | # Add any additional include paths here 40 | include_directories( 41 | ../dependencies/all/theoraplay 42 | /home/user/vitasdk/arm-vita-eabi/include 43 | ) 44 | 45 | # Add any additional library paths here 46 | # ${CMAKE_CURRENT_BINARY_DIR} lets you use any library currently being built 47 | link_directories( 48 | ${CMAKE_CURRENT_BINARY_DIR} 49 | ) 50 | 51 | ## Build and link 52 | # Add all the files needed to compile here 53 | add_executable(${PROJECT_NAME} 54 | ../dependencies/all/theoraplay/theoraplay.c 55 | ../SonicCDDecomp/Animation.cpp 56 | ../SonicCDDecomp/Audio.cpp 57 | ../SonicCDDecomp/Collision.cpp 58 | ../SonicCDDecomp/Debug.cpp 59 | ../SonicCDDecomp/Drawing.cpp 60 | ../SonicCDDecomp/Ini.cpp 61 | ../SonicCDDecomp/Input.cpp 62 | ../SonicCDDecomp/Math.cpp 63 | ../SonicCDDecomp/Object.cpp 64 | ../SonicCDDecomp/Palette.cpp 65 | ../SonicCDDecomp/Player.cpp 66 | ../SonicCDDecomp/Reader.cpp 67 | ../SonicCDDecomp/RetroEngine.cpp 68 | ../SonicCDDecomp/Scene.cpp 69 | ../SonicCDDecomp/Scene3D.cpp 70 | ../SonicCDDecomp/Script.cpp 71 | ../SonicCDDecomp/Sprite.cpp 72 | ../SonicCDDecomp/String.cpp 73 | ../SonicCDDecomp/Text.cpp 74 | ../SonicCDDecomp/Userdata.cpp 75 | ../SonicCDDecomp/Video.cpp 76 | ../SonicCDDecomp/main.cpp 77 | ) 78 | 79 | # Library to link to (drop the -l prefix). This will mostly be stubs. 80 | target_link_libraries(${PROJECT_NAME} 81 | SDL2 82 | vita2d 83 | vorbisfile 84 | vorbis 85 | ogg 86 | theora 87 | pthread 88 | SceDisplay_stub 89 | SceAudio_stub 90 | SceCtrl_stub 91 | SceSysmodule_stub 92 | SceGxm_stub 93 | SceCommonDialog_stub 94 | SceAppMgr_stub 95 | SceTouch_stub 96 | SceHid_stub 97 | SceAudio_stub 98 | SceMotion_stub 99 | m 100 | ) 101 | 102 | ## Create Vita files 103 | vita_create_self(${PROJECT_NAME}.self ${PROJECT_NAME}) 104 | # The FILE directive lets you add additional files to the VPK, the syntax is 105 | # FILE src_path dst_path_in_vpk. In this case, we add the LiveArea paths. 106 | vita_create_vpk(${PROJECT_NAME}.vpk ${VITA_TITLEID} ${PROJECT_NAME}.self 107 | VERSION ${VITA_VERSION} 108 | NAME ${VITA_APP_NAME} 109 | # FILE sce_sys/icon0.png sce_sys/icon0.png 110 | # FILE sce_sys/livearea/contents/bg.png sce_sys/livearea/contents/bg.png 111 | # FILE sce_sys/livearea/contents/startup.png sce_sys/livearea/contents/startup.png 112 | FILE sce_sys/livearea/contents/template.xml sce_sys/livearea/contents/template.xml 113 | ) 114 | -------------------------------------------------------------------------------- /RSDKv3.vita/build-internal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | apk add --no-cache make cmake 3 | 4 | function getSdl2() { 5 | wget https://github.com/rsn8887/SDL-Vita/releases/download/2.0.8dev_vita_rsn8887_git_20180523/sdl2_vita_20180523.tar.xz && \ 6 | mkdir -p ../dependencies/vita/sdl2 || true && \ 7 | tar -xf sdl2_vita_20180523.tar.xz -C ../dependencies/vita/sdl2 8 | rm sdl2_vita_20180523.tar.xz 9 | } 10 | 11 | function getLibTheora() { 12 | wget https://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2 && \ 13 | tar -xf libtheora-1.1.1.tar.bz2 -C ../dependencies/vita && \ 14 | (cd ../dependencies/vita/libtheora || \ 15 | (mv ../dependencies/vita/libtheora-1.1.1 ../dependencies/vita/libtheora && cd ../dependencies/vita/libtheora)) && \ 16 | cd ../dependencies/vita/libtheora && \ 17 | (./configure --host=arm-vita-eabi --prefix=${VITASDK}/arm-vita-eabi --disable-shared --enable-static --disable-spec --disable-examples) || 18 | cd - 19 | rm libtheora-1.1.1.tar.bz2 20 | } 21 | 22 | function installLibTheora() { 23 | cd ../dependencies/vita/libtheora && \ 24 | make install && \ 25 | cd - 26 | } 27 | 28 | # Download dependencies 29 | [ ! -d ../dependencies/vita/sdl2 ] && getSdl2 30 | [ ! -d ../dependencies/vita/libtheora ] && getLibTheora 31 | installLibTheora 32 | 33 | cmake . && \ 34 | make 35 | rm SonicCD # this is not ignored by .gitignore 36 | -------------------------------------------------------------------------------- /RSDKv3.vita/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sudo docker run \ 3 | --rm \ 4 | -v $PWD/..:/work \ 5 | -w /work/SonicCD.Vita \ 6 | vitasdk/vitasdk \ 7 | /bin/sh -C "./build-internal.sh" 8 | -------------------------------------------------------------------------------- /RSDKv3.vita/sce_sys/livearea/contents/template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bg.png 6 | 7 | 8 | 9 | startup.png 10 | 11 | 12 | -------------------------------------------------------------------------------- /RSDKv3.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RSDKv3.xcodeproj/xcshareddata/xcschemes/RSDKv3.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /RSDKv3/3ds/audio_3ds.hpp: -------------------------------------------------------------------------------- 1 | #define SAMPLE_RATE (44100) 2 | #define SAMPLES_PER_BUF (SAMPLE_RATE * 120 / 1000) 3 | #define CHANNELS_PER_SAMPLE (2) 4 | 5 | #define THREAD_AFFINITY (-1) 6 | #define THREAD_STACK_SZ (32 * 1024) 7 | 8 | // came to this size after looking at some of the game's audio files 9 | #define SFX_BUFFER_SZ (300 * 1024) 10 | #define SFX_SAMPLE_SZ (SFX_BUFFER_SZ / SAMPLES_PER_BUF) 11 | 12 | #define WAVEBUF_SIZE (SAMPLES_PER_BUF * CHANNELS_PER_SAMPLE * sizeof(int16_t)) 13 | #define MIX_BUFFER_SAMPLES (256) 14 | #define BYTES_PER_SAMPLE (4) 15 | #define _3DS_MAX_CHANNELS (24) 16 | 17 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 18 | #define ADJUST_VOLUME(s, v) (s = (s * v) / MAX_VOLUME) 19 | 20 | #if !RETRO_USING_SDL1_AUDIO 21 | bool _3ds_audioInit(); 22 | void _3ds_audioExit(); 23 | void _3ds_musicLogic(); 24 | void _3ds_musicDecode(MusicPlaybackInfo* m, ndspWaveBuf* wbuf); 25 | void _3ds_sfxLogic(); 26 | void _3ds_sfxDecode(ChannelInfo* sfx, ndspWaveBuf* wbuf); 27 | void _3ds_audioCallback(void* const nul); 28 | void _3ds_audioThread(void* const nul); 29 | 30 | extern int trackBuffer; 31 | extern LightEvent s_event; 32 | #endif 33 | -------------------------------------------------------------------------------- /RSDKv3/3ds/c2d_internal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | typedef struct 5 | { 6 | float pos[3]; 7 | float texcoord[2]; 8 | float ptcoord[2]; 9 | u32 color; 10 | } C2Di_Vertex; 11 | 12 | typedef struct 13 | { 14 | DVLB_s* shader; 15 | shaderProgram_s program; 16 | C3D_AttrInfo attrInfo; 17 | C3D_BufInfo bufInfo; 18 | C3D_ProcTex ptBlend; 19 | C3D_ProcTex ptCircle; 20 | C3D_ProcTexLut ptBlendLut; 21 | C3D_ProcTexLut ptCircleLut; 22 | u32 sceneW, sceneH; 23 | 24 | C2Di_Vertex* vtxBuf; 25 | size_t vtxBufSize; 26 | size_t vtxBufPos; 27 | size_t vtxBufLastPos; 28 | 29 | u32 flags; 30 | C3D_Mtx projMtx; 31 | C3D_Mtx mdlvMtx; 32 | C3D_Tex* curTex; 33 | u32 fadeClr; 34 | } C2Di_Context; 35 | 36 | enum 37 | { 38 | C2DiF_Active = BIT(0), 39 | C2DiF_DirtyProj = BIT(1), 40 | C2DiF_DirtyMdlv = BIT(2), 41 | C2DiF_DirtyTex = BIT(3), 42 | C2DiF_DirtySrc = BIT(4), 43 | C2DiF_DirtyFade = BIT(5), 44 | C2DiF_DirtyProcTex = BIT(6), 45 | 46 | C2DiF_Src_None = 0, 47 | C2DiF_Src_Tex = BIT(31), 48 | C2DiF_Src_Mask = BIT(31), 49 | 50 | C2DiF_ProcTex_Circle = BIT(30), 51 | 52 | C2DiF_DirtyAny = C2DiF_DirtyProj | C2DiF_DirtyMdlv | C2DiF_DirtyTex | C2DiF_DirtySrc | C2DiF_DirtyFade | C2DiF_DirtyProcTex, 53 | }; 54 | 55 | struct C2D_Font_s 56 | { 57 | CFNT_s* cfnt; 58 | C3D_Tex* glyphSheets; 59 | float textScale; 60 | }; 61 | 62 | static inline C2Di_Context* C2Di_GetContext(void) 63 | { 64 | extern C2Di_Context __C2Di_Context; 65 | return &__C2Di_Context; 66 | } 67 | 68 | static inline void C2Di_SetSrc(u32 src) 69 | { 70 | C2Di_Context* ctx = C2Di_GetContext(); 71 | src &= C2DiF_Src_Mask; 72 | if ((ctx->flags & C2DiF_Src_Mask) != src) 73 | ctx->flags = C2DiF_DirtySrc | (ctx->flags &~ C2DiF_Src_Mask) | src; 74 | } 75 | 76 | static inline void C2Di_SetTex(C3D_Tex* tex) 77 | { 78 | C2Di_Context* ctx = C2Di_GetContext(); 79 | C2Di_SetSrc(C2DiF_Src_Tex); 80 | if (tex != ctx->curTex) 81 | { 82 | ctx->flags |= C2DiF_DirtyTex; 83 | ctx->curTex = tex; 84 | } 85 | } 86 | 87 | static inline void C2Di_SetCircle(bool iscircle) 88 | { 89 | C2Di_Context* ctx = C2Di_GetContext(); 90 | if (iscircle && !(ctx->flags & C2DiF_ProcTex_Circle)) 91 | { 92 | ctx->flags |= C2DiF_DirtyProcTex; 93 | ctx->flags |= C2DiF_ProcTex_Circle; 94 | } 95 | else if (!iscircle && (ctx->flags & C2DiF_ProcTex_Circle)) 96 | { 97 | ctx->flags |= C2DiF_DirtyProcTex; 98 | ctx->flags &= ~C2DiF_ProcTex_Circle; 99 | } 100 | 101 | } 102 | 103 | typedef struct 104 | { 105 | float topLeft[2]; 106 | float topRight[2]; 107 | float botLeft[2]; 108 | float botRight[2]; 109 | } C2Di_Quad; 110 | 111 | void C2Di_CalcQuad(C2Di_Quad* quad, const C2D_DrawParams* params); 112 | void C2Di_AppendVtx(float x, float y, float z, float u, float v, float ptx, float pty, u32 color); 113 | void C2Di_FlushVtxBuf(void); 114 | void C2Di_Update(void); 115 | -------------------------------------------------------------------------------- /RSDKv3/3ds/debug_3ds.cpp: -------------------------------------------------------------------------------- 1 | #include "../RetroEngine.hpp" 2 | 3 | void DebugConsoleInit() { 4 | consoleInit(GFX_BOTTOM, NULL); 5 | 6 | printf("--------------------------------\n"); 7 | printf("| RSDKv3 3DS Debug Console |\n"); 8 | printf("--------------------------------\n"); 9 | 10 | printf("The programmer has a nap.\n"); 11 | printf("Hold out! Programmer!\n\n"); 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /RSDKv3/3ds/debug_3ds.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_PLATFORM == RETRO_3DS 2 | #ifndef DEBUG_3DS_H 3 | #define DEBUG_3DS_H 4 | 5 | void DebugConsoleInit(); 6 | 7 | #endif 8 | #endif 9 | -------------------------------------------------------------------------------- /RSDKv3/3ds/render_3ds.cpp: -------------------------------------------------------------------------------- 1 | #include "../RetroEngine.hpp" 2 | #include "c2d_internal.h" 3 | 4 | #if RETRO_USING_C2D 5 | 6 | int spriteIndex[7] = { 0 }; 7 | int tileIndex[4] = { 0 }; 8 | int rectIndex[7] = { 0 }; 9 | 10 | C3D_Tex _3ds_textureData[SURFACE_MAX]; 11 | C3D_Tex _3ds_tilesetData[TILE_MAXSIZE]; 12 | _3ds_sprite _3ds_sprites[7][MAX_SPRITES_PER_LAYER]; 13 | _3ds_tile _3ds_tiles[4][MAX_TILES_PER_LAYER]; 14 | 15 | byte paletteIndex = 0; 16 | byte cachedPalettes = 0; 17 | byte maxPaletteCycles = 0; 18 | 19 | u32 clearColor = 0; 20 | u32 fadeColor = 0; 21 | byte clearScreen = 0; 22 | 23 | /* 24 | JeffRuLz's texture handling code from OpenHCL was referenced heavily here 25 | swapPixel, powOfTwo, and swizzle were also directly lifted from its code 26 | See here: https://github.com/JeffRuLz/OpenHCL/blob/master/platform/3ds/source/graphics.cpp 27 | */ 28 | 29 | static inline void swapPixel(u16 &a, u16 &b) 30 | { 31 | u32 tmp = a; 32 | a = b; 33 | b = tmp; 34 | } 35 | 36 | static inline void swizzle(u16* p, bool reverse) 37 | { 38 | // swizzle foursome table 39 | static const unsigned char table[][4] = 40 | { 41 | { 2, 8, 16, 4, }, 42 | { 3, 9, 17, 5, }, 43 | { 6, 10, 24, 20, }, 44 | { 7, 11, 25, 21, }, 45 | { 14, 26, 28, 22, }, 46 | { 15, 27, 29, 23, }, 47 | { 34, 40, 48, 36, }, 48 | { 35, 41, 49, 37, }, 49 | { 38, 42, 56, 52, }, 50 | { 39, 43, 57, 53, }, 51 | { 46, 58, 60, 54, }, 52 | { 47, 59, 61, 55, } 53 | }; 54 | 55 | if (!reverse) { 56 | for (const auto &entry : table) 57 | { 58 | u16 tmp = p[entry[0]]; 59 | p[entry[0]] = p[entry[1]]; 60 | p[entry[1]] = p[entry[2]]; 61 | p[entry[2]] = p[entry[3]]; 62 | p[entry[3]] = tmp; 63 | } 64 | } else { 65 | for (const auto &entry : table) { 66 | u16 tmp = p[entry[3]]; 67 | p[entry[3]] = p[entry[2]]; 68 | p[entry[2]] = p[entry[1]]; 69 | p[entry[1]] = p[entry[0]]; 70 | p[entry[0]] = tmp; 71 | } 72 | } 73 | 74 | swapPixel(p[12], p[18]); 75 | swapPixel(p[13], p[19]); 76 | swapPixel(p[44], p[50]); 77 | swapPixel(p[45], p[51]); 78 | } 79 | 80 | static inline int powOfTwo(int in) 81 | { 82 | int out = 8; 83 | while (out < in) 84 | out *= 2; 85 | return out; 86 | } 87 | 88 | // 3DS doesn't like 16x16384 textures 89 | // who knew 90 | void _3ds_rearrangeTileData(byte* gfxDataPtr, byte* dstPtr) { 91 | const int swidth = 16, sheight = 16384; 92 | const int dwidth = 512, dheight = 512; 93 | int sx = 0, sy = 0, dx = 0, dy = 0; 94 | byte* sptr = gfxDataPtr; 95 | byte* dptr = dstPtr; 96 | 97 | for (int i = 0; i < 512 * 512; i++) { 98 | dptr = dstPtr + (dwidth * dy) + dx; 99 | 100 | *dptr = *sptr; 101 | 102 | sptr++; 103 | sx++; 104 | if (sx == swidth) { 105 | sx = 0; 106 | sy++; 107 | } 108 | 109 | SWTilePosToHWTilePos(sx, sy, &dx, &dy); 110 | } 111 | } 112 | 113 | void _3ds_cacheSpriteSurface(int sheetID) { 114 | GFXSurface* surf = &gfxSurface[sheetID]; 115 | int height = surf->height; 116 | int width = surf->width; 117 | int depth = 0; 118 | byte *gfxDataPtr = &graphicData[surf->dataPosition]; 119 | _3ds_cacheGfxSurface(gfxDataPtr, &_3ds_textureData[sheetID], width, height, false); 120 | } 121 | 122 | void _3ds_delSpriteSurface(int sheetID) { 123 | C3D_TexDelete(&_3ds_textureData[sheetID]); 124 | } 125 | 126 | void _3ds_cacheTileSurface(byte* tilesetGfxPtr) { 127 | //if (cachedPalettes >= TILE_MAXSIZE) 128 | // return; 129 | 130 | byte* temp = (byte*) malloc(512 * 512 * sizeof(byte)); 131 | _3ds_rearrangeTileData(tilesetGfxPtr, temp); 132 | _3ds_cacheGfxSurface(temp, &_3ds_tilesetData[cachedPalettes], 512, 512, true); 133 | cachedPalettes++; 134 | free(temp); 135 | } 136 | 137 | void _3ds_delTileSurface() { 138 | for (int i = 0; i < cachedPalettes; i++) 139 | C3D_TexDelete(&_3ds_tilesetData[i]); 140 | 141 | // does this fix that memory leak? 142 | cachedPalettes = 0; 143 | } 144 | 145 | void _3ds_cacheGfxSurface(byte* gfxDataPtr, C3D_Tex* dst, 146 | int width, int height, bool allPalette) { 147 | byte *lineBuffer = &gfxLineBuffer[0]; 148 | activePalette = fullPalette[*lineBuffer]; 149 | 150 | if (width <= 0 || height <= 0) 151 | return; 152 | 153 | int x = 0, y = 0; 154 | int w = powOfTwo(width); 155 | int h = powOfTwo(height); 156 | 157 | u16* buffer = (u16*) linearAlloc(w * h * sizeof(u16)); 158 | u16* bufferPtr = buffer; 159 | byte* gptr = gfxDataPtr; 160 | for (int i = 0; i < w * h; ) { 161 | u16 tile[8 * 8] = { 0 }; 162 | u16* tilePtr = tile; 163 | 164 | for (int ty = 0; ty < 8; ty++) { 165 | gptr = gfxDataPtr + (width * y) + x; 166 | for (int tx = 0; tx < 8; tx++) { 167 | if (x < width && y < height) { 168 | if (*gptr > 0) 169 | *tilePtr = CONV(activePalette[*gptr]); 170 | else 171 | *tilePtr = 0; 172 | } 173 | tilePtr++; 174 | 175 | gptr++; 176 | x++; 177 | i++; 178 | } 179 | 180 | x -= 8; 181 | y++; 182 | } 183 | 184 | x += 8; 185 | y -= 8; 186 | 187 | if (x >= w - 1) { 188 | x = 0; 189 | y += 8; 190 | } 191 | 192 | swizzle(tile, false); 193 | 194 | for (int a = 0; a < 8 * 8; a++) 195 | *(bufferPtr++) = tile[a]; 196 | } 197 | 198 | C3D_TexInit(dst, w, h, GPU_RGBA5551); 199 | C3D_TexUpload(dst, buffer); 200 | linearFree(buffer); 201 | } 202 | 203 | #endif 204 | 205 | -------------------------------------------------------------------------------- /RSDKv3/3ds/video_3ds.cpp: -------------------------------------------------------------------------------- 1 | #include "../RetroEngine.hpp" 2 | #define SCREEN_WIDTH 400 3 | #define SCREEN_HEIGHT 240 4 | 5 | #define WAVEBUFCOUNT 3 6 | #define MAX_LIST 28 7 | 8 | // Citro2D should always be used for rendering video, 9 | // across both hardware and software builds 10 | 11 | // following code ripped from 3ds-theoraplayer's main.c 12 | C3D_RenderTarget* topScreen; 13 | THEORA_Context vidCtx; 14 | TH3DS_Frame frame; 15 | Thread vthread = NULL; 16 | Thread athread = NULL; 17 | static size_t buffSize = 8 * 4096; 18 | static ndspWaveBuf waveBuf[WAVEBUFCOUNT]; 19 | int16_t* audioBuffer; 20 | LightEvent soundEvent; 21 | int ready = 0; 22 | float scaleframe = 1.0f; 23 | 24 | int isplaying = false; 25 | bool videodone = false; 26 | 27 | static inline float getFrameScalef(float wi, float hi, float targetw, float targeth) { 28 | float w = targetw/wi; 29 | float h = targeth/hi; 30 | return fabs(w) > fabs(h) ? h : w; 31 | } 32 | 33 | void audioInit(THEORA_audioinfo* ainfo) { 34 | ndspChnReset(0); 35 | ndspSetOutputMode(NDSP_OUTPUT_STEREO); 36 | ndspChnSetInterp(0, ainfo->channels == 2 ? NDSP_INTERP_POLYPHASE : NDSP_INTERP_LINEAR); 37 | ndspChnSetRate(0, ainfo->rate); 38 | ndspChnSetFormat(0, ainfo->channels == 2 ? NDSP_FORMAT_STEREO_PCM16 : NDSP_FORMAT_MONO_PCM16); 39 | audioBuffer = (int16_t*) linearAlloc((buffSize * sizeof(int16_t)) * WAVEBUFCOUNT); 40 | 41 | memset(waveBuf, 0, sizeof(waveBuf)); 42 | for (unsigned i = 0; i < WAVEBUFCOUNT; ++i) 43 | { 44 | waveBuf[i].data_vaddr = &audioBuffer[i * buffSize]; 45 | waveBuf[i].nsamples = buffSize; 46 | waveBuf[i].status = NDSP_WBUF_DONE; 47 | } 48 | } 49 | 50 | void audioClose(void) { 51 | ndspChnReset(0); 52 | if (audioBuffer) linearFree(audioBuffer); 53 | } 54 | 55 | void videoDecode_thread(void* nul) { 56 | THEORA_videoinfo* vinfo = THEORA_vidinfo(&vidCtx); 57 | THEORA_audioinfo* ainfo = THEORA_audinfo(&vidCtx); 58 | 59 | audioInit(ainfo); 60 | 61 | if (THEORA_HasVideo(&vidCtx)) { 62 | //printf("Ogg stream is Theora %dx%d %.02f fps\n", vinfo->width, vinfo->height, vinfo->fps); 63 | frameInit(&frame, vinfo); 64 | scaleframe = getFrameScalef(vinfo->width, vinfo->height, SCREEN_WIDTH, SCREEN_HEIGHT); 65 | } 66 | 67 | isplaying = true; 68 | 69 | while (isplaying) 70 | { 71 | if (THEORA_eos(&vidCtx)) 72 | break; 73 | 74 | if (THEORA_HasVideo(&vidCtx)) { 75 | th_ycbcr_buffer ybr; 76 | if (THEORA_getvideo(&vidCtx, ybr)) { 77 | frameWrite(&frame, vinfo, ybr); 78 | } 79 | } 80 | 81 | if (THEORA_HasAudio(&vidCtx)) { 82 | for (int cur_wvbuf = 0; cur_wvbuf < WAVEBUFCOUNT; cur_wvbuf++) { 83 | ndspWaveBuf *buf = &waveBuf[cur_wvbuf]; 84 | 85 | if(buf->status == NDSP_WBUF_DONE) { 86 | //__lock_acquire(oggMutex); 87 | size_t read = THEORA_readaudio(&vidCtx, (char*) buf->data_pcm16, buffSize); 88 | //__lock_release(oggMutex); 89 | if(read <= 0) 90 | break; 91 | else if(read <= buffSize) 92 | buf->nsamples = read / ainfo->channels; 93 | 94 | ndspChnWaveBufAdd(0, buf); 95 | } 96 | DSP_FlushDataCache(buf->data_pcm16, buffSize * sizeof(int16_t)); 97 | } 98 | } 99 | } 100 | 101 | //printf("frames: %d dropped: %d\n", vidCtx.frames, vidCtx.dropped); 102 | videodone = true; 103 | 104 | if (THEORA_HasVideo(&vidCtx)) 105 | frameDelete(&frame); 106 | 107 | audioClose(); 108 | 109 | THEORA_Close(&vidCtx); 110 | threadExit(0); 111 | } 112 | 113 | void audioCallback(void *const arg_) 114 | { 115 | (void)arg_; 116 | 117 | if (!isplaying) 118 | return; 119 | 120 | LightEvent_Signal(&soundEvent); 121 | } 122 | 123 | static void exitThread(void) { 124 | isplaying = false; 125 | 126 | if (!vthread && !athread) 127 | return; 128 | 129 | threadJoin(vthread, U64_MAX); 130 | threadFree(vthread); 131 | 132 | LightEvent_Signal(&soundEvent); 133 | threadJoin(athread, U64_MAX); 134 | threadFree(athread); 135 | 136 | vthread = NULL; 137 | athread = NULL; 138 | } 139 | 140 | static int isOgg(const char* filepath) { 141 | FILE* fp = fopen(filepath, "r"); 142 | char magic[16]; 143 | 144 | if (!fp) { 145 | printf("Could not open %s. Please make sure file exists.\n", filepath); 146 | return 0; 147 | } 148 | 149 | fseek(fp, 0, SEEK_SET); 150 | fread(magic, 1, 16, fp); 151 | fclose(fp); 152 | 153 | if (!strncmp(magic, "OggS", 4)) 154 | return 1; 155 | 156 | return 0; 157 | } 158 | 159 | static void changeFile(const char* filepath) { 160 | int ret = 0; 161 | 162 | if (vthread != NULL || athread != NULL) 163 | exitThread(); 164 | 165 | if (!isOgg(filepath)) { 166 | printf("The file is not an ogg file.\n"); 167 | return; 168 | } 169 | 170 | if ((ret = THEORA_Create(&vidCtx, filepath))) { 171 | printf("THEORA_Create exited with error, %d.\n", ret); 172 | return; 173 | } 174 | 175 | if (!THEORA_HasVideo(&vidCtx) && !THEORA_HasAudio(&vidCtx)) { 176 | printf("No audio or video stream could be found.\n"); 177 | return; 178 | } 179 | 180 | //printf("Theora Create sucessful.\n"); 181 | 182 | s32 prio; 183 | svcGetThreadPriority(&prio, CUR_THREAD_HANDLE); 184 | vthread = threadCreate(videoDecode_thread, NULL, 32 * 1024, prio-1, -1, false); 185 | } 186 | // end ripped code 187 | 188 | void PlayVideo(const char* fileName) { 189 | // de-init Retro Engine audio thread 190 | ReleaseAudioDevice(); 191 | ndspInit(); 192 | ndspSetCallback(audioCallback, NULL); 193 | //printf("Loading from %s\n", fileName); 194 | 195 | #if !RETRO_USING_C2D 196 | // using the software-rendered build; init Citro2D here 197 | gfxSetScreenFormat(GFX_TOP, GSP_BGR8_OES); 198 | 199 | C3D_Init(C3D_DEFAULT_CMDBUF_SIZE); 200 | C2D_Init(C2D_DEFAULT_MAX_OBJECTS); 201 | C2D_Prepare(); 202 | 203 | topScreen = C2D_CreateScreenTarget(GFX_TOP, GFX_LEFT); 204 | #else 205 | gfxSet3D(false); 206 | #endif 207 | 208 | changeFile(fileName); 209 | videodone = false; 210 | videoPlaying = true; 211 | } 212 | 213 | void CloseVideo() { 214 | printLog("video done, attempting to de-init"); 215 | exitThread(); 216 | 217 | // re-init Retro Engine audio thread 218 | ndspExit(); 219 | ndspInit(); 220 | InitAudioPlayback(); 221 | 222 | #if !RETRO_USING_C2D 223 | C2D_Fini(); 224 | C3D_Fini(); 225 | 226 | gfxSetScreenFormat(GFX_TOP, GSP_RGB565_OES); 227 | #else 228 | gfxSet3D(true); 229 | #endif 230 | } 231 | -------------------------------------------------------------------------------- /RSDKv3/3ds/video_3ds.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VIDEO_3DS_H 2 | #define VIDEO_3DS_H 3 | 4 | extern int isplaying; 5 | extern THEORA_Context vidCtx; 6 | extern TH3DS_Frame frame; 7 | extern float scaleframe; 8 | extern bool videodone; 9 | #if RETRO_RENDERTYPE == RETRO_SW_RENDER 10 | extern C3D_RenderTarget* topScreen; 11 | #endif 12 | void PlayVideo(const char* fileName); 13 | void CloseVideo(); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /RSDKv3/Animation.cpp: -------------------------------------------------------------------------------- 1 | #include "RetroEngine.hpp" 2 | 3 | AnimationFile animationFileList[ANIFILE_COUNT]; 4 | int animationFileCount = 0; 5 | 6 | SpriteFrame scriptFrames[SPRITEFRAME_COUNT]; 7 | int scriptFrameCount = 0; 8 | 9 | SpriteFrame animFrames[SPRITEFRAME_COUNT]; 10 | int animFrameCount = 0; 11 | SpriteAnimation animationList[ANIMATION_COUNT]; 12 | int animationCount = 0; 13 | Hitbox hitboxList[HITBOX_COUNT]; 14 | int hitboxCount = 0; 15 | 16 | void LoadAnimationFile(const char *filePath) 17 | { 18 | FileInfo info; 19 | if (LoadFile(filePath, &info)) { 20 | byte fileBuffer = 0; 21 | char strBuf[0x21]; 22 | byte sheetIDs[0x18]; 23 | sheetIDs[0] = 0; 24 | 25 | byte sheetCount = 0; 26 | FileRead(&sheetCount, 1); // Sheet Count 27 | 28 | //Read & load each spritesheet 29 | for (int s = 0; s < sheetCount; ++s) { 30 | FileRead(&fileBuffer, 1); 31 | if (fileBuffer) { 32 | int i = 0; 33 | for (; i < fileBuffer; ++i) FileRead(&strBuf[i], 1); 34 | strBuf[i] = 0; 35 | GetFileInfo(&info); 36 | CloseFile(); 37 | sheetIDs[s] = AddGraphicsFile(strBuf); 38 | SetFileInfo(&info); 39 | } 40 | } 41 | 42 | byte animCount = 0; 43 | FileRead(&animCount, 1); 44 | AnimationFile *animFile = &animationFileList[animationFileCount]; 45 | animFile->animCount = animCount; 46 | animFile->aniListOffset = animationCount; 47 | 48 | //Read animations 49 | for (int a = 0; a < animCount; ++a) { 50 | SpriteAnimation *anim = &animationList[animationCount++]; 51 | anim->frameListOffset = animFrameCount; 52 | FileRead(&fileBuffer, 1); 53 | FileRead(anim->name, fileBuffer); 54 | anim->name[fileBuffer] = 0; 55 | FileRead(&anim->frameCount, 1); 56 | FileRead(&anim->speed, 1); 57 | FileRead(&anim->loopPoint, 1); 58 | FileRead(&anim->rotationFlag, 1); 59 | 60 | for (int j = 0; j < anim->frameCount; ++j) { 61 | SpriteFrame *frame = &animFrames[animFrameCount++]; 62 | FileRead(&frame->sheetID, 1); 63 | frame->sheetID = sheetIDs[frame->sheetID]; 64 | FileRead(&frame->hitboxID, 1); 65 | FileRead(&fileBuffer, 1); 66 | frame->sprX = fileBuffer; 67 | FileRead(&fileBuffer, 1); 68 | frame->sprY = fileBuffer; 69 | FileRead(&fileBuffer, 1); 70 | frame->width = fileBuffer; 71 | FileRead(&fileBuffer, 1); 72 | frame->height = fileBuffer; 73 | 74 | sbyte buffer = 0; 75 | FileRead(&buffer, 1); 76 | frame->pivotX = buffer; 77 | FileRead(&buffer, 1); 78 | frame->pivotY = buffer; 79 | } 80 | // 90 Degree (Extra rotation Frames) rotation 81 | if (anim->rotationFlag == ROTFLAG_STATICFRAMES) 82 | anim->frameCount >>= 1; 83 | } 84 | 85 | //Read Hitboxes 86 | animFile->hitboxListOffset = hitboxCount; 87 | FileRead(&fileBuffer, 1); 88 | for (int i = 0; i < fileBuffer; ++i) { 89 | Hitbox *hitbox = &hitboxList[hitboxCount++]; 90 | for (int d = 0; d < HITBOX_DIR_COUNT; ++d) { 91 | FileRead(&hitbox->left[d], 1); 92 | FileRead(&hitbox->top[d], 1); 93 | FileRead(&hitbox->right[d], 1); 94 | FileRead(&hitbox->bottom[d], 1); 95 | } 96 | } 97 | 98 | CloseFile(); 99 | } 100 | } 101 | void ClearAnimationData() 102 | { 103 | for (int f = 0; f < SPRITEFRAME_COUNT; ++f) MEM_ZERO(scriptFrames[f]); 104 | for (int f = 0; f < SPRITEFRAME_COUNT; ++f) MEM_ZERO(animFrames[f]); 105 | for (int h = 0; h < HITBOX_COUNT; ++h) MEM_ZERO(hitboxList[h]); 106 | for (int a = 0; a < ANIMATION_COUNT; ++a) MEM_ZERO(animationList[a]); 107 | for (int a = 0; a < ANIFILE_COUNT; ++a) MEM_ZERO(animationFileList[a]); 108 | 109 | scriptFrameCount = 0; 110 | animFrameCount = 0; 111 | animationCount = 0; 112 | animationFileCount = 0; 113 | hitboxCount = 0; 114 | } 115 | 116 | AnimationFile *AddAnimationFile(const char *filePath) 117 | { 118 | char path[0x80]; 119 | StrCopy(path, "Data/Animations/"); 120 | StrAdd(path, filePath); 121 | 122 | //If matching anim is found return that, otherwise load a new anim 123 | for (int a = 0; a < 0x100; ++a) { 124 | if (StrLength(animationFileList[a].fileName) <= 0) { 125 | StrCopy(animationFileList[a].fileName, filePath); 126 | LoadAnimationFile(path); 127 | ++animationFileCount; 128 | return &animationFileList[a]; 129 | } 130 | if (StrComp(animationFileList[a].fileName, filePath)) 131 | return &animationFileList[a]; 132 | } 133 | return NULL; 134 | } 135 | 136 | void ProcessObjectAnimation(void *objScr, void *ent) 137 | { 138 | ObjectScript *objectScript = (ObjectScript *)objScr; 139 | Entity *entity = (Entity *)ent; 140 | SpriteAnimation *sprAnim = &animationList[objectScript->animFile->aniListOffset + entity->animation]; 141 | 142 | if (entity->animationSpeed <= 0) { 143 | entity->animationTimer += sprAnim->speed; 144 | } 145 | else { 146 | if (entity->animationSpeed > 0xF0) 147 | entity->animationSpeed = 0xF0; 148 | entity->animationTimer += entity->animationSpeed; 149 | } 150 | if (entity->animation != entity->prevAnimation) { 151 | entity->prevAnimation = entity->animation; 152 | entity->frame = 0; 153 | entity->animationTimer = 0; 154 | entity->animationSpeed = 0; 155 | } 156 | if (entity->animationTimer > 0xEF) { 157 | entity->animationTimer -= 0xF0; 158 | ++entity->frame; 159 | } 160 | 161 | if (entity->frame >= sprAnim->frameCount) 162 | entity->frame = sprAnim->loopPoint; 163 | } 164 | -------------------------------------------------------------------------------- /RSDKv3/Animation.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ANIMATION_H 2 | #define ANIMATION_H 3 | 4 | #define ANIFILE_COUNT (0x100) 5 | #define ANIMATION_COUNT (0x400) 6 | #define SPRITEFRAME_COUNT (0x1000) 7 | 8 | #define HITBOX_COUNT (0x20) 9 | #define HITBOX_DIR_COUNT (0x8) 10 | 11 | enum AnimrotationFlags { ROTFLAG_NONE, ROTFLAG_FULL, ROTFLAG_45DEG, ROTFLAG_STATICFRAMES }; 12 | 13 | struct AnimationFile 14 | { 15 | char fileName[0x20]; 16 | int animCount; 17 | int aniListOffset; 18 | int hitboxListOffset; 19 | }; 20 | 21 | struct SpriteAnimation { 22 | char name[16]; 23 | byte frameCount; 24 | byte speed; 25 | byte loopPoint; 26 | byte rotationFlag; 27 | int frameListOffset; 28 | }; 29 | 30 | struct SpriteFrame { 31 | int sprX; 32 | int sprY; 33 | int width; 34 | int height; 35 | int pivotX; 36 | int pivotY; 37 | byte sheetID; 38 | byte hitboxID; 39 | }; 40 | 41 | struct Hitbox { 42 | sbyte left[HITBOX_DIR_COUNT]; 43 | sbyte top[HITBOX_DIR_COUNT]; 44 | sbyte right[HITBOX_DIR_COUNT]; 45 | sbyte bottom[HITBOX_DIR_COUNT]; 46 | }; 47 | 48 | extern AnimationFile animationFileList[ANIFILE_COUNT]; 49 | extern int animationFileCount; 50 | 51 | extern SpriteFrame scriptFrames[SPRITEFRAME_COUNT]; 52 | extern int scriptFrameCount; 53 | 54 | extern SpriteFrame animFrames[SPRITEFRAME_COUNT]; 55 | extern int animFrameCount; 56 | extern SpriteAnimation animationList[ANIMATION_COUNT]; 57 | extern int animationCount; 58 | extern Hitbox hitboxList[HITBOX_COUNT]; 59 | extern int hitboxCount; 60 | 61 | void LoadAnimationFile(const char *FilePath); 62 | void ClearAnimationData(); 63 | 64 | AnimationFile *AddAnimationFile(const char *FilePath); 65 | 66 | inline AnimationFile *GetDefaultAnimationRef() { return &animationFileList[0]; } 67 | 68 | void ProcessObjectAnimation(void *objScr, void *ent); 69 | 70 | #endif // !ANIMATION_H 71 | -------------------------------------------------------------------------------- /RSDKv3/Collision.hpp: -------------------------------------------------------------------------------- 1 | #ifndef COLLISION_H 2 | #define COLLISION_H 3 | 4 | enum CollisionSidess { 5 | CSIDE_FLOOR = 0, 6 | CSIDE_LWALL = 1, 7 | CSIDE_RWALL = 2, 8 | CSIDE_ROOF = 3, 9 | }; 10 | 11 | enum CollisionModes { 12 | CMODE_FLOOR = 0, 13 | CMODE_LWALL = 1, 14 | CMODE_ROOF = 2, 15 | CMODE_RWALL = 3, 16 | }; 17 | 18 | enum CollisionSolidity { 19 | SOLID_ALL = 0, 20 | SOLID_TOP = 1, 21 | SOLID_LRB = 2, 22 | SOLID_NONE = 3, 23 | }; 24 | 25 | enum ObjectCollisionTypes { 26 | C_TOUCH = 0, 27 | C_BOX = 1, 28 | C_BOX2 = 2, 29 | C_PLATFORM = 3, 30 | }; 31 | 32 | struct CollisionSensor 33 | { 34 | int XPos; 35 | int YPos; 36 | int angle; 37 | bool collided; 38 | }; 39 | 40 | extern int collisionLeft; 41 | extern int collisionTop; 42 | extern int collisionRight; 43 | extern int collisionBottom; 44 | 45 | extern CollisionSensor sensors[6]; 46 | 47 | void FindFloorPosition(Player *player, CollisionSensor *sensor, int startYPos); 48 | void FindLWallPosition(Player *player, CollisionSensor *sensor, int startXPos); 49 | void FindRoofPosition(Player *player, CollisionSensor *sensor, int startYPos); 50 | void FindRWallPosition(Player *player, CollisionSensor *sensor, int startXPos); 51 | void FloorCollision(Player *player, CollisionSensor *sensor); 52 | void LWallCollision(Player *player, CollisionSensor *sensor); 53 | void RoofCollision(Player *player, CollisionSensor *sensor); 54 | void RWallCollision(Player *player, CollisionSensor *sensor); 55 | void SetPathGripSensors(Player *player); 56 | 57 | void ProcessPathGrip(Player *player); 58 | void ProcessAirCollision(Player *player); 59 | 60 | void ProcessPlayerTileCollisions(Player *player); 61 | 62 | void TouchCollision(int left, int top, int right, int bottom); 63 | void BoxCollision(int left, int top, int right, int bottom); // Standard 64 | void BoxCollision2(int left, int top, int right, int bottom); // Updated (?) 65 | void PlatformCollision(int left, int top, int right, int bottom); 66 | 67 | void ObjectFloorCollision(int xOffset, int yOffset, int cPath); 68 | void ObjectLWallCollision(int xOffset, int yOffset, int cPath); 69 | void ObjectRoofCollision(int xOffset, int yOffset, int cPath); 70 | void ObjectRWallCollision(int xOffset, int yOffset, int cPath); 71 | 72 | void ObjectFloorGrip(int xOffset, int yOffset, int cPath); 73 | void ObjectLWallGrip(int xOffset, int yOffset, int cPath); 74 | void ObjectRoofGrip(int xOffset, int yOffset, int cPath); 75 | void ObjectRWallGrip(int xOffset, int yOffset, int cPath); 76 | 77 | #endif // !COLLISION_H 78 | -------------------------------------------------------------------------------- /RSDKv3/Debug.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DEBUG_H 2 | #define DEBUG_H 3 | 4 | #if RETRO_PLATFORM == RETRO_ANDROID 5 | #include 6 | #endif 7 | 8 | inline void printLog(const char *msg, ...) 9 | { 10 | if (engineDebugMode) { 11 | char buffer[0x100]; 12 | 13 | // make the full string 14 | va_list args; 15 | va_start(args, msg); 16 | vsprintf(buffer, msg, args); 17 | printf("%s\n", buffer); 18 | sprintf(buffer, "%s\n", buffer); 19 | 20 | char pathBuffer[0x100]; 21 | #if RETRO_PLATFORM == RETRO_OSX || RETRO_PLATFORM == RETRO_UWP 22 | if (!usingCWD) 23 | sprintf(pathBuffer, "%s/log.txt", getResourcesPath()); 24 | else 25 | sprintf(pathBuffer, "log.txt"); 26 | #elif RETRO_PLATFORM == RETRO_ANDROID 27 | sprintf(pathBuffer, "%s/log.txt", gamePath); 28 | __android_log_print(ANDROID_LOG_INFO, "RSDKv4", "%s", buffer); 29 | #else 30 | sprintf(pathBuffer, BASE_PATH"log.txt"); 31 | #endif 32 | FileIO *file = fOpen(pathBuffer, "a"); 33 | if (file) { 34 | fWrite(&buffer, 1, StrLength(buffer), file); 35 | fClose(file); 36 | } 37 | } 38 | } 39 | 40 | enum DevMenuMenus { 41 | DEVMENU_MAIN, 42 | DEVMENU_PLAYERSEL, 43 | DEVMENU_STAGELISTSEL, 44 | DEVMENU_STAGESEL, 45 | DEVMENU_SCRIPTERROR, 46 | DEVMENU_MODMENU, 47 | }; 48 | 49 | void initDevMenu(); 50 | void initErrorMessage(); 51 | void processStageSelect(); 52 | 53 | #endif //!DEBUG_H 54 | -------------------------------------------------------------------------------- /RSDKv3/Drawing.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/RSDKv3/Drawing.cpp -------------------------------------------------------------------------------- /RSDKv3/Drawing.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DRAWING_H 2 | #define DRAWING_H 3 | 4 | #define SPRITESHEETS_MAX (16) 5 | #define SURFACE_MAX (24) 6 | #define GFXDATA_MAX (0x400000) 7 | 8 | #define BLENDTABLE_YSIZE (0x100) 9 | #define BLENDTABLE_XSIZE (0x20) 10 | #define BLENDTABLE_SIZE (BLENDTABLE_XSIZE * BLENDTABLE_YSIZE) 11 | #define TINTTABLE_SIZE (0x1000) 12 | 13 | #define DRAWLAYER_COUNT (0x7) 14 | 15 | enum FlipFlags { FLIP_NO, FLIP_X, FLIP_Y, FLIP_XY }; 16 | enum InkFlags { INK_NONE, INK_BLEND, INK_ALPHA, INK_ADD, INK_SUB }; 17 | enum DrawFXFlags { FX_SCALE, FX_ROTATE, FX_ROTOZOOM, FX_INK, FX_TINT, FX_FLIP }; 18 | 19 | struct DrawListEntry 20 | { 21 | int entityRefs[ENTITY_COUNT]; 22 | int listSize; 23 | }; 24 | 25 | struct GFXSurface 26 | { 27 | char fileName[0x40]; 28 | int height; 29 | int width; 30 | int widthShift; 31 | int depth; 32 | int dataPosition; 33 | }; 34 | 35 | extern short blendLookupTable[BLENDTABLE_SIZE]; 36 | extern short subtractLookupTable[BLENDTABLE_SIZE]; 37 | extern short tintLookupTable[TINTTABLE_SIZE]; 38 | 39 | extern int SCREEN_XSIZE; 40 | extern int SCREEN_CENTERX; 41 | 42 | extern float videoAR; 43 | extern bool videoPlaying; 44 | 45 | extern DrawListEntry drawListEntries[DRAWLAYER_COUNT]; 46 | 47 | extern int gfxDataPosition; 48 | extern GFXSurface gfxSurface[SURFACE_MAX]; 49 | extern byte graphicData[GFXDATA_MAX]; 50 | 51 | int InitRenderDevice(); 52 | void RenderRenderDevice(); 53 | void ReleaseRenderDevice(); 54 | 55 | void GenerateBlendLookupTable(); 56 | 57 | inline void ClearGraphicsData() 58 | { 59 | for (int i = 0; i < SURFACE_MAX; ++i) StrCopy(gfxSurface[i].fileName, ""); 60 | gfxDataPosition = 0; 61 | } 62 | void ClearScreen(byte index); 63 | 64 | void SetScreenSize(int width, int height); 65 | void CopyFrameOverlay2x(); 66 | 67 | // Layer Drawing 68 | void DrawObjectList(int layer); 69 | void DrawStageGFX(); 70 | 71 | // TileLayer Drawing 72 | void DrawHLineScrollLayer(int layerID); 73 | void DrawVLineScrollLayer(int layerID); 74 | void Draw3DFloorLayer(int layerID); 75 | void Draw3DSkyLayer(int layerID); 76 | 77 | // Shape Drawing 78 | void DrawRectangle(int XPos, int YPos, int width, int height, int R, int G, int B, int A); 79 | void SetFadeHQ(int R, int G, int B, int A); 80 | void DrawTintRectangle(int XPos, int YPos, int width, int height); 81 | void DrawScaledTintMask(int direction, int XPos, int YPos, int pivotX, int pivotY, int scaleX, 82 | int scaleY, int width, int height, int sprX, int sprY, int sheetID); 83 | 84 | // Sprite Drawing 85 | void DrawSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int sheetID); 86 | void DrawSpriteFlipped(int XPos, int YPos, int width, int height, int sprX, int sprY, int direction, 87 | int sheetID); 88 | void DrawSpriteScaled(int direction, int XPos, int YPos, int pivotX, int pivotY, int scaleX, int scaleY, 89 | int width, int height, int sprX, int sprY, int sheetID); 90 | void DrawSpriteRotated(int direction, int XPos, int YPos, int pivotX, int pivotY, int sprX, int sprY, 91 | int width, int height, int rotation, int sheetID); 92 | void DrawSpriteRotozoom(int direction, int XPos, int YPos, int pivotX, int pivotY, int sprX, int sprY, 93 | int width, int height, int rotation, int scale, int sheetID); 94 | 95 | void DrawBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int sheetID); 96 | void DrawAlphaBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int alpha, 97 | int sheetID); 98 | void DrawAdditiveBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int alpha, 99 | int sheetID); 100 | void DrawSubtractiveBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, 101 | int alpha, int sheetID); 102 | 103 | void DrawObjectAnimation(void *objScr, void *ent, int XPos, int YPos); 104 | 105 | void DrawFace(void *v, uint colour); 106 | void DrawTexturedFace(void *v, byte sheetID); 107 | 108 | void DrawBitmapText(void *menu, int XPos, int YPos, int scale, int spacing, int rowStart, int rowCount); 109 | 110 | void DrawTextMenu(void *menu, int XPos, int YPos); 111 | void DrawTextMenuEntry(void *menu, int rowID, int XPos, int YPos, int textHighlight); 112 | void DrawStageTextEntry(void *menu, int rowID, int XPos, int YPos, int textHighlight); 113 | void DrawBlendedTextMenuEntry(void *menu, int rowID, int XPos, int YPos, int textHighlight); 114 | void DrawBitmapText(void *menu, int XPos, int YPos, int scale, int spacing, int rowStart, int rowCount); 115 | 116 | #endif // !DRAWING_H 117 | -------------------------------------------------------------------------------- /RSDKv3/Ini.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INI_H 2 | #define INI_H 3 | 4 | #include 5 | 6 | class IniParser 7 | { 8 | public: 9 | enum ItemType { 10 | INI_ITEM_STRING, 11 | INI_ITEM_INT, 12 | INI_ITEM_FLOAT, 13 | INI_ITEM_BOOL, 14 | INI_ITEM_COMMENT, 15 | }; 16 | 17 | struct ConfigItem { 18 | ConfigItem() 19 | { 20 | sprintf(section, "%s", ""); 21 | sprintf(key, "%s", ""); 22 | sprintf(value, "%s", ""); 23 | hasSection = false; 24 | type = INI_ITEM_STRING; 25 | } 26 | char section[0x20]; 27 | bool hasSection = false; 28 | char key[0x40]; 29 | char value[0x100]; 30 | byte type = INI_ITEM_STRING; 31 | }; 32 | 33 | IniParser() { items.clear(); } 34 | IniParser(const char *filename, bool addPath = true); 35 | 36 | int GetString(const char *section, const char *key, char *dest); 37 | int GetInteger(const char *section, const char *key, int *dest); 38 | int GetFloat(const char *section, const char *key, float *dest); 39 | int GetBool(const char *section, const char *key, bool *dest); 40 | int SetString(const char *section, const char *key, char *value); 41 | int SetInteger(const char *section, const char *key, int value); 42 | int SetFloat(const char *section, const char *key, float value); 43 | int SetBool(const char *section, const char *key, bool value); 44 | int SetComment(const char *section, const char *key, const char *comment); 45 | void Write(const char *filename, bool addPath = true); 46 | 47 | std::vector items; 48 | }; 49 | #endif // !INI_H 50 | -------------------------------------------------------------------------------- /RSDKv3/Input.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INPUT_H 2 | #define INPUT_H 3 | 4 | enum InputButtons { 5 | INPUT_UP, 6 | INPUT_DOWN, 7 | INPUT_LEFT, 8 | INPUT_RIGHT, 9 | INPUT_BUTTONA, 10 | INPUT_BUTTONB, 11 | INPUT_BUTTONC, 12 | INPUT_START, 13 | INPUT_ANY, 14 | INPUT_MAX, 15 | }; 16 | 17 | struct InputData { 18 | bool up; 19 | bool down; 20 | bool left; 21 | bool right; 22 | bool A; 23 | bool B; 24 | bool C; 25 | bool start; 26 | }; 27 | 28 | #if RETRO_PLATFORM == RETRO_3DS 29 | const unsigned int _3DSKeys[8] = { 30 | KEY_UP, 31 | KEY_DOWN, 32 | KEY_LEFT, 33 | KEY_RIGHT, 34 | KEY_A, 35 | KEY_B, 36 | KEY_Y, 37 | KEY_START 38 | }; 39 | const int keyCount = 8; 40 | #endif 41 | 42 | struct InputButton { 43 | bool press, hold; 44 | int keyMappings, contMappings; 45 | 46 | inline void setHeld() 47 | { 48 | press = !hold; 49 | hold = true; 50 | } 51 | inline void setReleased() 52 | { 53 | press = false; 54 | hold = false; 55 | } 56 | 57 | inline bool down() { return (press || hold); } 58 | }; 59 | 60 | extern InputData keyPress; 61 | extern InputData keyDown; 62 | 63 | extern bool anyPress; 64 | 65 | extern int touchDown[8]; 66 | extern int touchX[8]; 67 | extern int touchY[8]; 68 | extern int touchID[8]; 69 | extern int touches; 70 | 71 | extern InputButton inputDevice[INPUT_MAX]; 72 | extern int inputType; 73 | 74 | extern int LSTICK_DEADZONE; 75 | extern int RSTICK_DEADZONE; 76 | extern int LTRIGGER_DEADZONE; 77 | extern int RTRIGGER_DEADZONE; 78 | 79 | #if RETRO_USING_SDL2 80 | extern SDL_GameController *controller; 81 | 82 | // Easier this way 83 | enum ExtraSDLButtons { 84 | SDL_CONTROLLER_BUTTON_ZL = SDL_CONTROLLER_BUTTON_MAX + 1, 85 | SDL_CONTROLLER_BUTTON_ZR, 86 | SDL_CONTROLLER_BUTTON_LSTICK_UP, 87 | SDL_CONTROLLER_BUTTON_LSTICK_DOWN, 88 | SDL_CONTROLLER_BUTTON_LSTICK_LEFT, 89 | SDL_CONTROLLER_BUTTON_LSTICK_RIGHT, 90 | SDL_CONTROLLER_BUTTON_RSTICK_UP, 91 | SDL_CONTROLLER_BUTTON_RSTICK_DOWN, 92 | SDL_CONTROLLER_BUTTON_RSTICK_LEFT, 93 | SDL_CONTROLLER_BUTTON_RSTICK_RIGHT, 94 | SDL_CONTROLLER_BUTTON_MAX_EXTRA, 95 | }; 96 | 97 | inline void controllerInit(byte controllerID) 98 | { 99 | inputType = 1; 100 | controller = SDL_GameControllerOpen(controllerID); 101 | }; 102 | 103 | inline void controllerClose(byte controllerID) 104 | { 105 | if (controllerID >= 2) 106 | return; 107 | inputType = 0; 108 | } 109 | #endif 110 | 111 | #if RETRO_USING_SDL1 112 | extern byte keyState[SDLK_LAST]; 113 | 114 | extern SDL_Joystick *controller; 115 | #endif 116 | 117 | void ProcessInput(); 118 | 119 | void CheckKeyPress(InputData *input, byte Flags); 120 | void CheckKeyDown(InputData *input, byte Flags); 121 | 122 | void QueueHapticEffect(int hapticID); 123 | 124 | #endif // !INPUT_H 125 | -------------------------------------------------------------------------------- /RSDKv3/Math.cpp: -------------------------------------------------------------------------------- 1 | #include "RetroEngine.hpp" 2 | #include 3 | 4 | #ifndef M_PI 5 | #define M_PI 3.14159265358979323846264338327950288 6 | #endif 7 | 8 | int sinM[512]; 9 | int cosM[512]; 10 | 11 | int sinVal512[512]; 12 | int cosVal512[512]; 13 | 14 | int sinVal256[256]; 15 | int cosVal256[256]; 16 | 17 | byte atanVal256[0x100 * 0x100]; 18 | 19 | void CalculateTrigAngles() 20 | { 21 | for (int i = 0; i < 0x200; ++i) { 22 | float Val = sin(((float)i / 256.0) * M_PI); 23 | sinM[i] = (Val * 4096.0); 24 | Val = cos(((float)i / 256.0) * M_PI); 25 | cosM[i] = (Val * 4096.0); 26 | } 27 | 28 | cosM[0] = 4096; 29 | cosM[128] = 0; 30 | cosM[256] = -4096; 31 | cosM[384] = 0; 32 | sinM[0] = 0; 33 | sinM[128] = 4096; 34 | sinM[256] = 0; 35 | sinM[384] = -4096; 36 | 37 | for (int i = 0; i < 0x200; ++i) { 38 | float Val = sinf(((float)i / 256) * M_PI); 39 | sinVal512[i] = (signed int)(Val * 512.0); 40 | Val = cosf(((float)i / 256) * M_PI); 41 | cosVal512[i] = (signed int)(Val * 512.0); 42 | } 43 | 44 | cosVal512[0] = 0x200; 45 | cosVal512[128] = 0; 46 | cosVal512[256] = -0x200; 47 | cosVal512[384] = 0; 48 | sinVal512[0] = 0; 49 | sinVal512[128] = 0x200; 50 | sinVal512[256] = 0; 51 | sinVal512[384] = -0x200; 52 | 53 | for (int i = 0; i < 0x100; i++) { 54 | sinVal256[i] = (sinVal512[i * 2] >> 1); 55 | cosVal256[i] = (cosVal512[i * 2] >> 1); 56 | } 57 | 58 | for (int Y = 0; Y < 0x100; ++Y) { 59 | byte *ATan = (byte *)&atanVal256[Y]; 60 | for (int X = 0; X < 0x100; ++X) { 61 | float angle = atan2f(Y, X); 62 | *ATan = (signed int)(angle * 40.743664f); 63 | ATan += 0x100; 64 | } 65 | } 66 | } 67 | 68 | byte ArcTanLookup(int X, int Y) 69 | { 70 | int XVal; 71 | byte result = 0; 72 | int YVal; 73 | 74 | if (X >= 0) 75 | XVal = X; 76 | else 77 | XVal = -X; 78 | 79 | if (Y >= 0) 80 | YVal = Y; 81 | else 82 | YVal = -Y; 83 | 84 | if (XVal <= YVal) { 85 | while (YVal > 0xFF) { 86 | XVal >>= 4; 87 | YVal >>= 4; 88 | } 89 | } 90 | else { 91 | while (XVal > 0xFF) { 92 | XVal >>= 4; 93 | YVal >>= 4; 94 | } 95 | } 96 | if (X <= 0) { 97 | if (Y <= 0) 98 | result = atanVal256[0x100 * XVal + YVal] + -0x80; 99 | else 100 | result = -0x80 - atanVal256[0x100 * XVal + YVal]; 101 | } 102 | else if (Y <= 0) 103 | result = -atanVal256[0x100 * XVal + YVal]; 104 | else 105 | result = atanVal256[0x100 * XVal + YVal]; 106 | return result; 107 | } -------------------------------------------------------------------------------- /RSDKv3/Math.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MATH_H 2 | #define MATH_H 3 | 4 | //#define M_PI (3.1415927) 5 | 6 | #define MEM_ZERO(x) memset(&(x), 0, sizeof((x))) 7 | #define MEM_ZEROP(x) memset((x), 0, sizeof(*(x))) 8 | 9 | extern int sinM[0x200]; 10 | extern int cosM[0x200]; 11 | 12 | extern int sinVal512[0x200]; 13 | extern int cosVal512[0x200]; 14 | 15 | extern int sinVal256[0x100]; 16 | extern int cosVal256[0x100]; 17 | 18 | extern byte atanVal256[0x100 * 0x100]; 19 | 20 | // Setup Angles 21 | void CalculateTrigAngles(); 22 | 23 | inline int sin512(int angle) { 24 | if (angle < 0) 25 | angle = 0x200 - angle; 26 | angle &= 0x1FFu; 27 | return sinVal512[angle]; 28 | } 29 | 30 | inline int cos512(int angle) 31 | { 32 | if (angle < 0) 33 | angle = 0x200 - angle; 34 | angle &= 0x1FFu; 35 | return cosVal512[angle]; 36 | } 37 | 38 | inline int sin256(int angle) 39 | { 40 | if (angle < 0) 41 | angle = 0x100 - angle; 42 | angle &= 0xFFu; 43 | return sinVal256[angle]; 44 | } 45 | 46 | inline int cos256(int angle) 47 | { 48 | if (angle < 0) 49 | angle = 0x100 - angle; 50 | angle &= 0xFFu; 51 | return cosVal256[angle]; 52 | } 53 | 54 | // Get Arc Tan value 55 | byte ArcTanLookup(int X, int Y); 56 | 57 | #endif // !MATH_H 58 | -------------------------------------------------------------------------------- /RSDKv3/Object.cpp: -------------------------------------------------------------------------------- 1 | #include "RetroEngine.hpp" 2 | 3 | int objectLoop = 0; 4 | int curObjectType = 0; 5 | Entity objectEntityList[ENTITY_COUNT]; 6 | 7 | char typeNames[OBJECT_COUNT][0x40]; 8 | 9 | int OBJECT_BORDER_X1 = 0x80; 10 | int OBJECT_BORDER_X2 = 0; 11 | const int OBJECT_BORDER_Y1 = 0x100; 12 | const int OBJECT_BORDER_Y2 = SCREEN_YSIZE + 0x100; 13 | 14 | void SetObjectTypeName(const char *objectName, int objectID) 15 | { 16 | int objNameID = 0; 17 | int typeNameID = 0; 18 | while (objectName[objNameID]) { 19 | if (objectName[objNameID] != ' ') 20 | typeNames[objectID][typeNameID++] = objectName[objNameID]; 21 | ++objNameID; 22 | } 23 | typeNames[objectID][typeNameID] = 0; 24 | printLog("Set Object (%d) name to: %s", objectID, objectName); 25 | } 26 | 27 | void ProcessStartupObjects() 28 | { 29 | scriptFrameCount = 0; 30 | ClearAnimationData(); 31 | activePlayer = 0; 32 | activePlayerCount = 1; 33 | scriptEng.arrayPosition[2] = TEMPENTITY_START; 34 | Entity *entity = &objectEntityList[TEMPENTITY_START]; 35 | for (int i = 0; i < OBJECT_COUNT; ++i) { 36 | ObjectScript *scriptInfo = &objectScriptList[i]; 37 | objectLoop = TEMPENTITY_START; 38 | curObjectType = i; 39 | scriptInfo->frameListOffset = scriptFrameCount; 40 | scriptInfo->spriteSheetID = 0; 41 | entity->type = i; 42 | if (scriptData[scriptInfo->subStartup.scriptCodePtr] > 0) 43 | ProcessScript(scriptInfo->subStartup.scriptCodePtr, scriptInfo->subStartup.jumpTablePtr, SUB_SETUP); 44 | scriptInfo->frameCount = scriptFrameCount - scriptInfo->frameListOffset; 45 | } 46 | entity->type = 0; 47 | curObjectType = 0; 48 | } 49 | 50 | void ProcessObjects() 51 | { 52 | for (int i = 0; i < DRAWLAYER_COUNT; ++i) drawListEntries[i].listSize = 0; 53 | 54 | for (objectLoop = 0; objectLoop < ENTITY_COUNT; ++objectLoop) { 55 | bool active = false; 56 | int x = 0, y = 0; 57 | Entity *entity = &objectEntityList[objectLoop]; 58 | switch (entity->priority) { 59 | case PRIORITY_ACTIVE_BOUNDS: 60 | x = entity->XPos >> 16; 61 | y = entity->YPos >> 16; 62 | active = x > xScrollOffset - OBJECT_BORDER_X1 && x < OBJECT_BORDER_X2 + xScrollOffset 63 | && y > yScrollOffset - OBJECT_BORDER_Y1 && y < yScrollOffset + OBJECT_BORDER_Y2; 64 | break; 65 | case PRIORITY_ACTIVE: active = true; break; 66 | case PRIORITY_ACTIVE_PAUSED: active = true; break; 67 | case PRIORITY_ACTIVE_XBOUNDS: 68 | x = entity->XPos >> 16; 69 | active = x > xScrollOffset - OBJECT_BORDER_X1 && x < OBJECT_BORDER_X2 + xScrollOffset; 70 | break; 71 | case PRIORITY_ACTIVE_BOUNDS_REMOVE: 72 | x = entity->XPos >> 16; 73 | y = entity->YPos >> 16; 74 | if (x <= xScrollOffset - OBJECT_BORDER_X1 || x >= OBJECT_BORDER_X2 + xScrollOffset 75 | || y <= yScrollOffset - OBJECT_BORDER_Y1 || y >= yScrollOffset + OBJECT_BORDER_Y2) { 76 | active = false; 77 | entity->type = OBJ_TYPE_BLANKOBJECT; 78 | } 79 | else { 80 | active = true; 81 | } 82 | break; 83 | case PRIORITY_INACTIVE: active = false; break; 84 | default: break; 85 | } 86 | if (active && entity->type > OBJ_TYPE_BLANKOBJECT) { 87 | ObjectScript *scriptInfo = &objectScriptList[entity->type]; 88 | activePlayer = 0; 89 | if (scriptData[scriptInfo->subMain.scriptCodePtr] > 0) 90 | ProcessScript(scriptInfo->subMain.scriptCodePtr, scriptInfo->subMain.jumpTablePtr, SUB_MAIN); 91 | if (scriptData[scriptInfo->subPlayerInteraction.scriptCodePtr] > 0) { 92 | while (activePlayer < activePlayerCount) { 93 | if (playerList[activePlayer].objectInteractions) 94 | ProcessScript(scriptInfo->subPlayerInteraction.scriptCodePtr, scriptInfo->subPlayerInteraction.jumpTablePtr, 95 | SUB_PLAYERINTERACTION); 96 | ++activePlayer; 97 | } 98 | } 99 | 100 | if (entity->drawOrder < DRAWLAYER_COUNT) 101 | drawListEntries[entity->drawOrder].entityRefs[drawListEntries[entity->drawOrder].listSize++] = objectLoop; 102 | } 103 | } 104 | } 105 | 106 | void ProcessPausedObjects() 107 | { 108 | for (int i = 0; i < DRAWLAYER_COUNT; ++i) drawListEntries[i].listSize = 0; 109 | 110 | for (objectLoop = 0; objectLoop < ENTITY_COUNT; ++objectLoop) { 111 | Entity *entity = &objectEntityList[objectLoop]; 112 | 113 | if (entity->priority == PRIORITY_ACTIVE_PAUSED && entity->type > OBJ_TYPE_BLANKOBJECT) { 114 | ObjectScript *scriptInfo = &objectScriptList[entity->type]; 115 | activePlayer = 0; 116 | if (scriptData[scriptInfo->subMain.scriptCodePtr] > 0) 117 | ProcessScript(scriptInfo->subMain.scriptCodePtr, scriptInfo->subMain.jumpTablePtr, SUB_MAIN); 118 | if (scriptData[scriptInfo->subPlayerInteraction.scriptCodePtr] > 0) { 119 | while (activePlayer < PLAYER_COUNT) { 120 | if (playerList[activePlayer].objectInteractions) 121 | ProcessScript(scriptInfo->subPlayerInteraction.scriptCodePtr, scriptInfo->subPlayerInteraction.jumpTablePtr, 122 | SUB_PLAYERINTERACTION); 123 | ++activePlayer; 124 | } 125 | } 126 | 127 | if (entity->drawOrder < DRAWLAYER_COUNT) 128 | drawListEntries[entity->drawOrder].entityRefs[drawListEntries[entity->drawOrder].listSize++] = objectLoop; 129 | } 130 | } 131 | } -------------------------------------------------------------------------------- /RSDKv3/Object.hpp: -------------------------------------------------------------------------------- 1 | #ifndef OBJECT_H 2 | #define OBJECT_H 3 | 4 | #define ENTITY_COUNT (0x4A0) 5 | #define TEMPENTITY_START (ENTITY_COUNT - 0x80) 6 | #define OBJECT_COUNT (0x100) 7 | 8 | struct Entity { 9 | int XPos; 10 | int YPos; 11 | int values[8]; 12 | int scale; 13 | int rotation; 14 | int animationTimer; 15 | int animationSpeed; 16 | byte type; 17 | byte propertyValue; 18 | byte state; 19 | byte priority; 20 | byte drawOrder; 21 | byte direction; 22 | byte inkEffect; 23 | byte alpha; 24 | byte animation; 25 | byte prevAnimation; 26 | byte frame; 27 | }; 28 | 29 | enum ObjectTypes { 30 | OBJ_TYPE_BLANKOBJECT = 0 //0 is always blank obj 31 | }; 32 | 33 | enum ObjectPriority { 34 | PRIORITY_ACTIVE_BOUNDS, 35 | PRIORITY_ACTIVE, 36 | PRIORITY_ACTIVE_PAUSED, 37 | PRIORITY_ACTIVE_XBOUNDS, 38 | PRIORITY_ACTIVE_BOUNDS_REMOVE, 39 | PRIORITY_INACTIVE, 40 | }; 41 | 42 | extern int objectLoop; 43 | extern int curObjectType; 44 | extern Entity objectEntityList[ENTITY_COUNT]; 45 | 46 | extern char typeNames[OBJECT_COUNT][0x40]; 47 | 48 | extern int OBJECT_BORDER_X1; 49 | extern int OBJECT_BORDER_X2; 50 | extern const int OBJECT_BORDER_Y1; 51 | extern const int OBJECT_BORDER_Y2; 52 | 53 | void ProcessStartupObjects(); 54 | void ProcessObjects(); 55 | void ProcessPausedObjects(); 56 | 57 | void SetObjectTypeName(const char *objectName, int objectID); 58 | 59 | #endif // !OBJECT_H 60 | -------------------------------------------------------------------------------- /RSDKv3/Palette.cpp: -------------------------------------------------------------------------------- 1 | #include "RetroEngine.hpp" 2 | 3 | // Palettes (as RGB888 Colours) 4 | PaletteEntry fullPalette32[PALETTE_COUNT][PALETTE_SIZE]; 5 | PaletteEntry *activePalette32 = fullPalette32[0]; 6 | 7 | // Palettes (as RGB565 Colours) 8 | ushort fullPalette[PALETTE_COUNT][PALETTE_SIZE]; 9 | ushort *activePalette = fullPalette[0]; // Ptr to the 256 colour set thats active 10 | 11 | byte gfxLineBuffer[SCREEN_YSIZE]; // Pointers to active palette 12 | 13 | int fadeMode = 0; 14 | byte fadeA = 0; 15 | byte fadeR = 0; 16 | byte fadeG = 0; 17 | byte fadeB = 0; 18 | 19 | int paletteMode = 0; 20 | 21 | #if RETRO_HARDWARE_RENDER 22 | int texPaletteNum = 0; 23 | #endif 24 | 25 | void LoadPalette(const char *filePath, int paletteID, int startPaletteIndex, int startIndex, int endIndex) 26 | { 27 | FileInfo info; 28 | char fullPath[0x80]; 29 | 30 | StrCopy(fullPath, "Data/Palettes/"); 31 | StrAdd(fullPath, filePath); 32 | 33 | if (LoadFile(fullPath, &info)) { 34 | SetFilePosition(3 * startIndex); 35 | if (paletteID >= PALETTE_COUNT || paletteID < 0) 36 | paletteID = 0; 37 | 38 | byte colour[3]; 39 | if (paletteID) { 40 | for (int i = startIndex; i < endIndex; ++i) { 41 | FileRead(&colour, 3); 42 | SetPaletteEntry(paletteID, startPaletteIndex++, colour[0], colour[1], colour[2]); 43 | } 44 | } 45 | else { 46 | for (int i = startIndex; i < endIndex; ++i) { 47 | FileRead(&colour, 3); 48 | SetPaletteEntry(-1, startPaletteIndex++, colour[0], colour[1], colour[2]); 49 | } 50 | } 51 | CloseFile(); 52 | } 53 | } 54 | 55 | void SetLimitedFade(byte paletteID, byte R, byte G, byte B, ushort alpha, int startIndex, int endIndex) 56 | { 57 | if (paletteID >= PALETTE_COUNT) 58 | return; 59 | paletteMode = 1; 60 | activePalette = fullPalette[paletteID]; 61 | activePalette32 = fullPalette32[paletteID]; 62 | 63 | if (alpha >= PALETTE_SIZE) { 64 | alpha = PALETTE_SIZE - 1; 65 | } 66 | 67 | if (startIndex >= endIndex) 68 | return; 69 | 70 | uint alpha2 = 0xFF - alpha; 71 | for (int i = startIndex; i < endIndex; ++i) { 72 | activePalette[i] = PACK_RGB888((byte)((ushort)(R * alpha + alpha2 * activePalette32[i].r) >> 8), 73 | (byte)((ushort)(G * alpha + alpha2 * activePalette32[i].g) >> 8), 74 | (byte)((ushort)(B * alpha + alpha2 * activePalette32[i].b) >> 8)); 75 | activePalette32[i].r = (byte)((ushort)(R * alpha + alpha2 * activePalette32[i].r) >> 8); 76 | activePalette32[i].g = (byte)((ushort)(G * alpha + alpha2 * activePalette32[i].g) >> 8); 77 | activePalette32[i].b = (byte)((ushort)(B * alpha + alpha2 * activePalette32[i].b) >> 8); 78 | #if RETRO_HARDWARE_RENDER 79 | activePalette[i] |= 1; 80 | #endif 81 | } 82 | } -------------------------------------------------------------------------------- /RSDKv3/Palette.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PALETTE_H 2 | #define PALETTE_H 3 | 4 | #define PALETTE_COUNT (0x8) 5 | #define PALETTE_SIZE (0x100) 6 | 7 | struct Colour { 8 | byte r; 9 | byte g; 10 | byte b; 11 | byte a; 12 | }; 13 | 14 | struct PaletteEntry { 15 | byte r; 16 | byte g; 17 | byte b; 18 | }; 19 | 20 | // Palettes (as RGB565 Colours) 21 | extern PaletteEntry fullPalette32[PALETTE_COUNT][PALETTE_SIZE]; 22 | extern ushort fullPalette[PALETTE_COUNT][PALETTE_SIZE]; 23 | extern ushort *activePalette; // Ptr to the 256 colour set thats active 24 | extern PaletteEntry *activePalette32; 25 | 26 | extern byte gfxLineBuffer[SCREEN_YSIZE]; // Pointers to active palette 27 | 28 | extern int fadeMode; 29 | extern byte fadeA; 30 | extern byte fadeR; 31 | extern byte fadeG; 32 | extern byte fadeB; 33 | 34 | extern int paletteMode; 35 | 36 | #if RETRO_HARDWARE_RENDER 37 | extern int texPaletteNum; 38 | #endif 39 | 40 | // https://github.com/bubble2k16/snes9x_3ds/blob/3e5cdba3577aafefb0860966a3daf694ece8e168/source/pixform.h#L248 41 | #define BUILD_PIXEL_RGB5551(R,G,B) (((int) (R) << 11) | ((int) (G) << 6) | (int) ((B) << 1) | 1) 42 | #define CONV(px) (BUILD_PIXEL_RGB5551( (px & 0xf800) >> 11, (px & 0x07e0) >> 6, (px & 0x001f))) 43 | 44 | #define RGB888_TO_RGB5551(r, g, b) ((((b) >> 3) << 1) | ((g) >> 3 << 6) | ((r) >> 3 << 11) | 0) // used in mobile vers 45 | #define RGB888_TO_RGB565(r, g, b) ((b) >> 3) | (((g) >> 2) << 5) | (((r) >> 3) << 11) // used in pc vers 46 | 47 | #if RETRO_SOFTWARE_RENDER || RETRO_PLATFORM == RETRO_3DS // my hardware renderer relied on the original graphic data being in RGB565 48 | // probably not the best practice in retrospect 49 | #define PACK_RGB888(r, g, b) RGB888_TO_RGB565(r, g, b) 50 | #elif RETRO_HARDWARE_RENDER && !RETRO_USING_C2D 51 | #define PACK_RGB888(r, g, b) RGB888_TO_RGB5551(r, g, b) 52 | #endif 53 | 54 | void LoadPalette(const char *filePath, int paletteID, int startPaletteIndex, int startIndex, int endIndex); 55 | 56 | inline void SetActivePalette(byte newActivePal, int startLine, int endLine) 57 | { 58 | #if RETRO_SOFTWARE_RENDER 59 | if (newActivePal < PALETTE_COUNT) 60 | for (int l = startLine; l < endLine && l < SCREEN_YSIZE; l++) gfxLineBuffer[l] = newActivePal; 61 | 62 | activePalette = fullPalette[gfxLineBuffer[0]]; 63 | activePalette32 = fullPalette32[gfxLineBuffer[0]]; 64 | #endif 65 | 66 | #if RETRO_HARDWARE_RENDER 67 | if (newActivePal < PALETTE_COUNT) 68 | texPaletteNum = newActivePal; 69 | #endif 70 | } 71 | 72 | inline void SetPaletteEntry(byte paletteIndex, byte index, byte r, byte g, byte b) 73 | { 74 | if (paletteIndex != 0xFF) { 75 | fullPalette[paletteIndex][index] = PACK_RGB888(r, g, b); 76 | fullPalette32[paletteIndex][index].r = r; 77 | fullPalette32[paletteIndex][index].g = g; 78 | fullPalette32[paletteIndex][index].b = b; 79 | #if RETRO_HARDWARE_RENDER && !RETRO_USING_C2D 80 | if (index) 81 | fullPalette[paletteIndex][index] |= 1; 82 | #endif 83 | } 84 | else { 85 | activePalette[index] = PACK_RGB888(r, g, b); 86 | activePalette32[index].r = r; 87 | activePalette32[index].g = g; 88 | activePalette32[index].b = b; 89 | #if RETRO_HARDWARE_RENDER && !RETRO_USING_C2D 90 | if (index) 91 | activePalette[index] |= 1; 92 | #endif 93 | } 94 | } 95 | 96 | inline void CopyPalette(byte src, byte dest) 97 | { 98 | if (src < PALETTE_COUNT && dest < PALETTE_COUNT) { 99 | for (int i = 0; i < PALETTE_SIZE; ++i) { 100 | fullPalette[dest][i] = fullPalette[src][i]; 101 | fullPalette32[dest][i] = fullPalette32[src][i]; 102 | } 103 | } 104 | } 105 | 106 | inline void RotatePalette(byte startIndex, byte endIndex, bool right) 107 | { 108 | if (right) { 109 | ushort startClr = activePalette[endIndex]; 110 | PaletteEntry startClr32 = activePalette32[endIndex]; 111 | for (int i = endIndex; i > startIndex; --i) { 112 | activePalette[i] = activePalette[i - 1]; 113 | activePalette32[i] = activePalette32[i - 1]; 114 | } 115 | activePalette[startIndex] = startClr; 116 | activePalette32[startIndex] = startClr32; 117 | } 118 | else { 119 | ushort startClr = activePalette[startIndex]; 120 | PaletteEntry startClr32 = activePalette32[startIndex]; 121 | for (int i = startIndex; i < endIndex; ++i) { 122 | activePalette[i] = activePalette[i + 1]; 123 | activePalette32[i] = activePalette32[i + 1]; 124 | } 125 | activePalette[endIndex] = startClr; 126 | activePalette32[endIndex] = startClr32; 127 | } 128 | } 129 | 130 | inline void SetFade(byte R, byte G, byte B, ushort A) 131 | { 132 | fadeMode = 1; 133 | fadeR = R; 134 | fadeG = G; 135 | fadeB = B; 136 | fadeA = A > 0xFF ? 0xFF : A; 137 | } 138 | void SetLimitedFade(byte paletteID, byte R, byte G, byte B, ushort alpha, int startIndex, int endIndex); 139 | 140 | #endif // !PALETTE_H 141 | -------------------------------------------------------------------------------- /RSDKv3/Player.cpp: -------------------------------------------------------------------------------- 1 | #include "RetroEngine.hpp" 2 | 3 | Player playerList[PLAYER_COUNT]; 4 | int playerListPos = 0; 5 | int activePlayer = 0; 6 | int activePlayerCount = 1; 7 | 8 | ushort upBuffer = 0; 9 | ushort downBuffer = 0; 10 | ushort leftBuffer = 0; 11 | ushort rightBuffer = 0; 12 | ushort jumpPressBuffer = 0; 13 | ushort jumpHoldBuffer = 0; 14 | 15 | void ProcessPlayerControl(Player *Player) 16 | { 17 | if (Player->controlMode == -1) { 18 | upBuffer <<= 1; 19 | upBuffer |= (byte)Player->up; 20 | downBuffer <<= 1; 21 | downBuffer |= (byte)Player->down; 22 | leftBuffer <<= 1; 23 | leftBuffer |= (byte)Player->left; 24 | rightBuffer <<= 1; 25 | rightBuffer |= (byte)Player->right; 26 | jumpPressBuffer <<= 1; 27 | jumpPressBuffer |= (byte)Player->jumpPress; 28 | jumpHoldBuffer <<= 1; 29 | jumpHoldBuffer |= (byte)Player->jumpHold; 30 | } 31 | else if (Player->controlMode == 1) { 32 | Player->up = upBuffer >> 15; 33 | Player->down = downBuffer >> 15; 34 | Player->left = leftBuffer >> 15; 35 | Player->right = rightBuffer >> 15; 36 | Player->jumpPress = jumpPressBuffer >> 15; 37 | Player->jumpHold = jumpHoldBuffer >> 15; 38 | } 39 | else { 40 | Player->up = keyDown.up; 41 | Player->down = keyDown.down; 42 | if (!keyDown.left || !keyDown.right) { 43 | Player->left = keyDown.left; 44 | Player->right = keyDown.right; 45 | } 46 | else { 47 | Player->left = false; 48 | Player->right = false; 49 | } 50 | Player->jumpHold = keyDown.C | keyDown.B | keyDown.A; 51 | Player->jumpPress = keyPress.C | keyPress.B | keyPress.A; 52 | upBuffer <<= 1; 53 | upBuffer |= (byte)Player->up; 54 | downBuffer <<= 1; 55 | downBuffer |= (byte)Player->down; 56 | leftBuffer <<= 1; 57 | leftBuffer |= (byte)Player->left; 58 | rightBuffer <<= 1; 59 | rightBuffer |= (byte)Player->right; 60 | jumpPressBuffer <<= 1; 61 | jumpPressBuffer |= (byte)Player->jumpPress; 62 | jumpHoldBuffer <<= 1; 63 | jumpHoldBuffer |= (byte)Player->jumpHold; 64 | } 65 | } -------------------------------------------------------------------------------- /RSDKv3/Player.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PLAYER_H 2 | #define PLAYER_H 3 | 4 | #define PLAYER_COUNT (0x2) 5 | 6 | struct Player { 7 | int entityNo; 8 | int XPos; 9 | int YPos; 10 | int XVelocity; 11 | int YVelocity; 12 | int speed; 13 | int screenXPos; 14 | int screenYPos; 15 | int angle; 16 | int timer; 17 | int lookPos; 18 | int values[8]; 19 | byte collisionMode; 20 | byte skidding; 21 | byte pushing; 22 | byte collisionPlane; 23 | sbyte controlMode; 24 | byte controlLock; 25 | int topSpeed; 26 | int acceleration; 27 | int deceleration; 28 | int airAcceleration; 29 | int airDeceleration; 30 | int gravityStrength; 31 | int jumpStrength; 32 | int jumpCap; 33 | int rollingAcceleration; 34 | int rollingDeceleration; 35 | byte visible; 36 | byte tileCollisions; 37 | byte objectInteractions; 38 | byte left; 39 | byte right; 40 | byte up; 41 | byte down; 42 | byte jumpPress; 43 | byte jumpHold; 44 | byte followPlayer1; 45 | byte trackScroll; 46 | byte gravity; 47 | byte water; 48 | byte flailing[3]; 49 | AnimationFile *animationFile; 50 | Entity *boundEntity; 51 | }; 52 | 53 | extern Player playerList[PLAYER_COUNT]; 54 | extern int playerListPos; 55 | extern int activePlayer; 56 | extern int activePlayerCount; 57 | 58 | extern ushort upBuffer; 59 | extern ushort downBuffer; 60 | extern ushort leftBuffer; 61 | extern ushort rightBuffer; 62 | extern ushort jumpPressBuffer; 63 | extern ushort jumpHoldBuffer; 64 | 65 | void ProcessPlayerControl(Player *player); 66 | 67 | #endif // !PLAYER_H 68 | -------------------------------------------------------------------------------- /RSDKv3/RSDKv3 Decomp Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/RSDKv3/RSDKv3 Decomp Icon.ico -------------------------------------------------------------------------------- /RSDKv3/RSDKv3.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (United Kingdom) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) 19 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK 20 | #pragma code_page(1252) 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | #endif // English (United Kingdom) resources 48 | ///////////////////////////////////////////////////////////////////////////// 49 | 50 | 51 | ///////////////////////////////////////////////////////////////////////////// 52 | // English (Australia) resources 53 | 54 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA) 55 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS 56 | #pragma code_page(1252) 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | VS_VERSION_INFO VERSIONINFO 64 | FILEVERSION 1,0,0,0 65 | PRODUCTVERSION 1,0,0,0 66 | FILEFLAGSMASK 0x3fL 67 | #ifdef _DEBUG 68 | FILEFLAGS 0x1L 69 | #else 70 | FILEFLAGS 0x0L 71 | #endif 72 | FILEOS 0x40004L 73 | FILETYPE 0x1L 74 | FILESUBTYPE 0x0L 75 | BEGIN 76 | BLOCK "StringFileInfo" 77 | BEGIN 78 | BLOCK "0c0904b0" 79 | BEGIN 80 | VALUE "CompanyName", "RSDKv3/Sonic CD (2011) By Christian 'The Taxman' Whitehead, Decompilation by Rubberduckycooly" 81 | VALUE "FileDescription", "RSDKv3" 82 | VALUE "FileVersion", "1.0.0" 83 | VALUE "InternalName", "RSDKv3.exe" 84 | VALUE "OriginalFilename", "RSDKv3.exe" 85 | VALUE "ProductName", "RSDKv3" 86 | VALUE "ProductVersion", "1.0.0" 87 | END 88 | END 89 | BLOCK "VarFileInfo" 90 | BEGIN 91 | VALUE "Translation", 0xc09, 1200 92 | END 93 | END 94 | 95 | 96 | ///////////////////////////////////////////////////////////////////////////// 97 | // 98 | // Icon 99 | // 100 | 101 | // Icon with lowest ID value placed first to ensure application icon 102 | // remains consistent on all systems. 103 | IDI_ICON1 ICON "RSDKv3 Decomp Icon.ico" 104 | 105 | #endif // English (Australia) resources 106 | ///////////////////////////////////////////////////////////////////////////// 107 | 108 | 109 | 110 | #ifndef APSTUDIO_INVOKED 111 | ///////////////////////////////////////////////////////////////////////////// 112 | // 113 | // Generated from the TEXTINCLUDE 3 resource. 114 | // 115 | 116 | 117 | ///////////////////////////////////////////////////////////////////////////// 118 | #endif // not APSTUDIO_INVOKED 119 | 120 | -------------------------------------------------------------------------------- /RSDKv3/RSDKv3SDL1.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {bda859b2-1d03-47c3-acf5-677bf22c1541} 18 | 19 | 20 | {53c7d13e-21a9-454c-8d5d-8576328532f8} 21 | 22 | 23 | {508c825f-9a6b-4ced-8588-bfa55ba16df8} 24 | 25 | 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files\theoraPlay 32 | 33 | 34 | Header Files\theoraPlay 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | Header Files 53 | 54 | 55 | Header Files 56 | 57 | 58 | Header Files 59 | 60 | 61 | Header Files 62 | 63 | 64 | Header Files 65 | 66 | 67 | Header Files 68 | 69 | 70 | Header Files 71 | 72 | 73 | Header Files 74 | 75 | 76 | Header Files 77 | 78 | 79 | Header Files 80 | 81 | 82 | Header Files 83 | 84 | 85 | Header Files 86 | 87 | 88 | Header Files 89 | 90 | 91 | Header Files 92 | 93 | 94 | Header Files 95 | 96 | 97 | Header Files 98 | 99 | 100 | Header Files\vdf_parser 101 | 102 | 103 | 104 | 105 | Source Files 106 | 107 | 108 | Source Files 109 | 110 | 111 | Source Files 112 | 113 | 114 | Source Files 115 | 116 | 117 | Source Files 118 | 119 | 120 | Source Files 121 | 122 | 123 | Source Files 124 | 125 | 126 | Source Files 127 | 128 | 129 | Source Files 130 | 131 | 132 | Source Files 133 | 134 | 135 | Source Files 136 | 137 | 138 | Source Files 139 | 140 | 141 | Source Files 142 | 143 | 144 | Source Files 145 | 146 | 147 | Source Files 148 | 149 | 150 | Source Files 151 | 152 | 153 | Source Files 154 | 155 | 156 | Source Files 157 | 158 | 159 | Source Files 160 | 161 | 162 | Source Files 163 | 164 | 165 | Source Files\theoraPlay 166 | 167 | 168 | Source Files 169 | 170 | 171 | Source Files 172 | 173 | 174 | 175 | 176 | Resource Files 177 | 178 | 179 | 180 | 181 | Resource Files 182 | 183 | 184 | -------------------------------------------------------------------------------- /RSDKv3/Reader.hpp: -------------------------------------------------------------------------------- 1 | #ifndef READER_H 2 | #define READER_H 3 | 4 | #ifdef FORCE_CASE_INSENSITIVE 5 | 6 | #include "fcaseopen.h" 7 | #define FileIO FILE 8 | #define fOpen(path, mode) fcaseopen(path, mode) 9 | #define fRead(buffer, elementSize, elementCount, file) fread(buffer, elementSize, elementCount, file) 10 | #define fSeek(file, offset, whence) fseek(file, offset, whence) 11 | #define fTell(file) ftell(file) 12 | #define fClose(file) fclose(file) 13 | #define fWrite(buffer, elementSize, elementCount, file) fwrite(buffer, elementSize, elementCount, file) 14 | 15 | #else 16 | 17 | // maybe don't use SDL_RWops on 3DS 18 | #if RETRO_USING_SDL2 || RETRO_USING_SDL1_AUDIO 19 | #define FileIO SDL_RWops 20 | #define fOpen(path, mode) SDL_RWFromFile(path, mode) 21 | #define fRead(buffer, elementSize, elementCount, file) SDL_RWread(file, buffer, elementSize, elementCount) 22 | #define fSeek(file, offset, whence) SDL_RWseek(file, offset, whence) 23 | #define fTell(file) SDL_RWtell(file) 24 | #define fClose(file) SDL_RWclose(file) 25 | #define fWrite(buffer, elementSize, elementCount, file) SDL_RWwrite(file, buffer, elementSize, elementCount) 26 | #else 27 | #define FileIO FILE 28 | #define fOpen(path, mode) fopen(path, mode) 29 | #define fRead(buffer, elementSize, elementCount, file) fread(buffer, elementSize, elementCount, file) 30 | #define fSeek(file, offset, whence) fseek(file, offset, whence) 31 | #define fTell(file) ftell(file) 32 | #define fClose(file) fclose(file) 33 | #define fWrite(buffer, elementSize, elementCount, file) fwrite(buffer, elementSize, elementCount, file) 34 | #endif 35 | 36 | #endif 37 | 38 | struct FileInfo { 39 | char fileName[0x100]; 40 | int fileSize; 41 | int vFileSize; 42 | int readPos; 43 | int bufferPosition; 44 | int virtualFileOffset; 45 | byte eStringPosA; 46 | byte eStringPosB; 47 | byte eStringNo; 48 | byte eNybbleSwap; 49 | FileIO *cFileHandle; 50 | byte *fileBuffer; 51 | #if RETRO_USE_MOD_LOADER 52 | byte isMod; 53 | #endif 54 | }; 55 | 56 | extern char rsdkName[0x400]; 57 | 58 | extern char fileName[0x100]; 59 | extern byte fileBuffer[0x2000]; 60 | extern int fileSize; 61 | extern int vFileSize; 62 | extern int readPos; 63 | extern int readSize; 64 | extern int bufferPosition; 65 | extern int virtualFileOffset; 66 | extern byte eStringPosA; 67 | extern byte eStringPosB; 68 | extern byte eStringNo; 69 | extern byte eNybbleSwap; 70 | extern char encryptionStringA[21]; 71 | extern char encryptionStringB[13]; 72 | #if RETRO_USE_MOD_LOADER 73 | extern byte isModdedFile; 74 | #endif 75 | 76 | extern FileIO *cFileHandle; 77 | 78 | inline void CopyFilePath(char *dest, const char *src) 79 | { 80 | strcpy(dest, src); 81 | for (int i = 0;; ++i) { 82 | if (i >= strlen(dest)) { 83 | break; 84 | } 85 | 86 | if (dest[i] == '/') 87 | dest[i] = '\\'; 88 | } 89 | } 90 | bool CheckRSDKFile(const char *filePath); 91 | 92 | bool LoadFile(const char *filePath, FileInfo *fileInfo); 93 | inline bool CloseFile() 94 | { 95 | int result = 0; 96 | if (cFileHandle) 97 | result = fClose(cFileHandle); 98 | 99 | cFileHandle = NULL; 100 | return result; 101 | } 102 | 103 | void FileRead(void *dest, int size); 104 | 105 | bool ParseVirtualFileSystem(FileInfo *fileInfo); 106 | 107 | inline size_t FillFileBuffer() 108 | { 109 | if (readPos + 0x2000 <= fileSize) 110 | readSize = 0x2000; 111 | else 112 | readSize = fileSize - readPos; 113 | 114 | size_t result = fRead(fileBuffer, 1u, readSize, cFileHandle); 115 | readPos += readSize; 116 | bufferPosition = 0; 117 | return result; 118 | } 119 | 120 | inline void GetFileInfo(FileInfo *fileInfo) 121 | { 122 | StrCopy(fileInfo->fileName, fileName); 123 | fileInfo->bufferPosition = bufferPosition; 124 | fileInfo->readPos = readPos - readSize; 125 | fileInfo->fileSize = fileSize; 126 | fileInfo->vFileSize = vFileSize; 127 | fileInfo->virtualFileOffset = virtualFileOffset; 128 | fileInfo->eStringPosA = eStringPosA; 129 | fileInfo->eStringPosB = eStringPosB; 130 | fileInfo->eStringNo = eStringNo; 131 | fileInfo->eNybbleSwap = eNybbleSwap; 132 | #if RETRO_USE_MOD_LOADER 133 | fileInfo->isMod = isModdedFile; 134 | #endif 135 | } 136 | void SetFileInfo(FileInfo *fileInfo); 137 | size_t GetFilePosition(); 138 | void SetFilePosition(int newPos); 139 | bool ReachedEndOfFile(); 140 | 141 | // For Music Streaming 142 | bool LoadFile2(const char *filePath, FileInfo *fileInfo); 143 | bool ParseVirtualFileSystem2(FileInfo *fileInfo); 144 | size_t FileRead2(FileInfo *info, void *dest, int size, bool fromBuffer); 145 | inline bool CloseFile2(FileInfo *info) 146 | { 147 | if (info->fileBuffer) 148 | free(info->fileBuffer); 149 | 150 | info->cFileHandle = NULL; 151 | info->fileBuffer = NULL; 152 | return true; 153 | } 154 | size_t GetFilePosition2(FileInfo *info); 155 | void SetFilePosition2(FileInfo *info, int newPos); 156 | 157 | #endif // !READER_H 158 | -------------------------------------------------------------------------------- /RSDKv3/Scene3D.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DRAWING3D_H 2 | #define DRAWING3D_H 3 | 4 | #define VERTEXBUFFER_SIZE (0x1000) 5 | #define FACEBUFFER_SIZE (0x400) 6 | 7 | enum FaceFlags { 8 | FACE_FLAG_TEXTURED_3D = 0, 9 | FACE_FLAG_TEXTURED_2D = 1, 10 | FACE_FLAG_COLOURED_3D = 2, 11 | FACE_FLAG_COLOURED_2D = 3, 12 | }; 13 | 14 | enum MatrixTypes { 15 | MAT_WORLD = 0, 16 | MAT_VIEW = 1, 17 | MAT_TEMP = 2, 18 | }; 19 | 20 | struct Matrix { 21 | int values[4][4]; 22 | }; 23 | 24 | struct Vertex { 25 | int x; 26 | int y; 27 | int z; 28 | int u; 29 | int v; 30 | }; 31 | 32 | struct Face { 33 | int a; 34 | int b; 35 | int c; 36 | int d; 37 | int colour; 38 | int flags; 39 | }; 40 | 41 | struct DrawListEntry3D { 42 | int faceID; 43 | int depth; 44 | }; 45 | 46 | extern int vertexCount; 47 | extern int faceCount; 48 | 49 | extern Matrix matFinal; 50 | extern Matrix matWorld; 51 | extern Matrix matView; 52 | extern Matrix matTemp; 53 | 54 | extern Face faceBuffer[FACEBUFFER_SIZE]; 55 | extern Vertex vertexBuffer[VERTEXBUFFER_SIZE]; 56 | extern Vertex vertexBufferT[VERTEXBUFFER_SIZE]; 57 | 58 | extern DrawListEntry3D drawList3D[FACEBUFFER_SIZE]; 59 | 60 | extern int projectionX; 61 | extern int projectionY; 62 | 63 | extern int faceLineStart[SCREEN_YSIZE]; 64 | extern int faceLineEnd[SCREEN_YSIZE]; 65 | extern int faceLineStartU[SCREEN_YSIZE]; 66 | extern int faceLineEndU[SCREEN_YSIZE]; 67 | extern int faceLineStartV[SCREEN_YSIZE]; 68 | extern int faceLineEndV[SCREEN_YSIZE]; 69 | 70 | void setIdentityMatrix(Matrix *matrix); 71 | void matrixMultiply(Matrix *matrixA, Matrix *matrixB); 72 | void matrixTranslateXYZ(Matrix *Matrix, int XPos, int YPos, int ZPos); 73 | void matrixScaleXYZ(Matrix *matrix, int scaleX, int scaleY, int scaleZ); 74 | void matrixRotateX(Matrix *matrix, int rotationX); 75 | void matrixRotateY(Matrix *matrix, int rotationY); 76 | void matrixRotateZ(Matrix *matrix, int rotationZ); 77 | void matrixRotateXYZ(Matrix *matrix, int rotationX, int rotationY, int rotationZ); 78 | void transformVertexBuffer(); 79 | void transformVerticies(Matrix *matrix, int startIndex, int endIndex); 80 | void sort3DDrawList(); 81 | void draw3DScene(int spriteSheetID); 82 | 83 | void processScanEdge(Vertex *vertA, Vertex *vertB); 84 | void processScanEdgeUV(Vertex *vertA, Vertex *vertB); 85 | 86 | #endif // !DRAWING3D_H 87 | -------------------------------------------------------------------------------- /RSDKv3/Script.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SCRIPT_H 2 | #define SCRIPT_H 3 | 4 | #define SCRIPTDATA_COUNT (0x40000) 5 | #define JUMPTABLE_COUNT (0x4000) 6 | #define FUNCTION_COUNT (0x200) 7 | 8 | #define JUMPSTACK_COUNT (0x400) 9 | #define FUNCSTACK_COUNT (0x400) 10 | 11 | struct ScriptPtr { 12 | int scriptCodePtr; 13 | int jumpTablePtr; 14 | }; 15 | 16 | struct ObjectScript { 17 | int frameCount; 18 | int spriteSheetID; 19 | ScriptPtr subMain; 20 | ScriptPtr subPlayerInteraction; 21 | ScriptPtr subDraw; 22 | ScriptPtr subStartup; 23 | int frameListOffset; 24 | AnimationFile* animFile; 25 | bool mobile; //flag for detecting mobile/updated bytecode 26 | }; 27 | 28 | struct ScriptEngine { 29 | int operands[10]; 30 | int tempValue[8]; 31 | int arrayPosition[3]; 32 | int checkResult; 33 | }; 34 | 35 | enum ScriptSubs { SUB_MAIN = 0, SUB_PLAYERINTERACTION = 1, SUB_DRAW = 2, SUB_SETUP = 3 }; 36 | 37 | extern ObjectScript objectScriptList[OBJECT_COUNT]; 38 | extern ScriptPtr functionScriptList[FUNCTION_COUNT]; 39 | 40 | extern int scriptData[SCRIPTDATA_COUNT]; 41 | extern int jumpTableData[JUMPTABLE_COUNT]; 42 | 43 | extern int jumpTableStack[JUMPSTACK_COUNT]; 44 | extern int functionStack[FUNCSTACK_COUNT]; 45 | 46 | extern int scriptCodePos; //Bytecode file readpos 47 | extern int jumpTablePos; //Bytecode file readpos 48 | 49 | extern int jumpTableStackPos; 50 | extern int functionStackPos; 51 | 52 | extern ScriptEngine scriptEng; 53 | extern char scriptText[0x100]; 54 | 55 | extern int scriptDataPos; 56 | extern int scriptDataOffset; 57 | extern int jumpTableDataPos; 58 | extern int jumpTableDataOffset; 59 | 60 | extern int scriptFunctionCount; 61 | extern char scriptFunctionNames[FUNCTION_COUNT][0x20]; 62 | 63 | extern int aliasCount; 64 | extern int lineID; 65 | 66 | void CheckAliasText(char *text); 67 | void ConvertArithmaticSyntax(char *text); 68 | void ConvertIfWhileStatement(char *text); 69 | bool ConvertSwitchStatement(char *text); 70 | void ConvertFunctionText(char *text); 71 | void CheckCaseNumber(char *text); 72 | bool ReadSwitchCase(char *text); 73 | void AppendIntegerToString(char *text, int value); 74 | bool ConvertStringToInteger(char *text, int *value); 75 | void CopyAliasStr(char *dest, char *text, bool arrayIndex); 76 | bool CheckOpcodeType(char *text); // Never actually used 77 | 78 | void ParseScriptFile(char *scriptName, int scriptID); 79 | void LoadBytecode(int stageListID, int scriptID); 80 | 81 | void ProcessScript(int scriptCodePtr, int jumpTablePtr, byte scriptSub); 82 | 83 | void ClearScriptData(); 84 | 85 | #endif // !SCRIPT_H 86 | -------------------------------------------------------------------------------- /RSDKv3/Sprite.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SPRITE_H 2 | #define SPRITE_H 3 | 4 | int AddGraphicsFile(const char *filePath); 5 | void RemoveGraphicsFile(const char *filePath, int sheetID); 6 | 7 | int LoadBMPFile(const char *filePath, byte sheetID); 8 | int LoadGIFFile(const char *filePath, byte sheetID); 9 | int LoadGFXFile(const char *filePath, byte sheetID); 10 | int LoadRSVFile(const char *filePath, byte sheetID); 11 | int LoadPVRFile(const char *filePath, byte sheetID); 12 | 13 | void ReadGifPictureData(int width, int height, bool interlaced, byte *gfxData, int offset); 14 | 15 | #endif // !SPRITE_H 16 | -------------------------------------------------------------------------------- /RSDKv3/String.cpp: -------------------------------------------------------------------------------- 1 | #include "RetroEngine.hpp" 2 | 3 | int FindStringToken(const char *string, const char *token, sbyte stopID) 4 | { 5 | int tokenCharID = 0; 6 | bool tokenMatch = true; 7 | int stringCharID = 0; 8 | int foundTokenID = 0; 9 | 10 | while (string[stringCharID]) { 11 | tokenCharID = 0; 12 | tokenMatch = true; 13 | while (token[tokenCharID]) { 14 | if (!string[tokenCharID + stringCharID]) 15 | return -1; 16 | 17 | if (string[tokenCharID + stringCharID] != token[tokenCharID]) 18 | tokenMatch = false; 19 | 20 | ++tokenCharID; 21 | } 22 | if (tokenMatch && ++foundTokenID == stopID) 23 | return stringCharID; 24 | 25 | ++stringCharID; 26 | } 27 | return -1; 28 | } -------------------------------------------------------------------------------- /RSDKv3/String.hpp: -------------------------------------------------------------------------------- 1 | #ifndef STRING_H 2 | #define STRING_H 3 | 4 | inline void StrCopy(char *dest, const char *src) 5 | { 6 | int i = 0; 7 | 8 | for (; src[i]; ++i) dest[i] = src[i]; 9 | 10 | dest[i] = 0; 11 | } 12 | 13 | inline void StrAdd(char *dest, const char *src) 14 | { 15 | int destStrPos = 0; 16 | int srcStrPos = 0; 17 | while (dest[destStrPos]) ++destStrPos; 18 | while (true) { 19 | if (!src[srcStrPos]) { 20 | break; 21 | } 22 | dest[destStrPos++] = src[srcStrPos++]; 23 | } 24 | dest[destStrPos] = 0; 25 | } 26 | 27 | inline bool StrComp(const char *stringA, const char *stringB) 28 | { 29 | bool match = true; 30 | bool finished = false; 31 | while (!finished) { 32 | if (*stringA == *stringB || *stringA == *stringB + ' ' || *stringA == *stringB - ' ') { 33 | if (*stringA) { 34 | ++stringA; 35 | ++stringB; 36 | } 37 | else { 38 | finished = true; 39 | } 40 | } 41 | else { 42 | match = false; 43 | finished = true; 44 | } 45 | } 46 | return match; 47 | } 48 | 49 | inline int StrLength(const char *string) 50 | { 51 | int len = 0; 52 | for (len = 0; string[len]; len++) 53 | ; 54 | return len; 55 | } 56 | int FindStringToken(const char *string, const char *token, sbyte stopID); 57 | 58 | #endif // !STRING_H 59 | -------------------------------------------------------------------------------- /RSDKv3/Text.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TEXTSYSTEM_H 2 | #define TEXTSYSTEM_H 3 | 4 | #define TEXTDATA_COUNT (0x2800) 5 | #define TEXTENTRY_COUNT (0x200) 6 | #define TEXTMENU_COUNT (0x2) 7 | 8 | #define FONTCHAR_COUNT (0x400) 9 | 10 | enum TextInfoTypes { TEXTINFO_TEXTDATA = 0, TEXTINFO_TEXTSIZE = 1, TEXTINFO_ROWCOUNT = 2 }; 11 | 12 | struct TextMenu { 13 | ushort textData[TEXTDATA_COUNT]; 14 | int entryStart[TEXTENTRY_COUNT]; 15 | int entrySize[TEXTENTRY_COUNT]; 16 | byte entryHighlight[TEXTENTRY_COUNT]; 17 | int textDataPos; 18 | int selection1; 19 | int selection2; 20 | ushort rowCount; 21 | ushort visibleRowCount; 22 | ushort visibleRowOffset; 23 | byte alignment; 24 | byte selectionCount; 25 | sbyte timer; 26 | }; 27 | 28 | struct FontCharacter 29 | { 30 | int id; 31 | short srcX; 32 | short srcY; 33 | short width; 34 | short height; 35 | short pivotX; 36 | short pivotY; 37 | short xAdvance; 38 | }; 39 | 40 | extern TextMenu gameMenu[TEXTMENU_COUNT]; 41 | extern int textMenuSurfaceNo; 42 | 43 | extern FontCharacter fontCharacterList[FONTCHAR_COUNT]; 44 | 45 | void LoadFontFile(const char *filePath); 46 | void LoadTextFile(TextMenu *menu, const char *filePath, byte mapCode); 47 | void LoadConfigListText(TextMenu *menu, int listNo); 48 | 49 | void SetupTextMenu(TextMenu *menu, int rowCount); 50 | void AddTextMenuEntry(TextMenu *menu, const char *text); 51 | void AddTextMenuEntryMapped(TextMenu *menu, const char *text); 52 | void SetTextMenuEntry(TextMenu *menu, const char *text, int rowID); 53 | void EditTextMenuEntry(TextMenu *menu, const char *text, int rowID); 54 | 55 | #endif // !TEXTSYSTEM_H 56 | -------------------------------------------------------------------------------- /RSDKv3/Userdata.hpp: -------------------------------------------------------------------------------- 1 | #ifndef USERDATA_H 2 | #define USERDATA_H 3 | 4 | #define GLOBALVAR_COUNT (0x100) 5 | 6 | #define ACHIEVEMENT_MAX (0x40) 7 | #define LEADERBOARD_MAX (0x80) 8 | 9 | #define MOD_MAX (0x100) 10 | 11 | #define SAVEDATA_MAX (0x2000) 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | enum OnlineMenuTypes { 18 | ONLINEMENU_ACHIEVEMENTS = 0, 19 | ONLINEMENU_LEADERBOARDS = 1, 20 | }; 21 | 22 | struct Achievement { 23 | char name[0x40]; 24 | int status; 25 | }; 26 | 27 | struct LeaderboardEntry { 28 | int status; 29 | }; 30 | 31 | #if RETRO_USE_MOD_LOADER 32 | struct ModInfo { 33 | std::string name; 34 | std::string desc; 35 | std::string author; 36 | std::string version; 37 | std::map fileMap; 38 | std::string folder; 39 | bool useScripts; 40 | bool active; 41 | }; 42 | #endif 43 | 44 | extern int globalVariablesCount; 45 | extern int globalVariables[GLOBALVAR_COUNT]; 46 | extern char globalVariableNames[GLOBALVAR_COUNT][0x20]; 47 | 48 | extern char gamePath[0x100]; 49 | extern char modsPath[0x100]; 50 | extern int saveRAM[SAVEDATA_MAX]; 51 | extern Achievement achievements[ACHIEVEMENT_MAX]; 52 | extern LeaderboardEntry leaderboard[LEADERBOARD_MAX]; 53 | 54 | extern int controlMode; 55 | extern bool disableTouchControls; 56 | 57 | #if RETRO_USE_MOD_LOADER 58 | extern std::vector modList; 59 | extern bool forceUseScripts; 60 | #endif 61 | 62 | inline int GetGlobalVariableByName(const char *name) 63 | { 64 | for (int v = 0; v < globalVariablesCount; ++v) { 65 | if (StrComp(name, globalVariableNames[v])) 66 | return globalVariables[v]; 67 | } 68 | return 0; 69 | } 70 | 71 | inline void SetGlobalVariableByName(const char *name, int value) 72 | { 73 | for (int v = 0; v < globalVariablesCount; ++v) { 74 | if (StrComp(name, globalVariableNames[v])) { 75 | globalVariables[v] = value; 76 | break; 77 | } 78 | } 79 | } 80 | 81 | inline bool ReadSaveRAMData() 82 | { 83 | char buffer[0x200]; 84 | #if RETRO_PLATFORM == RETRO_UWP 85 | if (!usingCWD) 86 | sprintf(buffer, "%s/Sdata.bin",getResourcesPath()); 87 | else 88 | sprintf(buffer, "%sSdata.bin", gamePath); 89 | #elif RETRO_PLATFORM == RETRO_OSX 90 | sprintf(buffer, "%s/SData.bin", gamePath); 91 | #elif RETRO_PLATFORM == RETRO_iOS 92 | sprintf(buffer, "%s/SData.bin", getDocumentsPath()); 93 | #else 94 | sprintf(buffer, "%sSdata.bin", gamePath); 95 | #endif 96 | 97 | // Temp(?) 98 | saveRAM[33] = bgmVolume; 99 | saveRAM[34] = sfxVolume; 100 | 101 | FileIO *saveFile = fOpen(buffer, "rb"); 102 | if (!saveFile) 103 | return false; 104 | fRead(saveRAM, 4u, SAVEDATA_MAX, saveFile); 105 | 106 | fClose(saveFile); 107 | return true; 108 | } 109 | 110 | inline bool WriteSaveRAMData() 111 | { 112 | char buffer[0x200]; 113 | #if RETRO_PLATFORM == RETRO_UWP 114 | if (!usingCWD) 115 | sprintf(buffer, "%s/Sdata.bin",getResourcesPath()); 116 | else 117 | sprintf(buffer, "%sSdata.bin", gamePath); 118 | #elif RETRO_PLATFORM == RETRO_OSX 119 | sprintf(buffer, "%s/SData.bin", gamePath); 120 | #elif RETRO_PLATFORM == RETRO_iOS 121 | sprintf(buffer, "%s/SData.bin", getDocumentsPath()); 122 | #else 123 | sprintf(buffer, "%sSdata.bin", gamePath); 124 | #endif 125 | 126 | FileIO *saveFile = fOpen(buffer, "wb"); 127 | if (!saveFile) 128 | return false; 129 | 130 | //Temp 131 | saveRAM[33] = bgmVolume; 132 | saveRAM[34] = sfxVolume; 133 | 134 | fWrite(saveRAM, 4u, SAVEDATA_MAX, saveFile); 135 | fClose(saveFile); 136 | return true; 137 | } 138 | 139 | void InitUserdata(); 140 | void writeSettings(); 141 | void ReadUserdata(); 142 | void WriteUserdata(); 143 | 144 | void AwardAchievement(int id, int status); 145 | void SetAchievement(int achievementID, int achievementDone); 146 | void SetLeaderboard(int leaderboardID, int result); 147 | inline void LoadAchievementsMenu() { ReadUserdata(); } 148 | inline void LoadLeaderboardsMenu() { ReadUserdata(); } 149 | 150 | #if RETRO_USE_MOD_LOADER 151 | void initMods(); 152 | bool loadMod(ModInfo *info, std::string modsPath, std::string folder, bool active); 153 | void saveMods(); 154 | #endif 155 | 156 | #endif //!USERDATA_H 157 | -------------------------------------------------------------------------------- /RSDKv3/Video.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VIDEO_H 2 | #define VIDEO_H 3 | 4 | #include "theoraplay.h" 5 | 6 | extern int currentVideoFrame; 7 | extern int videoFrameCount; 8 | extern int videoWidth; 9 | extern int videoHeight; 10 | extern float videoAR; 11 | 12 | extern THEORAPLAY_Decoder *videoDecoder; 13 | extern const THEORAPLAY_VideoFrame *videoVidData; 14 | extern const THEORAPLAY_AudioPacket *videoAudioData; 15 | extern THEORAPLAY_Io callbacks; 16 | 17 | extern byte videoData; 18 | extern int videoFilePos; 19 | extern bool videoPlaying; 20 | extern int vidFrameMS; 21 | extern int vidBaseticks; 22 | 23 | void PlayVideoFile(char *filepath); 24 | void UpdateVideoFrame(); 25 | int ProcessVideo(); 26 | void StopVideoPlayback(); 27 | 28 | void SetupVideoBuffer(int width, int height); 29 | void CloseVideoBuffer(); 30 | 31 | #endif // !VIDEO_H 32 | -------------------------------------------------------------------------------- /RSDKv3/fcaseopen.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009 Keith Bauer 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | #include "fcaseopen.h" 24 | 25 | #if !defined(_WIN32) 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | // r must have strlen(path) + 2 bytes 34 | static int casepath(char const *path, char *r) 35 | { 36 | size_t l = strlen(path); 37 | char *p = (char*)alloca(l + 1); 38 | strcpy(p, path); 39 | size_t rl = 0; 40 | 41 | DIR *d; 42 | if (p[0] == '/') 43 | { 44 | d = opendir("/"); 45 | p = p + 1; 46 | } 47 | else 48 | { 49 | d = opendir("."); 50 | r[0] = '.'; 51 | r[1] = 0; 52 | rl = 1; 53 | } 54 | 55 | int last = 0; 56 | char *c = strsep(&p, "/"); 57 | while (c) 58 | { 59 | if (!d) 60 | { 61 | return 0; 62 | } 63 | 64 | if (last) 65 | { 66 | closedir(d); 67 | return 0; 68 | } 69 | 70 | r[rl] = '/'; 71 | rl += 1; 72 | r[rl] = 0; 73 | 74 | struct dirent *e = readdir(d); 75 | while (e) 76 | { 77 | if (strcasecmp(c, e->d_name) == 0) 78 | { 79 | strcpy(r + rl, e->d_name); 80 | rl += strlen(e->d_name); 81 | 82 | closedir(d); 83 | d = opendir(r); 84 | 85 | break; 86 | } 87 | 88 | e = readdir(d); 89 | } 90 | 91 | if (!e) 92 | { 93 | strcpy(r + rl, c); 94 | rl += strlen(c); 95 | last = 1; 96 | } 97 | 98 | c = strsep(&p, "/"); 99 | } 100 | 101 | if (d) closedir(d); 102 | return 1; 103 | } 104 | #endif 105 | 106 | FILE *fcaseopen(char const *path, char const *mode) 107 | { 108 | FILE *f = fopen(path, mode); 109 | #if !defined(_WIN32) 110 | if (!f) 111 | { 112 | char *r = (char*)alloca(strlen(path) + 2); 113 | if (casepath(path, r)) 114 | { 115 | f = fopen(r, mode); 116 | } 117 | } 118 | #endif 119 | return f; 120 | } 121 | 122 | void casechdir(char const *path) 123 | { 124 | #if !defined(_WIN32) 125 | char *r = (char*)alloca(strlen(path) + 2); 126 | if (casepath(path, r)) 127 | { 128 | chdir(r); 129 | } 130 | else 131 | { 132 | errno = ENOENT; 133 | } 134 | #else 135 | chdir(path); 136 | #endif 137 | } 138 | -------------------------------------------------------------------------------- /RSDKv3/fcaseopen.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009 Keith Bauer 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | */ 22 | 23 | #ifndef fcaseopen_h 24 | #define fcaseopen_h 25 | 26 | #include 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | extern FILE *fcaseopen(char const *path, char const *mode); 33 | 34 | extern void casechdir(char const *path); 35 | 36 | #if defined(__cplusplus) 37 | } 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /RSDKv3/main.cpp: -------------------------------------------------------------------------------- 1 | #include "RetroEngine.hpp" 2 | 3 | #if RETRO_PLATFORM == RETRO_3DS 4 | void awaitInput() { 5 | while (aptMainLoop()) { 6 | hidScanInput(); 7 | if (hidKeysDown()) 8 | break; 9 | 10 | gfxFlushBuffers(); 11 | gfxSwapBuffers(); 12 | gspWaitForVBlank(); 13 | } 14 | } 15 | #endif 16 | 17 | int main(int argc, char *argv[]) 18 | { 19 | #if RETRO_PLATFORM == RETRO_3DS 20 | #if RETRO_RENDERTYPE == RETRO_SW_RENDER && RETRO_PLATFORM == RETRO_3DS 21 | osSetSpeedupEnable(true); 22 | #endif 23 | 24 | if (!Engine.Init()) { 25 | printf("Press any button to continue.\n"); 26 | awaitInput(); 27 | gfxExit(); 28 | return 0; 29 | } 30 | printf("Build: %s\n", COMMIT); 31 | printf("Audio enabled: %d\n", audioEnabled); 32 | printf("Engine succesfully initialised.\n"); 33 | //awaitInput(); 34 | 35 | 36 | printf("Running engine...\n"); 37 | if (!engineDebugMode) { 38 | consoleClear(); 39 | } 40 | Engine.Run(); 41 | 42 | printf("Exiting..."); 43 | gfxExit(); 44 | 45 | #else 46 | for (int i = 0; i < argc; ++i) { 47 | if (StrComp(argv[i], "UsingCWD")) 48 | usingCWD = true; 49 | } 50 | 51 | Engine.Init(); 52 | Engine.Run(); 53 | #endif 54 | 55 | 56 | #if RETRO_RENDERTYPE == RETRO_SW_RENDER && RETRO_PLATFORM == RETRO_3DS 57 | osSetSpeedupEnable(false); 58 | #endif 59 | 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /RSDKv3/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by RSDKv3.rc 4 | // 5 | #define IDI_ICON1 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 104 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /RSDKv3SDL1.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29806.167 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RSDKv3", "RSDKv3\RSDKv3SDL1.vcxproj", "{BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Debug|x64.ActiveCfg = Debug|x64 17 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Debug|x64.Build.0 = Debug|x64 18 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Debug|x86.ActiveCfg = Debug|Win32 19 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Debug|x86.Build.0 = Debug|Win32 20 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Release|x64.ActiveCfg = Release|x64 21 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Release|x64.Build.0 = Release|x64 22 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Release|x86.ActiveCfg = Release|Win32 23 | {BD4A4266-8ED9-491E-B4CC-3F63F0D39C1B}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {CEEC6B21-D41E-4C5C-8B97-9FAAD7974615} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /RSDKv3UWP.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30804.86 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RSDKv3UWP", "RSDKv3UWP\RSDKv3UWP.vcxproj", "{7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2-UWP", "dependencies\win-uwp\SDL2\VisualC-WinRT\UWP_VS2015\SDL-UWP.vcxproj", "{89E9B32E-A86A-47C3-A948-D2B1622925CE}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|ARM = Debug|ARM 13 | Debug|ARM64 = Debug|ARM64 14 | Debug|x64 = Debug|x64 15 | Debug|x86 = Debug|x86 16 | Release|ARM = Release|ARM 17 | Release|ARM64 = Release|ARM64 18 | Release|x64 = Release|x64 19 | Release|x86 = Release|x86 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Debug|ARM.ActiveCfg = Debug|ARM 23 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Debug|ARM.Build.0 = Debug|ARM 24 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Debug|ARM.Deploy.0 = Debug|ARM 25 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Debug|ARM64.ActiveCfg = Debug|ARM64 26 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Debug|ARM64.Build.0 = Debug|ARM64 27 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Debug|ARM64.Deploy.0 = Debug|ARM64 28 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Debug|x64.ActiveCfg = Debug|x64 29 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Debug|x64.Build.0 = Debug|x64 30 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Debug|x64.Deploy.0 = Debug|x64 31 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Debug|x86.ActiveCfg = Debug|Win32 32 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Debug|x86.Build.0 = Debug|Win32 33 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Debug|x86.Deploy.0 = Debug|Win32 34 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Release|ARM.ActiveCfg = Release|ARM 35 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Release|ARM.Build.0 = Release|ARM 36 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Release|ARM.Deploy.0 = Release|ARM 37 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Release|ARM64.ActiveCfg = Release|ARM64 38 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Release|ARM64.Build.0 = Release|ARM64 39 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Release|ARM64.Deploy.0 = Release|ARM64 40 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Release|x64.ActiveCfg = Release|x64 41 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Release|x64.Build.0 = Release|x64 42 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Release|x64.Deploy.0 = Release|x64 43 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Release|x86.ActiveCfg = Release|Win32 44 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Release|x86.Build.0 = Release|Win32 45 | {7376A5B2-E65D-4CC8-A0CF-5AE96BBA84A5}.Release|x86.Deploy.0 = Release|Win32 46 | {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM.ActiveCfg = Debug|ARM 47 | {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM.Build.0 = Debug|ARM 48 | {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM64.ActiveCfg = Debug|Win32 49 | {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x64.ActiveCfg = Debug|x64 50 | {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x64.Build.0 = Debug|x64 51 | {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x86.ActiveCfg = Debug|Win32 52 | {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x86.Build.0 = Debug|Win32 53 | {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM.ActiveCfg = Release|ARM 54 | {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM.Build.0 = Release|ARM 55 | {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM64.ActiveCfg = Release|Win32 56 | {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.ActiveCfg = Release|x64 57 | {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.Build.0 = Release|x64 58 | {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x86.ActiveCfg = Release|Win32 59 | {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x86.Build.0 = Release|Win32 60 | EndGlobalSection 61 | GlobalSection(SolutionProperties) = preSolution 62 | HideSolutionNode = FALSE 63 | EndGlobalSection 64 | GlobalSection(ExtensibilityGlobals) = postSolution 65 | SolutionGuid = {536DEE70-A1FC-47D8-9763-410FBD1A2958} 66 | EndGlobalSection 67 | EndGlobal 68 | -------------------------------------------------------------------------------- /RSDKv3UWP/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 7 | 8 | 9 | Sonic CD 10 | SEGA 11 | Assets\StoreLogo.png 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /RSDKv3UWP/PropertySheet.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /RSDKv3UWP/WinRTIncludes.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | inline char *getResourcesPath() 7 | { 8 | static char resourcePath[256] = { 0 }; 9 | 10 | if (strlen(resourcePath) == 0) { 11 | auto folder = winrt::Windows::Storage::ApplicationData::Current().LocalFolder(); 12 | auto path = to_string(folder.Path()); 13 | 14 | std::copy(path.begin(), path.end(), resourcePath); 15 | } 16 | 17 | return resourcePath; 18 | } 19 | 20 | inline uint UAP_GetRetroGamePlatform() 21 | { 22 | auto touchCaps = winrt::Windows::Devices::Input::TouchCapabilities(); 23 | return touchCaps.TouchPresent() ? RETRO_MOBILE : RETRO_STANDARD; 24 | } 25 | 26 | inline uint UAP_GetRetroGamePlatformId() 27 | { 28 | auto touchCaps = winrt::Windows::Devices::Input::TouchCapabilities(); 29 | return touchCaps.TouchPresent() ? RETRO_ANDROID : RETRO_WIN; 30 | } 31 | -------------------------------------------------------------------------------- /RSDKv3UWP/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "SDL_main.h" 14 | #include 15 | 16 | int SDL_main(int argc, char *argv[]) 17 | { 18 | SDL_SetHint(SDL_HINT_WINRT_HANDLE_BACK_BUTTON, "1"); 19 | Engine.Init(); 20 | Engine.Run(); 21 | 22 | return 0; 23 | } 24 | 25 | 26 | int __stdcall wWinMain(HINSTANCE, HINSTANCE, PWSTR, int) { return SDL_WinRTRunApp(SDL_main, NULL); } 27 | -------------------------------------------------------------------------------- /RSDKv3UWP/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY') 2 | def buildAsApplication = !buildAsLibrary 3 | if (buildAsApplication) { 4 | apply plugin: 'com.android.application' 5 | } 6 | else { 7 | apply plugin: 'com.android.library' 8 | } 9 | 10 | android { 11 | ndkVersion "22.1.7171670" 12 | compileSdkVersion 29 13 | defaultConfig { 14 | if (buildAsApplication) { 15 | applicationId "com.decomp.rsdkv3" 16 | } 17 | minSdkVersion 23 18 | targetSdkVersion 29 19 | versionCode 1 20 | versionName "1.0" 21 | externalNativeBuild { 22 | ndkBuild { 23 | arguments "APP_PLATFORM=android-23" 24 | abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' 25 | } 26 | //cmake { 27 | // arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static" 28 | // // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' 29 | // abiFilters 'arm64-v8a' 30 | //} 31 | } 32 | } 33 | buildTypes { 34 | release { 35 | minifyEnabled false 36 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 37 | } 38 | } 39 | if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) { 40 | sourceSets.main { 41 | jniLibs.srcDir 'libs' 42 | } 43 | externalNativeBuild { 44 | ndkBuild { 45 | path 'jni/Android.mk' 46 | } 47 | //cmake { 48 | // path 'jni/CMakeLists.txt' 49 | //} 50 | } 51 | 52 | } 53 | lintOptions { 54 | abortOnError false 55 | } 56 | 57 | if (buildAsLibrary) { 58 | libraryVariants.all { variant -> 59 | variant.outputs.each { output -> 60 | def outputFile = output.outputFile 61 | if (outputFile != null && outputFile.name.endsWith(".aar")) { 62 | def fileName = "com.decomp.rsdkv3.aar" 63 | output.outputFile = new File(outputFile.parent, fileName) 64 | } 65 | } 66 | } 67 | } 68 | } 69 | 70 | dependencies { 71 | implementation fileTree(include: ['*.jar'], dir: 'libs') 72 | } 73 | -------------------------------------------------------------------------------- /android/app/jni/Android.mk: -------------------------------------------------------------------------------- 1 | include $(call all-subdir-makefiles) 2 | -------------------------------------------------------------------------------- /android/app/jni/Application.mk: -------------------------------------------------------------------------------- 1 | 2 | # Uncomment this if you're using STL in your project 3 | # You can find more information here: 4 | # https://developer.android.com/ndk/guides/cpp-support 5 | APP_STL := c++_shared 6 | 7 | APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 8 | 9 | # Min runtime API level 10 | APP_PLATFORM=android-23 11 | -------------------------------------------------------------------------------- /android/app/jni/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.6) 2 | 3 | project(GAME) 4 | 5 | # armeabi-v7a requires cpufeatures library 6 | # include(AndroidNdkModules) 7 | # android_ndk_import_module_cpufeatures() 8 | 9 | 10 | # SDL sources are in a subfolder named "SDL" 11 | add_subdirectory(SDL) 12 | 13 | # Compilation of companion libraries 14 | #add_subdirectory(SDL_image) 15 | #add_subdirectory(SDL_mixer) 16 | #add_subdirectory(SDL_ttf) 17 | 18 | # Your game and its CMakeLists.txt are in a subfolder named "src" 19 | add_subdirectory(src) 20 | 21 | -------------------------------------------------------------------------------- /android/app/jni/SDL: -------------------------------------------------------------------------------- 1 | ../../../dependencies/android/SDL -------------------------------------------------------------------------------- /android/app/jni/src: -------------------------------------------------------------------------------- 1 | ../../.. -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in [sdk]/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 8 | 9 | 10 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 35 | 36 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/decomp/rsdkv3/RSDKv3.java: -------------------------------------------------------------------------------- 1 | package com.decomp.rsdkv3; 2 | 3 | import android.Manifest; 4 | import android.content.Context; 5 | import android.content.pm.PackageManager; 6 | 7 | import org.libsdl.app.SDLActivity; 8 | 9 | public class RSDKv3 extends SDLActivity { 10 | private static Boolean asked = false; 11 | 12 | @Override 13 | public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { 14 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); 15 | if (permissions.length == 0) return; 16 | asked = true; 17 | int acquired = 0; 18 | for (int a : grantResults) acquired += a; 19 | if (acquired != 0) finishActivity(1); 20 | } 21 | 22 | public String getBasePath() { 23 | Context c = getApplicationContext(); 24 | if (!((c.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) || asked)) { 25 | requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0); 26 | } 27 | return c.getExternalFilesDir(null).getAbsolutePath() + "/"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /android/app/src/main/java/org/libsdl/app/HIDDevice.java: -------------------------------------------------------------------------------- 1 | package org.libsdl.app; 2 | 3 | import android.hardware.usb.UsbDevice; 4 | 5 | interface HIDDevice 6 | { 7 | public int getId(); 8 | public int getVendorId(); 9 | public int getProductId(); 10 | public String getSerialNumber(); 11 | public int getVersion(); 12 | public String getManufacturerName(); 13 | public String getProductName(); 14 | public UsbDevice getDevice(); 15 | public boolean open(); 16 | public int sendFeatureReport(byte[] report); 17 | public int sendOutputReport(byte[] report); 18 | public boolean getFeatureReport(byte[] report); 19 | public void setFrozen(boolean frozen); 20 | public void close(); 21 | public void shutdown(); 22 | } 23 | -------------------------------------------------------------------------------- /android/app/src/main/java/org/libsdl/app/SDL.java: -------------------------------------------------------------------------------- 1 | package org.libsdl.app; 2 | 3 | import android.content.Context; 4 | 5 | import java.lang.Class; 6 | import java.lang.reflect.Method; 7 | 8 | /** 9 | SDL library initialization 10 | */ 11 | public class SDL { 12 | 13 | // This function should be called first and sets up the native code 14 | // so it can call into the Java classes 15 | public static void setupJNI() { 16 | SDLActivity.nativeSetupJNI(); 17 | SDLAudioManager.nativeSetupJNI(); 18 | SDLControllerManager.nativeSetupJNI(); 19 | } 20 | 21 | // This function should be called each time the activity is started 22 | public static void initialize() { 23 | setContext(null); 24 | 25 | SDLActivity.initialize(); 26 | SDLAudioManager.initialize(); 27 | SDLControllerManager.initialize(); 28 | } 29 | 30 | // This function stores the current activity (SDL or not) 31 | public static void setContext(Context context) { 32 | mContext = context; 33 | } 34 | 35 | public static Context getContext() { 36 | return mContext; 37 | } 38 | 39 | public static void loadLibrary(String libraryName) throws UnsatisfiedLinkError, SecurityException, NullPointerException { 40 | 41 | if (libraryName == null) { 42 | throw new NullPointerException("No library name provided."); 43 | } 44 | 45 | try { 46 | // Let's see if we have ReLinker available in the project. This is necessary for 47 | // some projects that have huge numbers of local libraries bundled, and thus may 48 | // trip a bug in Android's native library loader which ReLinker works around. (If 49 | // loadLibrary works properly, ReLinker will simply use the normal Android method 50 | // internally.) 51 | // 52 | // To use ReLinker, just add it as a dependency. For more information, see 53 | // https://github.com/KeepSafe/ReLinker for ReLinker's repository. 54 | // 55 | Class relinkClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker"); 56 | Class relinkListenerClass = mContext.getClassLoader().loadClass("com.getkeepsafe.relinker.ReLinker$LoadListener"); 57 | Class contextClass = mContext.getClassLoader().loadClass("android.content.Context"); 58 | Class stringClass = mContext.getClassLoader().loadClass("java.lang.String"); 59 | 60 | // Get a 'force' instance of the ReLinker, so we can ensure libraries are reinstalled if 61 | // they've changed during updates. 62 | Method forceMethod = relinkClass.getDeclaredMethod("force"); 63 | Object relinkInstance = forceMethod.invoke(null); 64 | Class relinkInstanceClass = relinkInstance.getClass(); 65 | 66 | // Actually load the library! 67 | Method loadMethod = relinkInstanceClass.getDeclaredMethod("loadLibrary", contextClass, stringClass, stringClass, relinkListenerClass); 68 | loadMethod.invoke(relinkInstance, mContext, libraryName, null, null); 69 | } 70 | catch (final Throwable e) { 71 | // Fall back 72 | try { 73 | System.loadLibrary(libraryName); 74 | } 75 | catch (final UnsatisfiedLinkError ule) { 76 | throw ule; 77 | } 78 | catch (final SecurityException se) { 79 | throw se; 80 | } 81 | } 82 | } 83 | 84 | protected static Context mContext; 85 | } 86 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-v27/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #231F20 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RSDKv3 3 | 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | google() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.0-alpha05' 10 | 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | jcenter() 19 | google() 20 | } 21 | } 22 | 23 | 24 | task clean(type: Delete) { 25 | delete rootProject.buildDir 26 | } 27 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Aug 03 23:47:29 CDT 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-rc-1-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /dependencies/all/dependencies.txt: -------------------------------------------------------------------------------- 1 | upng: https://github.com/elanthis/upng 2 | 3 | filesystem: https://github.com/gulrak/filesystem -------------------------------------------------------------------------------- /dependencies/all/theoraplay/.hg_archival.txt: -------------------------------------------------------------------------------- 1 | repo: 2cd9243072f0470e51d658b7ef978870d4468af3 2 | node: 99e5fc74603e70d99e8b189eb58d02496f9a0457 3 | branch: default 4 | latesttag: null 5 | latesttagdistance: 67 6 | changessincelatesttag: 67 7 | -------------------------------------------------------------------------------- /dependencies/all/theoraplay/.hgignore: -------------------------------------------------------------------------------- 1 | syntax:glob 2 | test/*.dSYM 3 | test/*.exe 4 | test/testtheoraplay 5 | test/sdltheoraplay 6 | -------------------------------------------------------------------------------- /dependencies/all/theoraplay/3ds_utils.h: -------------------------------------------------------------------------------- 1 | #if defined _3DS 2 | 3 | #ifndef _3DS_UTILS_H 4 | #define _3DS_UTILS_H 5 | 6 | #include 7 | #include 8 | #include <3ds.h> 9 | 10 | #ifdef OS_HEAP_AREA_BEGIN // defined in libctru 2.0+ 11 | #define USE_CTRULIB_2 1 12 | #endif 13 | 14 | #define MEMOP_PROT 6 15 | #define MEMOP_MAP 4 16 | #define MEMOP_UNMAP 5 17 | 18 | #define DEBUG_HOLD() do{printf("%s@%s:%d.\n",__FUNCTION__, __FILE__, __LINE__);fflush(stdout);wait_for_input();}while(0) 19 | 20 | void wait_for_input(void); 21 | 22 | extern __attribute__((weak)) int __ctr_svchax; 23 | 24 | static bool has_rosalina; 25 | 26 | static void check_rosalina() { 27 | int64_t version; 28 | uint32_t major; 29 | 30 | has_rosalina = false; 31 | 32 | if (!svcGetSystemInfo(&version, 0x10000, 0)) { 33 | major = GET_VERSION_MAJOR(version); 34 | 35 | if (major >= 8) 36 | has_rosalina = true; 37 | } 38 | } 39 | 40 | void ctr_clear_cache(void); 41 | 42 | typedef int32_t (*ctr_callback_type)(void); 43 | 44 | static inline void ctr_invalidate_ICache_kernel(void) 45 | { 46 | __asm__ volatile( 47 | "cpsid aif\n\t" 48 | "mov r0, #0\n\t" 49 | "mcr p15, 0, r0, c7, c5, 0\n\t"); 50 | } 51 | 52 | static inline void ctr_flush_DCache_kernel(void) 53 | { 54 | __asm__ volatile( 55 | "cpsid aif\n\t" 56 | "mov r0, #0\n\t" 57 | "mcr p15, 0, r0, c7, c10, 0\n\t"); 58 | } 59 | 60 | static inline void ctr_invalidate_ICache(void) 61 | { 62 | svcBackdoor((ctr_callback_type)ctr_invalidate_ICache_kernel); 63 | } 64 | 65 | static inline void ctr_flush_DCache(void) 66 | { 67 | svcBackdoor((ctr_callback_type)ctr_flush_DCache_kernel); 68 | } 69 | 70 | static inline void ctr_flush_invalidate_cache(void) 71 | { 72 | if (has_rosalina) { 73 | ctr_clear_cache(); 74 | } else { 75 | ctr_flush_DCache(); 76 | ctr_invalidate_ICache(); 77 | } 78 | } 79 | 80 | #endif // _3DS_UTILS_H 81 | #endif // RETRO_PLATFORM == RETRO_3DS 82 | -------------------------------------------------------------------------------- /dependencies/all/theoraplay/LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) 2011-2019 Ryan C. Gordon. 3 | 4 | This software is provided 'as-is', without any express or implied warranty. 5 | In no event will the authors be held liable for any damages arising from 6 | the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software in a 14 | product, an acknowledgment in the product documentation would be 15 | appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source distribution. 21 | 22 | Ryan C. Gordon 23 | 24 | -------------------------------------------------------------------------------- /dependencies/all/theoraplay/test/maketest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -x 4 | set -e 5 | 6 | OSTYPE=`uname -s` 7 | if [ "$OSTYPE" = "Linux" ]; then 8 | LINKFLAGS="-lpthread" 9 | LINKGLFLAGS="-lGL" 10 | fi 11 | if [ "$OSTYPE" = "Darwin" ]; then 12 | LINKGLFLAGS="-framework OpenGL" 13 | fi 14 | 15 | CFLAGS="-O0 -ggdb3 -Wall -I.." 16 | gcc -o ./testtheoraplay $CFLAGS ../theoraplay.c ./testtheoraplay.c -logg -lvorbis -ltheoradec $LINKFLAGS 17 | gcc -o ./simplesdl $CFLAGS ../theoraplay.c ./simplesdl.c `sdl-config --cflags --libs` -logg -lvorbis -ltheoradec $LINKFLAGS 18 | gcc -o ./sdltheoraplay $CFLAGS ../theoraplay.c ./sdltheoraplay.c `sdl-config --cflags --libs` -logg -lvorbis -ltheoradec $LINKFLAGS $LINKGLFLAGS 19 | 20 | -------------------------------------------------------------------------------- /dependencies/all/theoraplay/test/testtheoraplay.c: -------------------------------------------------------------------------------- 1 | /** 2 | * TheoraPlay; multithreaded Ogg Theora/Ogg Vorbis decoding. 3 | * 4 | * Please see the file LICENSE.txt in the source's root directory. 5 | * 6 | * This file written by Ryan C. Gordon. 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include "theoraplay.h" 13 | 14 | static void dofile(const char *fname, const THEORAPLAY_VideoFormat vidfmt) 15 | { 16 | THEORAPLAY_Decoder *decoder = NULL; 17 | const THEORAPLAY_VideoFrame *video = NULL; 18 | const THEORAPLAY_AudioPacket *audio = NULL; 19 | 20 | printf("Trying file '%s' ...\n", fname); 21 | decoder = THEORAPLAY_startDecodeFile(fname, 20, vidfmt); 22 | while (THEORAPLAY_isDecoding(decoder)) 23 | { 24 | video = THEORAPLAY_getVideo(decoder); 25 | if (video) 26 | { 27 | printf("Got video frame (%u ms)!\n", video->playms); 28 | THEORAPLAY_freeVideo(video); 29 | } // if 30 | 31 | audio = THEORAPLAY_getAudio(decoder); 32 | if (audio) 33 | { 34 | printf("Got %d frames of audio (%u ms)!\n", audio->frames, audio->playms); 35 | THEORAPLAY_freeAudio(audio); 36 | } // if 37 | 38 | if (!video && !audio) 39 | usleep(10000); 40 | } // while 41 | 42 | if (THEORAPLAY_decodingError(decoder)) 43 | printf("There was an error decoding this file!\n"); 44 | else 45 | printf("done with this file!\n"); 46 | 47 | THEORAPLAY_stopDecode(decoder); 48 | } // dofile 49 | 50 | int main(int argc, char **argv) 51 | { 52 | THEORAPLAY_VideoFormat vidfmt = THEORAPLAY_VIDFMT_YV12; 53 | int i; 54 | 55 | for (i = 1; i < argc; i++) 56 | { 57 | if (strcmp(argv[i], "--rgb") == 0) 58 | vidfmt = THEORAPLAY_VIDFMT_RGB; 59 | else if (strcmp(argv[i], "--rgba") == 0) 60 | vidfmt = THEORAPLAY_VIDFMT_RGBA; 61 | else if (strcmp(argv[i], "--yv12") == 0) 62 | vidfmt = THEORAPLAY_VIDFMT_YV12; 63 | else 64 | dofile(argv[i], vidfmt); 65 | } // for 66 | 67 | printf("done all files!\n"); 68 | return 0; 69 | } // main 70 | 71 | // end of testtheoraplay.c ... 72 | 73 | -------------------------------------------------------------------------------- /dependencies/all/theoraplay/theoraplay.h: -------------------------------------------------------------------------------- 1 | /** 2 | * TheoraPlay; multithreaded Ogg Theora/Ogg Vorbis decoding. 3 | * 4 | * Please see the file LICENSE.txt in the source's root directory. 5 | * 6 | * This file written by Ryan C. Gordon. 7 | */ 8 | 9 | #ifndef _INCL_THEORAPLAY_H_ 10 | #define _INCL_THEORAPLAY_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | typedef struct THEORAPLAY_Io THEORAPLAY_Io; 17 | struct THEORAPLAY_Io 18 | { 19 | long (*read)(THEORAPLAY_Io *io, void *buf, long buflen); 20 | void (*close)(THEORAPLAY_Io *io); 21 | void *userdata; 22 | }; 23 | 24 | typedef struct THEORAPLAY_Decoder THEORAPLAY_Decoder; 25 | 26 | /* YV12 is YCrCb, not YCbCr; that's what SDL uses for YV12 overlays. */ 27 | typedef enum THEORAPLAY_VideoFormat 28 | { 29 | THEORAPLAY_VIDFMT_YV12, /* NTSC colorspace, planar YCrCb 4:2:0 */ 30 | THEORAPLAY_VIDFMT_IYUV, /* NTSC colorspace, planar YCbCr 4:2:0 */ 31 | THEORAPLAY_VIDFMT_RGB, /* 24 bits packed pixel RGB */ 32 | THEORAPLAY_VIDFMT_RGBA /* 32 bits packed pixel RGBA (full alpha). */ 33 | } THEORAPLAY_VideoFormat; 34 | 35 | typedef struct THEORAPLAY_VideoFrame 36 | { 37 | unsigned int playms; 38 | double fps; 39 | unsigned int width; 40 | unsigned int height; 41 | THEORAPLAY_VideoFormat format; 42 | unsigned char *pixels; 43 | struct THEORAPLAY_VideoFrame *next; 44 | } THEORAPLAY_VideoFrame; 45 | 46 | typedef struct THEORAPLAY_AudioPacket 47 | { 48 | unsigned int playms; /* playback start time in milliseconds. */ 49 | int channels; 50 | int freq; 51 | int frames; 52 | float *samples; /* frames * channels float32 samples. */ 53 | struct THEORAPLAY_AudioPacket *next; 54 | } THEORAPLAY_AudioPacket; 55 | 56 | THEORAPLAY_Decoder *THEORAPLAY_startDecodeFile(const char *fname, 57 | const unsigned int maxframes, 58 | THEORAPLAY_VideoFormat vidfmt, 59 | unsigned int audio_bitstream); 60 | THEORAPLAY_Decoder *THEORAPLAY_startDecode(THEORAPLAY_Io *io, 61 | const unsigned int maxframes, 62 | THEORAPLAY_VideoFormat vidfmt, 63 | unsigned int audio_bitstream); 64 | void THEORAPLAY_stopDecode(THEORAPLAY_Decoder *decoder); 65 | 66 | int THEORAPLAY_isDecoding(THEORAPLAY_Decoder *decoder); 67 | int THEORAPLAY_decodingError(THEORAPLAY_Decoder *decoder); 68 | int THEORAPLAY_isInitialized(THEORAPLAY_Decoder *decoder); 69 | int THEORAPLAY_hasVideoStream(THEORAPLAY_Decoder *decoder); 70 | int THEORAPLAY_hasAudioStream(THEORAPLAY_Decoder *decoder); 71 | unsigned int THEORAPLAY_availableVideo(THEORAPLAY_Decoder *decoder); 72 | unsigned int THEORAPLAY_availableAudio(THEORAPLAY_Decoder *decoder); 73 | 74 | const THEORAPLAY_AudioPacket *THEORAPLAY_getAudio(THEORAPLAY_Decoder *decoder); 75 | void THEORAPLAY_freeAudio(const THEORAPLAY_AudioPacket *item); 76 | 77 | const THEORAPLAY_VideoFrame *THEORAPLAY_getVideo(THEORAPLAY_Decoder *decoder); 78 | void THEORAPLAY_freeVideo(const THEORAPLAY_VideoFrame *item); 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | 84 | #endif /* include-once blocker. */ 85 | 86 | /* end of theoraplay.h ... */ 87 | 88 | -------------------------------------------------------------------------------- /dependencies/all/theoraplay/theoraplay_cvtrgb.h: -------------------------------------------------------------------------------- 1 | /** 2 | * TheoraPlay; multithreaded Ogg Theora/Ogg Vorbis decoding. 3 | * 4 | * Please see the file LICENSE.txt in the source's root directory. 5 | * 6 | * This file written by Ryan C. Gordon. 7 | */ 8 | 9 | #if !THEORAPLAY_INTERNAL 10 | #error Do not include this in your app. It is used internally by TheoraPlay. 11 | #endif 12 | 13 | static unsigned char *THEORAPLAY_CVT_FNNAME_420(const th_info *tinfo, 14 | const th_ycbcr_buffer ycbcr) 15 | { 16 | const int w = tinfo->pic_width; 17 | const int h = tinfo->pic_height; 18 | const int halfw = w / 2; 19 | unsigned char *pixels = (unsigned char *) malloc(w * h * 4); 20 | 21 | // http://www.theora.org/doc/Theora.pdf, 1.1 spec, 22 | // chapter 4.2 (Y'CbCr -> Y'PbPr -> R'G'B') 23 | // These constants apparently work for NTSC _and_ PAL/SECAM. 24 | const float yoffset = 16.0f; 25 | const float yexcursion = 219.0f; 26 | const float cboffset = 128.0f; 27 | const float cbexcursion = 224.0f; 28 | const float croffset = 128.0f; 29 | const float crexcursion = 224.0f; 30 | const float kr = 0.299f; 31 | const float kb = 0.114f; 32 | 33 | if (pixels) 34 | { 35 | unsigned char *dst = pixels; 36 | const int ystride = ycbcr[0].stride; 37 | const int cbstride = ycbcr[1].stride; 38 | const int crstride = ycbcr[2].stride; 39 | const int yoff = (tinfo->pic_x & ~1) + ystride * (tinfo->pic_y & ~1); 40 | const int cboff = (tinfo->pic_x / 2) + (cbstride) * (tinfo->pic_y / 2); 41 | const unsigned char *py = ycbcr[0].data + yoff; 42 | const unsigned char *pcb = ycbcr[1].data + cboff; 43 | const unsigned char *pcr = ycbcr[2].data + cboff; 44 | int posy; 45 | 46 | for (posy = 0; posy < h; posy++) 47 | { 48 | int posx, poshalfx; 49 | 50 | posx = 0; 51 | for (poshalfx = 0; poshalfx < halfw; poshalfx++, posx += 2) 52 | { 53 | const float y1 = (((float) py[posx]) - yoffset) / yexcursion; 54 | const float y2 = (((float) py[posx+1]) - yoffset) / yexcursion; 55 | const float pb = (((float) pcb[poshalfx]) - cboffset) / cbexcursion; 56 | const float pr = (((float) pcr[poshalfx]) - croffset) / crexcursion; 57 | const float r1 = (y1 + (2.0f * (1.0f - kr) * pr)) * 255.0f; 58 | const float g1 = (y1 - ((2.0f * (((1.0f - kb) * kb) / ((1.0f - kb) - kr))) * pb) - ((2.0f * (((1.0f - kr) * kr) / ((1.0f - kb) - kr))) * pr)) * 255.0f; 59 | const float b1 = (y1 + (2.0f * (1.0f - kb) * pb)) * 255.0f; 60 | const float r2 = (y2 + (2.0f * (1.0f - kr) * pr)) * 255.0f; 61 | const float g2 = (y2 - ((2.0f * (((1.0f - kb) * kb) / ((1.0f - kb) - kr))) * pb) - ((2.0f * (((1.0f - kr) * kr) / ((1.0f - kb) - kr))) * pr)) * 255.0f; 62 | const float b2 = (y2 + (2.0f * (1.0f - kb) * pb)) * 255.0f; 63 | 64 | *(dst++) = (unsigned char) ((r1 < 0.0f) ? 0.0f : (r1 > 255.0f) ? 255.0f : r1); 65 | *(dst++) = (unsigned char) ((g1 < 0.0f) ? 0.0f : (g1 > 255.0f) ? 255.0f : g1); 66 | *(dst++) = (unsigned char) ((b1 < 0.0f) ? 0.0f : (b1 > 255.0f) ? 255.0f : b1); 67 | #if THEORAPLAY_CVT_RGB_ALPHA 68 | *(dst++) = 0xFF; 69 | #endif 70 | 71 | *(dst++) = (unsigned char) ((r2 < 0.0f) ? 0.0f : (r2 > 255.0f) ? 255.0f : r2); 72 | *(dst++) = (unsigned char) ((g2 < 0.0f) ? 0.0f : (g2 > 255.0f) ? 255.0f : g2); 73 | *(dst++) = (unsigned char) ((b2 < 0.0f) ? 0.0f : (b2 > 255.0f) ? 255.0f : b2); 74 | #if THEORAPLAY_CVT_RGB_ALPHA 75 | *(dst++) = 0xFF; 76 | #endif 77 | } // for 78 | 79 | // adjust to the start of the next line. 80 | py += ystride; 81 | pcb += cbstride * (posy % 2); 82 | pcr += crstride * (posy % 2); 83 | } // for 84 | } // if 85 | 86 | return pixels; 87 | } // THEORAPLAY_CVT_FNNAME_420 88 | 89 | // end of theoraplay_cvtrgb.h ... 90 | 91 | -------------------------------------------------------------------------------- /dependencies/android/dependencies.txt: -------------------------------------------------------------------------------- 1 | SDL2: https://www.libsdl.org/download-2.0.php 2 | Download the source code and unzip it in "./SDL/". 3 | 4 | libogg: https://xiph.org/downloads/ (libogg) 5 | Download libogg and unzip it in "./libogg/". 6 | 7 | libvorbis: https://xiph.org/downloads/ (libvorbis) 8 | Download libvorbis and unzip it in "./libvorbis/". 9 | 10 | libtheora: https://xiph.org/downloads/ (libtheora) 11 | Download libvorbis and unzip it in "./libtheora/". -------------------------------------------------------------------------------- /dependencies/ios/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /dependencies/ios/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /dependencies/ios/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /dependencies/ios/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/ios/Default.png -------------------------------------------------------------------------------- /dependencies/ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | metal 29 | 30 | UIRequiresFullScreen 31 | 32 | UIStatusBarHidden 33 | 34 | UISupportedInterfaceOrientations 35 | 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /dependencies/ios/dependencies.txt: -------------------------------------------------------------------------------- 1 | SDL2: https://www.libsdl.org/download-2.0.php 2 | Download the source for the latest SDL2 version and open the Xcode project in Xcode/, from there you need to build the "Framework-iOS" target to a generic iOS device, then place the built frameworks (hidapi.framework & SDL2.framework) in "./SDL2/" 3 | NOTE: you will need to create a project to build libSDL2Main.a manually, otherwise there will be "undefined references to _main" errors in the main Xcode project 4 | 5 | libogg: https://xiph.org/downloads/ (libogg) 6 | Download the source and create an Xcode project to build the library as a framework, once the framework is built (Ogg.framework), place it in ./ 7 | 8 | libvorbis: https://xiph.org/downloads/ (libvorbis) 9 | Download the source and create an Xcode project to build the library as a framework, once the framework is built (vorbis.framework), place it in ./ 10 | 11 | libtheora: https://xiph.org/downloads/ (libtheora) 12 | Download the source and create an Xcode project to build the library as a framework, once the framework is built (theora.framework), place it in ./ -------------------------------------------------------------------------------- /dependencies/mac/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "RSDKv3 Decomp Icon-16.png", 5 | "idiom" : "mac", 6 | "scale" : "1x", 7 | "size" : "16x16" 8 | }, 9 | { 10 | "filename" : "RSDKv3 Decomp Icon-32.png", 11 | "idiom" : "mac", 12 | "scale" : "2x", 13 | "size" : "16x16" 14 | }, 15 | { 16 | "filename" : "RSDKv3 Decomp Icon-33.png", 17 | "idiom" : "mac", 18 | "scale" : "1x", 19 | "size" : "32x32" 20 | }, 21 | { 22 | "filename" : "RSDKv3 Decomp Icon-64.png", 23 | "idiom" : "mac", 24 | "scale" : "2x", 25 | "size" : "32x32" 26 | }, 27 | { 28 | "filename" : "RSDKv3 Decomp Icon-128.png", 29 | "idiom" : "mac", 30 | "scale" : "1x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "filename" : "RSDKv3 Decomp Icon-256.png", 35 | "idiom" : "mac", 36 | "scale" : "2x", 37 | "size" : "128x128" 38 | }, 39 | { 40 | "filename" : "RSDKv3 Decomp Icon-257.png", 41 | "idiom" : "mac", 42 | "scale" : "1x", 43 | "size" : "256x256" 44 | }, 45 | { 46 | "filename" : "RSDKv3 Decomp Icon-512.png", 47 | "idiom" : "mac", 48 | "scale" : "2x", 49 | "size" : "256x256" 50 | }, 51 | { 52 | "filename" : "RSDKv3 Decomp Icon-513.png", 53 | "idiom" : "mac", 54 | "scale" : "1x", 55 | "size" : "512x512" 56 | }, 57 | { 58 | "filename" : "RSDKv3 Decomp Icon-1024.png", 59 | "idiom" : "mac", 60 | "scale" : "2x", 61 | "size" : "512x512" 62 | } 63 | ], 64 | "info" : { 65 | "author" : "xcode", 66 | "version" : 1 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-1024.png -------------------------------------------------------------------------------- /dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-128.png -------------------------------------------------------------------------------- /dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-16.png -------------------------------------------------------------------------------- /dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-256.png -------------------------------------------------------------------------------- /dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-257.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-257.png -------------------------------------------------------------------------------- /dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-32.png -------------------------------------------------------------------------------- /dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-33.png -------------------------------------------------------------------------------- /dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-512.png -------------------------------------------------------------------------------- /dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-513.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-513.png -------------------------------------------------------------------------------- /dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/Assets.xcassets/AppIcon.appiconset/RSDKv3 Decomp Icon-64.png -------------------------------------------------------------------------------- /dependencies/mac/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /dependencies/mac/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleVersion 22 | 1 23 | LSApplicationCategoryType 24 | public.app-category.games 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2021 Rubberduckycooly. All rights reserved. 29 | NSMainStoryboardFile 30 | Main 31 | NSPrincipalClass 32 | NSApplication 33 | NSSupportsAutomaticTermination 34 | 35 | NSSupportsSuddenTermination 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /dependencies/mac/RSDKv3.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.cs.disable-library-validation 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /dependencies/mac/cocoaHelpers.hpp: -------------------------------------------------------------------------------- 1 | #ifndef COCOA_HELPERS_H 2 | #define COCOA_HELPERS_H 3 | 4 | const char* getResourcesPath(void); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /dependencies/mac/cocoaHelpers.mm: -------------------------------------------------------------------------------- 1 | #ifdef __APPLE__ 2 | 3 | #import 4 | #include "cocoaHelpers.hpp" 5 | 6 | const char* getResourcesPath(void) 7 | { 8 | @autoreleasepool 9 | { 10 | NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); 11 | NSString *applicationSupportDirectory = [paths firstObject]; 12 | 13 | return (char*)[applicationSupportDirectory UTF8String]; 14 | } 15 | } 16 | #endif 17 | -------------------------------------------------------------------------------- /dependencies/mac/dependencies.txt: -------------------------------------------------------------------------------- 1 | SDL2: https://www.libsdl.org/download-2.0.php 2 | just download the appropriate development library for your compiler and place it in "./SDL2/" 3 | 4 | libogg: https://xiph.org/downloads/ (libogg) 5 | download the libogg .zip file and unzip it in "./libogg/", then build the library as a framework, and include it in the xcode proj 6 | 7 | libvorbis: https://xiph.org/downloads/ (libvorbis) 8 | download the libogg .zip file and unzip it in "./libvorbis/", then build the library as a framework, and include it in the xcode proj 9 | 10 | libtheora: https://xiph.org/downloads/ (libtheora) 11 | download the libogg .zip file and unzip it in "./libtheora/", then build the library as a framework, and include it in the xcode proj -------------------------------------------------------------------------------- /dependencies/mac/icons/RSDKv3 Decomp Icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/icons/RSDKv3 Decomp Icon-1024.png -------------------------------------------------------------------------------- /dependencies/mac/icons/RSDKv3 Decomp Icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/icons/RSDKv3 Decomp Icon-128.png -------------------------------------------------------------------------------- /dependencies/mac/icons/RSDKv3 Decomp Icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/icons/RSDKv3 Decomp Icon-16.png -------------------------------------------------------------------------------- /dependencies/mac/icons/RSDKv3 Decomp Icon-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/icons/RSDKv3 Decomp Icon-256.png -------------------------------------------------------------------------------- /dependencies/mac/icons/RSDKv3 Decomp Icon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/icons/RSDKv3 Decomp Icon-32.png -------------------------------------------------------------------------------- /dependencies/mac/icons/RSDKv3 Decomp Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/icons/RSDKv3 Decomp Icon-512.png -------------------------------------------------------------------------------- /dependencies/mac/icons/RSDKv3 Decomp Icon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/dependencies/mac/icons/RSDKv3 Decomp Icon-64.png -------------------------------------------------------------------------------- /dependencies/win-uwp/dependencies.txt: -------------------------------------------------------------------------------- 1 | Download the latest SDL2 source tarball from https://www.libsdl.org/download-2.0.php, and extract it's contents to a folder called `SDL2`. 2 | 3 | If you wish to build ARM/ARM64 architecture variants, be sure to retarget and build libogg, libtheora and libvorbis for these platforms. 4 | You will need to undefine OC_X86_ASM for libtheora to build correctly, and resulting binaries aren't particularly fast, but do run. -------------------------------------------------------------------------------- /dependencies/windows/dependencies.txt: -------------------------------------------------------------------------------- 1 | SDL2: https://www.libsdl.org/download-2.0.php 2 | download the appropriate development library for your compiler and unzip it in "./SDL2/" 3 | 4 | SDL1 (optional, use SDL2 if you're unsure): https://libsdl.org/download-1.2.php 5 | download the appropriate development library for your compiler and unzip it in "./SDL1/" 6 | 7 | libogg: https://xiph.org/downloads/ (libogg) 8 | download libogg and unzip it in "./libogg/", then build the static library 9 | 10 | libvorbis: https://xiph.org/downloads/ (libvorbis) 11 | download libvorbis and unzip it in "./libvorbis/", then build the VS2010 static library (win32/VS2010/vorbis_static.sln) 12 | 13 | libtheora: https://xiph.org/downloads/ (libtheora) 14 | download libtheora and unzip it in "./libtheora/", then build the VS2008 static library (win32/VS2008/libtheora_static.sln) 15 | 16 | glew (only needed for HW renderer): http://glew.sourceforge.net/ download binaries, place the unzipped folder into "./" and rename it to "glew" -------------------------------------------------------------------------------- /header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/header.png -------------------------------------------------------------------------------- /props/winactions.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | C:/vcpkg/installed/x86-windows-static/lib/;$(SolutionDir)dependencies/windows/SDL2/lib/$(PlatformTargetAsMSBuildArchitecture)/ 6 | SDL2.lib;SDL2main.lib;ogg.lib;vorbis.lib;vorbisfile.lib;theora.lib;Shell32.lib;Advapi32.lib 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /props/winactions_HW.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | C:/vcpkg/installed/x86-windows-static/lib/;$(SolutionDir)dependencies/windows/SDL2/lib/$(PlatformTargetAsMSBuildArchitecture)/;$(SolutionDir)dependencies/windows/glew/lib/Release/$(Platform)/ 6 | SDL2.lib;SDL2main.lib;ogg.lib;vorbis.lib;vorbisfile.lib;theora.lib;Opengl32.lib;glu32.lib;glew32.lib;Shell32.lib;Advapi32.lib 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /props/winactions_x64.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | C:/vcpkg/installed/x64-windows-static/lib/;$(SolutionDir)dependencies/windows/SDL2/lib/$(PlatformTargetAsMSBuildArchitecture)/ 6 | SDL2.lib;SDL2main.lib;ogg.lib;vorbis.lib;vorbisfile.lib;theora.lib;Shell32.lib;Advapi32.lib 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /props/winactions_x64_HW.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | C:/vcpkg/installed/x64-windows-static/lib/;$(SolutionDir)dependencies/windows/SDL2/lib/$(PlatformTargetAsMSBuildArchitecture)/;$(SolutionDir)dependencies/windows/glew/lib/Release/$(Platform)/ 6 | SDL2.lib;SDL2main.lib;ogg.lib;vorbis.lib;vorbisfile.lib;theora.lib;Opengl32.lib;glu32.lib;glew32.lib;Shell32.lib;Advapi32.lib 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /resources/24x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/resources/24x24.png -------------------------------------------------------------------------------- /resources/48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/resources/48x48.png -------------------------------------------------------------------------------- /resources/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/resources/banner.png -------------------------------------------------------------------------------- /resources/jingle.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaturnSH2x2/Sonic-CD-11-3DS/8b30cf62f7018efcdee14bdded3fd5405907ddec/resources/jingle.wav --------------------------------------------------------------------------------