├── .clang-format ├── .github └── workflows │ └── switch.yml ├── .gitignore ├── .gitmodules ├── .vscode └── settings.json ├── Android.mk ├── LICENSE.md ├── Makefile ├── Makefile.msys2 ├── Makefile_cfgs └── Platforms │ ├── Linux.cfg │ ├── Switch.cfg │ ├── Unknown.cfg │ ├── WiiU.cfg │ ├── Windows.cfg │ └── macOS.cfg ├── 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 ├── 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 ├── ModAPI.cpp ├── ModAPI.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 │ │ ├── LICENSE.txt │ │ ├── test │ │ ├── maketest.sh │ │ ├── sdltheoraplay.c │ │ ├── simplesdl.c │ │ └── testtheoraplay.c │ │ ├── theoraplay.c │ │ ├── theoraplay.h │ │ └── theoraplay_cvtrgb.h ├── android │ ├── config_types.h │ └── 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 ├── switch │ └── filesystem.hpp ├── win-uwp │ └── dependencies.txt └── windows │ ├── ValveFileVDF │ └── vdf_parser.hpp │ └── dependencies.txt ├── header.png ├── icon.jpg └── props ├── winactions.props └── winactions_x64.props /.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 | -------------------------------------------------------------------------------- /.github/workflows/switch.yml: -------------------------------------------------------------------------------- 1 | name: Nintendo Switch 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-20.04 12 | container: devkitpro/devkita64:20200730 13 | steps: 14 | - name: Checkout repo 15 | uses: actions/checkout@v1 16 | with: 17 | submodules: true 18 | - name: make clean 19 | run: make PLATFORM=Switch clean 20 | - name: make 21 | run: make PLATFORM=Switch 22 | - name: Create directory structure 23 | run: | 24 | mkdir -p bin/Switch/sd/switch/scd2011 25 | mv bin/Switch/scd2011.nro bin/Switch/sd/switch/scd2011/ 26 | - name: Upload artifacts 27 | uses: actions/upload-artifact@v2 28 | with: 29 | path: bin/Switch/sd 30 | -------------------------------------------------------------------------------- /.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 | 22 | # User-specific files (MonoDevelop/Xamarin Studio) 23 | *.userprefs 24 | 25 | # Build results 26 | [Dd]ebug/ 27 | [Dd]ebugPublic/ 28 | [Rr]elease/ 29 | [Rr]eleases/ 30 | [Bb]uild/ 31 | x64/ 32 | x86/ 33 | bld/ 34 | bin/ 35 | [Bb]in/ 36 | [Oo]bj/ 37 | [Oo]bjects/ 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/dependencies.txt 74 | ![Dd]ependencies/windows/dependencies.txt 75 | ![Dd]ependencies/ios/dependencies.txt 76 | ![Dd]ependencies/mac/dependencies.txt 77 | ![Dd]ependencies/windows-uwp/dependencies.txt 78 | ![Dd]ependencies/android/dependencies.txt 79 | ![Dd]ependencies/android/libogg/include/ogg/config_types.h 80 | 81 | SonicCDDecompUWP/Generated Files 82 | SonicCDDecompUWP/BundleArtifacts 83 | SonicCDDecompUWP/Assets/*.png 84 | 85 | # Visual Studio 2015 cache/options directory 86 | .vs/ 87 | 88 | # MSTest test Results 89 | [Tt]est[Rr]esult*/ 90 | [Bb]uild[Ll]og.* 91 | 92 | # NUNIT 93 | *.VisualState.xml 94 | TestResult.xml 95 | 96 | # Build Results of an ATL Project 97 | [Dd]ebugPS/ 98 | [Rr]eleasePS/ 99 | dlldata.c 100 | 101 | # DNX 102 | project.lock.json 103 | artifacts/ 104 | 105 | *_i.c 106 | *_p.c 107 | *_i.h 108 | *.ilk 109 | *.meta 110 | *.obj 111 | *.pch 112 | *.pdb 113 | *.pgc 114 | *.pgd 115 | *.rsp 116 | *.sbr 117 | *.tlb 118 | *.tli 119 | *.tlh 120 | *.tmp 121 | *.tmp_proj 122 | *.log 123 | *.vspscc 124 | *.vssscc 125 | .builds 126 | *.pidb 127 | *.svclog 128 | *.scc 129 | 130 | # Chutzpah Test files 131 | _Chutzpah* 132 | 133 | # Visual C++ cache files 134 | ipch/ 135 | *.aps 136 | *.ncb 137 | *.opensdf 138 | *.sdf 139 | *.cachefile 140 | 141 | # Visual Studio profiler 142 | *.psess 143 | *.vsp 144 | *.vspx 145 | 146 | # TFS 2012 Local Workspace 147 | $tf/ 148 | 149 | # Guidance Automation Toolkit 150 | *.gpState 151 | 152 | # ReSharper is a .NET coding add-in 153 | _ReSharper*/ 154 | *.[Rr]e[Ss]harper 155 | *.DotSettings.user 156 | 157 | # JustCode is a .NET coding add-in 158 | .JustCode 159 | 160 | # TeamCity is a build add-in 161 | _TeamCity* 162 | 163 | # DotCover is a Code Coverage Tool 164 | *.dotCover 165 | 166 | # NCrunch 167 | _NCrunch_* 168 | .*crunch*.local.xml 169 | 170 | # MightyMoose 171 | *.mm.* 172 | AutoTest.Net/ 173 | 174 | # Web workbench (sass) 175 | .sass-cache/ 176 | 177 | # Installshield output folder 178 | [Ee]xpress/ 179 | 180 | # DocProject is a documentation generator add-in 181 | DocProject/buildhelp/ 182 | DocProject/Help/*.HxT 183 | DocProject/Help/*.HxC 184 | DocProject/Help/*.hhc 185 | DocProject/Help/*.hhk 186 | DocProject/Help/*.hhp 187 | DocProject/Help/Html2 188 | DocProject/Help/html 189 | 190 | # Click-Once directory 191 | publish/ 192 | 193 | # Publish Web Output 194 | *.[Pp]ublish.xml 195 | *.azurePubxml 196 | ## TODO: Comment the next line if you want to checkin your 197 | ## web deploy settings but do note that will include unencrypted 198 | ## passwords 199 | #*.pubxml 200 | 201 | *.publishproj 202 | 203 | # NuGet Packages 204 | *.nupkg 205 | # The packages folder can be ignored because of Package Restore 206 | **/packages/* 207 | # except build/, which is used as an MSBuild target. 208 | !**/packages/build/ 209 | # Uncomment if necessary however generally it will be regenerated when needed 210 | #!**/packages/repositories.config 211 | 212 | # Windows Azure Build Output 213 | csx/ 214 | *.build.csdef 215 | 216 | # Windows Store app package directory 217 | AppPackages/ 218 | 219 | # Visual Studio cache files 220 | # files ending in .cache can be ignored 221 | *.[Cc]ache 222 | # but keep track of directories ending in .cache 223 | !*.[Cc]ache/ 224 | 225 | # Others 226 | ClientBin/ 227 | [Ss]tyle[Cc]op.* 228 | ~$* 229 | *~ 230 | *.dbmdl 231 | *.dbproj.schemaview 232 | *.pfx 233 | *.publishsettings 234 | node_modules/ 235 | orleans.codegen.cs 236 | 237 | # RIA/Silverlight projects 238 | Generated_Code/ 239 | 240 | # Backup & report files from converting an old project file 241 | # to a newer Visual Studio version. Backup files are not needed, 242 | # because we have git ;-) 243 | _UpgradeReport_Files/ 244 | Backup*/ 245 | UpgradeLog*.XML 246 | UpgradeLog*.htm 247 | 248 | # SQL Server files 249 | *.mdf 250 | *.ldf 251 | 252 | # Business Intelligence projects 253 | *.rdl.data 254 | *.bim.layout 255 | *.bim_*.settings 256 | 257 | # Microsoft Fakes 258 | FakesAssemblies/ 259 | 260 | # Node.js Tools for Visual Studio 261 | .ntvs_analysis.dat 262 | 263 | # Visual Studio 6 build log 264 | *.plg 265 | 266 | # Visual Studio 6 workspace options file 267 | *.opt 268 | 269 | # LightSwitch generated files 270 | GeneratedArtifacts/ 271 | _Pvt_Extensions/ 272 | ModelManifest.xml 273 | 274 | Ignored/ 275 | 276 | # Android specific 277 | .gradle/ 278 | .idea/ 279 | android/key/ 280 | android/local.properties 281 | *.apk 282 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "dependencies/all/tinyxml2"] 2 | path = dependencies/all/tinyxml2 3 | url = https://github.com/leethomason/tinyxml2 4 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "*.vertex": "glsl", 4 | "*.fragment": "glsl", 5 | "__bit_reference": "cpp", 6 | "__hash_table": "cpp", 7 | "__split_buffer": "cpp", 8 | "__tree": "cpp", 9 | "array": "cpp", 10 | "deque": "cpp", 11 | "filesystem": "cpp", 12 | "initializer_list": "cpp", 13 | "iterator": "cpp", 14 | "map": "cpp", 15 | "string": "cpp", 16 | "string_view": "cpp", 17 | "unordered_map": "cpp", 18 | "unordered_set": "cpp", 19 | "vector": "cpp" 20 | } 21 | } -------------------------------------------------------------------------------- /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 | LOCAL_CPPFLAGS := -std=c++17 82 | APP_CPPFLAGS := -std=c++17 83 | 84 | LOCAL_C_INCLUDES := \ 85 | $(LOCAL_PATH)/$(SDL_PATH)/include \ 86 | $(LOCAL_PATH)/dependencies/all \ 87 | $(LOCAL_PATH)/$(VORBIS_DIR)/include \ 88 | $(LOCAL_PATH)/$(OGG_DIR)/include \ 89 | $(LOCAL_PATH)/$(THEORA_DIR)/include \ 90 | $(LOCAL_PATH)/dependencies/all/theoraplay \ 91 | $(LOCAL_PATH)/dependencies/all/tinyxml2 \ 92 | 93 | 94 | WILDCARD_SETUP := \ 95 | $(wildcard $(LOCAL_PATH)/dependencies/all/theoraplay/*.c) \ 96 | $(wildcard $(LOCAL_PATH)/dependencies/all/tinyxml2/*.cpp) \ 97 | $(wildcard $(LOCAL_PATH)/RSDKv3/*.cpp) 98 | 99 | LOCAL_SRC_FILES := $(subst jni/src/, , $(WILDCARD_SETUP)) 100 | 101 | LOCAL_LDLIBS := -lGLESv1_CM -llog 102 | 103 | LOCAL_SHARED_LIBRARIES := SDL2 libogg libvorbis libtheora 104 | 105 | include $(BUILD_SHARED_LIBRARY) 106 | -------------------------------------------------------------------------------- /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 | .DEFAULT_GOAL := all 2 | 3 | NAME = scd2011 4 | SUFFIX = 5 | PKGCONFIG = pkg-config 6 | DEBUG ?= 0 7 | STATIC ?= 1 8 | VERBOSE ?= 0 9 | PROFILE ?= 0 10 | STRIP ?= strip 11 | 12 | # -fsigned-char required to prevent hang in LoadStageCollisions 13 | CFLAGS ?= -fsigned-char -std=c++17 14 | 15 | # ============================================================================= 16 | # Detect default platform if not explicitly specified 17 | # ============================================================================= 18 | 19 | ifeq ($(OS),Windows_NT) 20 | PLATFORM ?= Windows 21 | else 22 | UNAME_S := $(shell uname -s) 23 | 24 | ifeq ($(UNAME_S),Linux) 25 | PLATFORM ?= Linux 26 | endif 27 | 28 | ifeq ($(UNAME_S),Darwin) 29 | PLATFORM ?= macOS 30 | endif 31 | 32 | endif 33 | 34 | ifdef EMSCRIPTEN 35 | PLATFORM = Emscripten 36 | endif 37 | 38 | PLATFORM ?= Unknown 39 | 40 | # ============================================================================= 41 | 42 | OUTDIR = bin/$(PLATFORM) 43 | OBJDIR = objects/$(PLATFORM) 44 | 45 | include Makefile_cfgs/Platforms/$(PLATFORM).cfg 46 | 47 | # ============================================================================= 48 | 49 | ifeq ($(STATIC),1) 50 | PKGCONFIG += --static 51 | endif 52 | 53 | ifeq ($(DEBUG),1) 54 | CFLAGS += -g 55 | STRIP = : 56 | else 57 | CFLAGS += -O3 58 | endif 59 | 60 | ifeq ($(PROFILE),1) 61 | CFLAGS += -pg -g -fno-inline-functions -fno-inline-functions-called-once -fno-optimize-sibling-calls -fno-default-inline 62 | endif 63 | 64 | ifeq ($(VERBOSE),0) 65 | CC := @$(CC) 66 | CXX := @$(CXX) 67 | endif 68 | 69 | # ============================================================================= 70 | 71 | CFLAGS += `$(PKGCONFIG) --cflags sdl2 ogg vorbis theora vorbisfile theoradec` 72 | LIBS += `$(PKGCONFIG) --libs-only-l --libs-only-L sdl2 ogg vorbis theora vorbisfile theoradec` 73 | 74 | #CFLAGS += -Wno-strict-aliasing -Wno-narrowing -Wno-write-strings 75 | 76 | ifeq ($(STATIC),1) 77 | CFLAGS += -static 78 | endif 79 | 80 | INCLUDES += \ 81 | -I./RSDKv3 \ 82 | -I./dependencies/all/theoraplay \ 83 | -I./dependencies/all/tinyxml2 84 | 85 | INCLUDES += $(LIBS) 86 | 87 | # Main Sources 88 | SOURCES += \ 89 | RSDKv3/Animation \ 90 | RSDKv3/Audio \ 91 | RSDKv3/Collision \ 92 | RSDKv3/Debug \ 93 | RSDKv3/Drawing \ 94 | RSDKv3/fcaseopen \ 95 | RSDKv3/Ini \ 96 | RSDKv3/Input \ 97 | RSDKv3/main \ 98 | RSDKv3/Math \ 99 | RSDKv3/ModAPI \ 100 | RSDKv3/Object \ 101 | RSDKv3/Palette \ 102 | RSDKv3/Player \ 103 | RSDKv3/Reader \ 104 | RSDKv3/RetroEngine \ 105 | RSDKv3/Scene \ 106 | RSDKv3/Scene3D \ 107 | RSDKv3/Script \ 108 | RSDKv3/Sprite \ 109 | RSDKv3/String \ 110 | RSDKv3/Text \ 111 | RSDKv3/Userdata \ 112 | RSDKv3/Video \ 113 | dependencies/all/tinyxml2/tinyxml2 114 | 115 | # Theoraplay sources 116 | SOURCES += dependencies/all/theoraplay/theoraplay 117 | 118 | PKGSUFFIX ?= $(SUFFIX) 119 | 120 | BINPATH = $(OUTDIR)/$(NAME)$(SUFFIX) 121 | PKGPATH = $(OUTDIR)/$(NAME)$(PKGSUFFIX) 122 | 123 | OBJECTS += $(addprefix $(OBJDIR)/, $(addsuffix .o, $(SOURCES))) 124 | 125 | $(shell mkdir -p $(OUTDIR)) 126 | $(shell mkdir -p $(OBJDIR)) 127 | 128 | $(OBJDIR)/%.o: %.c 129 | @mkdir -p $(@D) 130 | @echo -n Compiling $<... 131 | $(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@ 132 | @echo " Done!" 133 | 134 | $(OBJDIR)/%.o: %.cpp 135 | @mkdir -p $(@D) 136 | @echo -n Compiling $<... 137 | $(CXX) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@ 138 | @echo " Done!" 139 | 140 | $(BINPATH): $(OBJDIR) $(OBJECTS) 141 | @echo -n Linking... 142 | $(CXX) $(CFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS) 143 | @echo " Done!" 144 | $(STRIP) $@ 145 | 146 | ifeq ($(BINPATH),$(PKGPATH)) 147 | all: $(BINPATH) 148 | else 149 | all: $(PKGPATH) 150 | endif 151 | 152 | clean: 153 | rm -rf $(OBJDIR) -------------------------------------------------------------------------------- /Makefile.msys2: -------------------------------------------------------------------------------- 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) vorbisfile vorbis theoradec sdl2 glew) $(CXXFLAGS) \ 7 | -DGLEW_STATIC \ 8 | -Idependencies/all/filesystem/include \ 9 | -Idependencies/all/theoraplay 10 | LDFLAGS_ALL += $(LDFLAGS) 11 | LIBS_ALL += $(shell pkg-config --libs $(PKG_CONFIG_STATIC_FLAG) vorbisfile vorbis theoradec sdl2 glew) -lopengl32 -lws2_32 -pthread $(LIBS) 12 | 13 | SOURCES = \ 14 | dependencies/all/tinyxml2/tinyxml2.cpp \ 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/ModAPI.cpp \ 24 | RSDKv3/main.cpp \ 25 | RSDKv3/Math.cpp \ 26 | RSDKv3/Object.cpp \ 27 | RSDKv3/Palette.cpp \ 28 | RSDKv3/Player.cpp \ 29 | RSDKv3/Reader.cpp \ 30 | RSDKv3/RetroEngine.cpp \ 31 | RSDKv3/Scene.cpp \ 32 | RSDKv3/Scene3D.cpp \ 33 | RSDKv3/Script.cpp \ 34 | RSDKv3/Sprite.cpp \ 35 | RSDKv3/String.cpp \ 36 | RSDKv3/Text.cpp \ 37 | RSDKv3/Userdata.cpp \ 38 | RSDKv3/Video.cpp 39 | 40 | 41 | ifeq ($(FORCE_CASE_INSENSITIVE),1) 42 | CXXFLAGS_ALL += -DFORCE_CASE_INSENSITIVE 43 | SOURCES += RSDKv3/fcaseopen.c 44 | endif 45 | 46 | OBJECTS = $(SOURCES:%=objects/%.o) 47 | DEPENDENCIES = $(SOURCES:%=objects/%.d) 48 | 49 | all: bin/RSDKv3 50 | 51 | include $(wildcard $(DEPENDENCIES)) 52 | 53 | objects/%.o: % 54 | mkdir -p $(@D) 55 | $(CXX) $(CXXFLAGS_ALL) -std=c++17 $< -o $@ -c 56 | 57 | bin/RSDKv3: $(OBJECTS) 58 | mkdir -p $(@D) 59 | $(CXX) $(CXXFLAGS_ALL) $(LDFLAGS_ALL) $^ -o $@ $(LIBS_ALL) 60 | 61 | install: bin/RSDKv3 62 | install -Dp -m755 bin/RSDKv3 $(prefix)/bin/RSDKv3 63 | chmod -x $(prefix)/bin/RSDKv3 64 | 65 | clean: 66 | rm -r -f bin && rm -r -f objects 67 | -------------------------------------------------------------------------------- /Makefile_cfgs/Platforms/Linux.cfg: -------------------------------------------------------------------------------- 1 | STATIC = 0 2 | LIBS += -lm -ldl -lpthread -------------------------------------------------------------------------------- /Makefile_cfgs/Platforms/Switch.cfg: -------------------------------------------------------------------------------- 1 | STATIC = 1 2 | 3 | include $(DEVKITPRO)/libnx/switch_rules 4 | PKGCONFIG = $(DEVKITPRO)/portlibs/switch/bin/aarch64-none-elf-pkg-config 5 | STRIP = $(DEVKITPRO)/devkitA64/bin/aarch64-none-elf-strip 6 | NACPTOOL=$(DEVKITPRO)/tools/bin/nacptool 7 | 8 | CFLAGS += -DARM -march=armv8-a -mtune=cortex-a57 -mtp=soft \ 9 | -D__SWITCH__ -fPIE -Wl,--allow-multiple-definition -specs=$(DEVKITPRO)/libnx/switch.specs -mlittle-endian 10 | LDFLAGS += -L$(LIBNX)/lib 11 | LIBS += -lnx 12 | INCLUDES += -I$(LIBNX)/include -I$(PORTLIBS)/include/GLFW -I$(PORTLIBS)/include 13 | INCLUDES += -I./dependencies/switch 14 | 15 | ifdef NXLINK 16 | DEFINES += -DENABLE_NXLINK 17 | endif 18 | 19 | CFLAGS += `$(PKGCONFIG) --cflags libglad egl glesv1_cm` 20 | LIBS += `$(PKGCONFIG) --libs-only-l libglad egl glesv1_cm` 21 | LIBPATHS += `$(PKGCONFIG) --libs-only-L libglad egl glesv1_cm` 22 | 23 | SUFFIX = .elf 24 | PKGSUFFIX = .nro 25 | 26 | $(OUTDIR)/$(NAME)$(PKGSUFFIX): $(OUTDIR)/$(NAME)$(SUFFIX) 27 | @echo -n "Building nro..." 28 | @$(NACPTOOL) --create "Sonic CD" "SEGA, Rubberduckycooly, heyjoeway" "1.0.0" $(OUTDIR)/details.nacp 29 | @elf2nro $< $@ --icon=./icon.jpg --nacp=$(OUTDIR)/details.nacp 30 | @echo " Done!" -------------------------------------------------------------------------------- /Makefile_cfgs/Platforms/Unknown.cfg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/Makefile_cfgs/Platforms/Unknown.cfg -------------------------------------------------------------------------------- /Makefile_cfgs/Platforms/WiiU.cfg: -------------------------------------------------------------------------------- 1 | # Wii U is currently broken! 2 | # Compilation works fine but Wii U crashes instantly. 3 | 4 | STATIC = 1 5 | 6 | BACKEND_VIDEO ?= sdl2 7 | BACKEND_INPUT ?= sdl2 8 | BACKEND_AUDIO ?= null 9 | 10 | 11 | ifeq ($(strip $(DEVKITPPC)),) 12 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") 13 | endif 14 | ifeq ($(strip $(DEVKITPRO)),) 15 | $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPRO") 16 | endif 17 | export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH) 18 | export LIBOGC_INC := $(DEVKITPRO)/libogc/include 19 | export LIBOGC_LIB := $(DEVKITPRO)/libogc/lib/wii 20 | export PORTLIBS := $(DEVKITPRO)/portlibs/ppc 21 | 22 | PREFIX := powerpc-eabi- 23 | 24 | export AS := $(PREFIX)as 25 | export CC := $(PREFIX)gcc 26 | export CXX := $(PREFIX)g++ 27 | export AR := $(PREFIX)ar 28 | export OBJCOPY := $(PREFIX)objcopy 29 | 30 | 31 | 32 | PKGCONFIG = $(DEVKITPRO)/portlibs/wiiu/bin/powerpc-eabi-pkg-config 33 | 34 | 35 | CFLAGS += -std=gnu11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \ 36 | -O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing 37 | # DEFINES += -DHAVE_ALLOCA_H 38 | LIBS += -L$(DEVKITPPC)/lib -L$(DEVKITPPC)/lib/gcc/powerpc-eabi/4.8.2 39 | INCLUDES += -I$(LIBOGC_INC) -I$(DEVKITPRO)/portlibs/wiiu/include/SDL2 -I$(PORTLIBS)/include -I$(DEVKITPRO)/portlibs/wiiu/include -I$(DEVKITPPC)/lib/gcc/powerpc-eabi/4.8.2 40 | 41 | SUFFIX = .elf 42 | 43 | # $(PKGPATH): $(OUTDIR)/$(NAME) 44 | # @echo -n "Building nro..." 45 | # @elf2nro $< $@ $(NROFLAGS) 46 | # @echo " Done!" -------------------------------------------------------------------------------- /Makefile_cfgs/Platforms/Windows.cfg: -------------------------------------------------------------------------------- 1 | #LIBS += -lshlwapi 2 | #OBJECTS += $(OBJDIR)/icon.o 3 | SUFFIX = .exe 4 | STATIC ?= 1 5 | 6 | ifeq ($(DEBUG),1) 7 | LIBS += -mconsole 8 | else 9 | LIBS += -mwindows 10 | endif 11 | 12 | #Compile the Windows icon file into an object 13 | #$(OBJDIR)/icon.o: src/icon.rc src/md.ico 14 | # @mkdir -p $(@D) 15 | # @windres $< $@ -------------------------------------------------------------------------------- /Makefile_cfgs/Platforms/macOS.cfg: -------------------------------------------------------------------------------- 1 | STATIC = 0 2 | LIBS += -lm -ldl -lpthread 3 | DEFINES = -DMACOS -------------------------------------------------------------------------------- /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|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 | -------------------------------------------------------------------------------- /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(RSDKv3) 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 "1.3.0") 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 | ../dependencies/all/tinyxml2 43 | /home/user/vitasdk/arm-vita-eabi/include 44 | ) 45 | 46 | # Add any additional library paths here 47 | # ${CMAKE_CURRENT_BINARY_DIR} lets you use any library currently being built 48 | link_directories( 49 | ${CMAKE_CURRENT_BINARY_DIR} 50 | ) 51 | 52 | ## Build and link 53 | # Add all the files needed to compile here 54 | add_executable(${PROJECT_NAME} 55 | ../dependencies/all/theoraplay/theoraplay.c 56 | ../RSDKv3/Animation.cpp 57 | ../RSDKv3/Audio.cpp 58 | ../RSDKv3/Collision.cpp 59 | ../RSDKv3/Debug.cpp 60 | ../RSDKv3/Drawing.cpp 61 | ../RSDKv3/Ini.cpp 62 | ../RSDKv3/Input.cpp 63 | ../RSDKv3/Math.cpp 64 | ../RSDKv3/ModAPI.cpp 65 | ../RSDKv3/Object.cpp 66 | ../RSDKv3/Palette.cpp 67 | ../RSDKv3/Player.cpp 68 | ../RSDKv3/Reader.cpp 69 | ../RSDKv3/RetroEngine.cpp 70 | ../RSDKv3/Scene.cpp 71 | ../RSDKv3/Scene3D.cpp 72 | ../RSDKv3/Script.cpp 73 | ../RSDKv3/Sprite.cpp 74 | ../RSDKv3/String.cpp 75 | ../RSDKv3/Text.cpp 76 | ../RSDKv3/Userdata.cpp 77 | ../RSDKv3/Video.cpp 78 | ../RSDKv3/main.cpp 79 | ) 80 | 81 | # Library to link to (drop the -l prefix). This will mostly be stubs. 82 | target_link_libraries(${PROJECT_NAME} 83 | SDL2 84 | vita2d 85 | vorbisfile 86 | vorbis 87 | ogg 88 | theora 89 | glew 90 | tinyxml2 91 | pthread 92 | SceDisplay_stub 93 | SceAudio_stub 94 | SceCtrl_stub 95 | SceSysmodule_stub 96 | SceGxm_stub 97 | SceCommonDialog_stub 98 | SceAppMgr_stub 99 | SceTouch_stub 100 | SceHid_stub 101 | SceAudio_stub 102 | SceMotion_stub 103 | m 104 | ) 105 | 106 | ## Create Vita files 107 | vita_create_self(${PROJECT_NAME}.self ${PROJECT_NAME}) 108 | # The FILE directive lets you add additional files to the VPK, the syntax is 109 | # FILE src_path dst_path_in_vpk. In this case, we add the LiveArea paths. 110 | vita_create_vpk(${PROJECT_NAME}.vpk ${VITA_TITLEID} ${PROJECT_NAME}.self 111 | VERSION ${VITA_VERSION} 112 | NAME ${VITA_APP_NAME} 113 | # FILE sce_sys/icon0.png sce_sys/icon0.png 114 | # FILE sce_sys/livearea/contents/bg.png sce_sys/livearea/contents/bg.png 115 | # FILE sce_sys/livearea/contents/startup.png sce_sys/livearea/contents/startup.png 116 | FILE sce_sys/livearea/contents/template.xml sce_sys/livearea/contents/template.xml 117 | ) 118 | -------------------------------------------------------------------------------- /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 RSDKv3 # 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/RSDKv3.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/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 | char fileName[0x20]; 15 | int animCount; 16 | int aniListOffset; 17 | int hitboxListOffset; 18 | }; 19 | 20 | struct SpriteAnimation { 21 | char name[16]; 22 | byte frameCount; 23 | byte speed; 24 | byte loopPoint; 25 | byte rotationFlag; 26 | int frameListOffset; 27 | }; 28 | 29 | struct SpriteFrame { 30 | int sprX; 31 | int sprY; 32 | int width; 33 | int height; 34 | int pivotX; 35 | int pivotY; 36 | byte sheetID; 37 | byte hitboxID; 38 | }; 39 | 40 | struct Hitbox { 41 | sbyte left[HITBOX_DIR_COUNT]; 42 | sbyte top[HITBOX_DIR_COUNT]; 43 | sbyte right[HITBOX_DIR_COUNT]; 44 | sbyte bottom[HITBOX_DIR_COUNT]; 45 | }; 46 | 47 | extern AnimationFile animationFileList[ANIFILE_COUNT]; 48 | extern int animationFileCount; 49 | 50 | extern SpriteFrame scriptFrames[SPRITEFRAME_COUNT]; 51 | extern int scriptFrameCount; 52 | 53 | extern SpriteFrame animFrames[SPRITEFRAME_COUNT]; 54 | extern int animFrameCount; 55 | extern SpriteAnimation animationList[ANIMATION_COUNT]; 56 | extern int animationCount; 57 | extern Hitbox hitboxList[HITBOX_COUNT]; 58 | extern int hitboxCount; 59 | 60 | void LoadAnimationFile(const char *FilePath); 61 | void ClearAnimationData(); 62 | 63 | AnimationFile *AddAnimationFile(const char *FilePath); 64 | 65 | inline AnimationFile *GetDefaultAnimationRef() { return &animationFileList[0]; } 66 | 67 | void ProcessObjectAnimation(void *objScr, void *ent); 68 | 69 | #endif // !ANIMATION_H 70 | -------------------------------------------------------------------------------- /RSDKv3/Audio.hpp: -------------------------------------------------------------------------------- 1 | #ifndef AUDIO_H 2 | #define AUDIO_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #if RETRO_PLATFORM != RETRO_VITA && RETRO_PLATFORM != RETRO_OSX 9 | #include "SDL.h" 10 | #endif 11 | 12 | #define TRACK_COUNT (0x10) 13 | #define SFX_COUNT (0x100) 14 | #define CHANNEL_COUNT (0x4) 15 | #define SFXDATA_COUNT (0x400000) 16 | 17 | #define MAX_VOLUME (100) 18 | 19 | #define STREAMFILE_COUNT (2) 20 | 21 | #define MIX_BUFFER_SAMPLES (256) 22 | 23 | struct TrackInfo { 24 | char fileName[0x40]; 25 | bool trackLoop; 26 | uint loopPoint; 27 | }; 28 | 29 | struct StreamInfo { 30 | OggVorbis_File vorbisFile; 31 | int vorbBitstream; 32 | #if RETRO_USING_SDL1 33 | SDL_AudioSpec spec; 34 | #endif 35 | #if RETRO_USING_SDL2 36 | SDL_AudioStream *stream; 37 | #endif 38 | Sint16 buffer[MIX_BUFFER_SAMPLES]; 39 | bool trackLoop; 40 | uint loopPoint; 41 | bool loaded; 42 | }; 43 | 44 | struct SFXInfo { 45 | char name[0x40]; 46 | Sint16 *buffer; 47 | size_t length; 48 | bool loaded; 49 | }; 50 | 51 | struct ChannelInfo { 52 | size_t sampleLength; 53 | Sint16 *samplePtr; 54 | int sfxID; 55 | byte loopSFX; 56 | sbyte pan; 57 | }; 58 | 59 | struct StreamFile { 60 | byte *buffer; 61 | int fileSize; 62 | int filePos; 63 | }; 64 | 65 | enum MusicStatuses { 66 | MUSIC_STOPPED = 0, 67 | MUSIC_PLAYING = 1, 68 | MUSIC_PAUSED = 2, 69 | MUSIC_LOADING = 3, 70 | MUSIC_READY = 4, 71 | }; 72 | 73 | extern int globalSFXCount; 74 | extern int stageSFXCount; 75 | 76 | extern int masterVolume; 77 | extern int trackID; 78 | extern int sfxVolume; 79 | extern int bgmVolume; 80 | extern bool audioEnabled; 81 | 82 | extern int nextChannelPos; 83 | extern bool musicEnabled; 84 | extern int musicStatus; 85 | extern TrackInfo musicTracks[TRACK_COUNT]; 86 | extern SFXInfo sfxList[SFX_COUNT]; 87 | 88 | extern ChannelInfo sfxChannels[CHANNEL_COUNT]; 89 | 90 | extern int currentStreamIndex; 91 | extern StreamFile streamFile[STREAMFILE_COUNT]; 92 | extern StreamInfo streamInfo[STREAMFILE_COUNT]; 93 | extern StreamFile *streamFilePtr; 94 | extern StreamInfo *streamInfoPtr; 95 | 96 | #if RETRO_USING_SDL1 || RETRO_USING_SDL2 97 | extern SDL_AudioSpec audioDeviceFormat; 98 | #endif 99 | 100 | int InitAudioPlayback(); 101 | void LoadGlobalSfx(); 102 | 103 | #if RETRO_USING_SDL1 || RETRO_USING_SDL2 104 | void ProcessMusicStream(void *data, Sint16 *stream, int len); 105 | void ProcessAudioPlayback(void *data, Uint8 *stream, int len); 106 | void ProcessAudioMixing(Sint32 *dst, const Sint16 *src, int len, int volume, sbyte pan); 107 | 108 | inline void freeMusInfo() 109 | { 110 | SDL_LockAudio(); 111 | 112 | #if RETRO_USING_SDL2 113 | if (streamInfo[currentStreamIndex].stream) 114 | SDL_FreeAudioStream(streamInfo[currentStreamIndex].stream); 115 | #endif 116 | ov_clear(&streamInfo[currentStreamIndex].vorbisFile); 117 | #if RETRO_USING_SDL2 118 | streamInfo[currentStreamIndex].stream = nullptr; 119 | #endif 120 | if (streamFile[currentStreamIndex].buffer) 121 | free(streamFile[currentStreamIndex].buffer); 122 | streamFile[currentStreamIndex].buffer = NULL; 123 | 124 | SDL_UnlockAudio(); 125 | } 126 | #else 127 | void ProcessMusicStream() {} 128 | void ProcessAudioPlayback() {} 129 | void ProcessAudioMixing() {} 130 | 131 | inline void freeMusInfo() { ov_clear(&streamInfo[currentStreamIndex].vorbisFile); } 132 | #endif 133 | 134 | #if RETRO_USE_MOD_LOADER 135 | extern char globalSfxNames[SFX_COUNT][0x40]; 136 | extern char stageSfxNames[SFX_COUNT][0x40]; 137 | void SetSfxName(const char *sfxName, int sfxID, bool global); 138 | #endif 139 | 140 | void LoadMusic(); 141 | void SetMusicTrack(char *filePath, byte trackID, bool loop, uint loopPoint); 142 | bool PlayMusic(int track); 143 | inline void StopMusic() 144 | { 145 | musicStatus = MUSIC_STOPPED; 146 | freeMusInfo(); 147 | } 148 | 149 | void LoadSfx(char *filePath, byte sfxID); 150 | void PlaySfx(int sfx, bool loop); 151 | inline void StopSfx(int sfx) 152 | { 153 | for (int i = 0; i < CHANNEL_COUNT; ++i) { 154 | if (sfxChannels[i].sfxID == sfx) { 155 | MEM_ZERO(sfxChannels[i]); 156 | sfxChannels[i].sfxID = -1; 157 | } 158 | } 159 | } 160 | void SetSfxAttributes(int sfx, int loopCount, sbyte pan); 161 | 162 | inline void SetMusicVolume(int volume) 163 | { 164 | if (volume < 0) 165 | volume = 0; 166 | if (volume > MAX_VOLUME) 167 | volume = MAX_VOLUME; 168 | masterVolume = volume; 169 | } 170 | 171 | inline void PauseSound() 172 | { 173 | if (musicStatus == MUSIC_PLAYING) 174 | musicStatus = MUSIC_PAUSED; 175 | } 176 | 177 | inline void ResumeSound() 178 | { 179 | if (musicStatus == MUSIC_PAUSED) 180 | musicStatus = MUSIC_PLAYING; 181 | } 182 | 183 | inline void StopAllSfx() 184 | { 185 | for (int i = 0; i < CHANNEL_COUNT; ++i) sfxChannels[i].sfxID = -1; 186 | } 187 | inline void ReleaseGlobalSfx() 188 | { 189 | StopAllSfx(); 190 | for (int i = globalSFXCount - 1; i >= 0; --i) { 191 | if (sfxList[i].loaded) { 192 | StrCopy(sfxList[i].name, ""); 193 | free(sfxList[i].buffer); 194 | sfxList[i].length = 0; 195 | sfxList[i].loaded = false; 196 | } 197 | } 198 | globalSFXCount = 0; 199 | } 200 | inline void ReleaseStageSfx() 201 | { 202 | for (int i = stageSFXCount + globalSFXCount; i >= globalSFXCount; --i) { 203 | if (sfxList[i].loaded) { 204 | StrCopy(sfxList[i].name, ""); 205 | free(sfxList[i].buffer); 206 | sfxList[i].length = 0; 207 | sfxList[i].loaded = false; 208 | } 209 | } 210 | stageSFXCount = 0; 211 | } 212 | 213 | inline void ReleaseAudioDevice() 214 | { 215 | StopMusic(); 216 | StopAllSfx(); 217 | ReleaseStageSfx(); 218 | ReleaseGlobalSfx(); 219 | } 220 | 221 | #endif // !AUDIO_H 222 | -------------------------------------------------------------------------------- /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 | int XPos; 34 | int YPos; 35 | int angle; 36 | bool collided; 37 | }; 38 | 39 | #if !RETRO_USE_ORIGINAL_CODE 40 | #define DEBUG_HITBOX_MAX (0x400) 41 | 42 | struct DebugHitboxInfo { 43 | byte type; 44 | byte collision; 45 | short left; 46 | short top; 47 | short right; 48 | short bottom; 49 | int XPos; 50 | int YPos; 51 | Entity *entity; 52 | }; 53 | 54 | enum DebugHitboxTypes { H_TYPE_TOUCH, H_TYPE_BOX, H_TYPE_PLAT }; 55 | 56 | extern bool showHitboxes; 57 | extern int debugHitboxCount; 58 | extern DebugHitboxInfo debugHitboxList[DEBUG_HITBOX_MAX]; 59 | 60 | int addDebugHitbox(byte type, Entity *entity, int left, int top, int right, int bottom); 61 | #endif 62 | 63 | extern int collisionLeft; 64 | extern int collisionTop; 65 | extern int collisionRight; 66 | extern int collisionBottom; 67 | 68 | extern CollisionSensor sensors[6]; 69 | 70 | void FindFloorPosition(Player *player, CollisionSensor *sensor, int startYPos); 71 | void FindLWallPosition(Player *player, CollisionSensor *sensor, int startXPos); 72 | void FindRoofPosition(Player *player, CollisionSensor *sensor, int startYPos); 73 | void FindRWallPosition(Player *player, CollisionSensor *sensor, int startXPos); 74 | void FloorCollision(Player *player, CollisionSensor *sensor); 75 | void LWallCollision(Player *player, CollisionSensor *sensor); 76 | void RoofCollision(Player *player, CollisionSensor *sensor); 77 | void RWallCollision(Player *player, CollisionSensor *sensor); 78 | void SetPathGripSensors(Player *player); 79 | 80 | void ProcessPathGrip(Player *player); 81 | void ProcessAirCollision(Player *player); 82 | 83 | void ProcessPlayerTileCollisions(Player *player); 84 | 85 | void TouchCollision(int left, int top, int right, int bottom); 86 | void BoxCollision(int left, int top, int right, int bottom); // Standard 87 | void BoxCollision2(int left, int top, int right, int bottom); // Updated (?) 88 | void PlatformCollision(int left, int top, int right, int bottom); 89 | 90 | void ObjectFloorCollision(int xOffset, int yOffset, int cPath); 91 | void ObjectLWallCollision(int xOffset, int yOffset, int cPath); 92 | void ObjectRoofCollision(int xOffset, int yOffset, int cPath); 93 | void ObjectRWallCollision(int xOffset, int yOffset, int cPath); 94 | 95 | void ObjectFloorGrip(int xOffset, int yOffset, int cPath); 96 | void ObjectLWallGrip(int xOffset, int yOffset, int cPath); 97 | void ObjectRoofGrip(int xOffset, int yOffset, int cPath); 98 | void ObjectRWallGrip(int xOffset, int yOffset, int cPath); 99 | 100 | #endif // !COLLISION_H 101 | -------------------------------------------------------------------------------- /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, "RSDKv3", "%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.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DRAWING_H 2 | #define DRAWING_H 3 | 4 | #define SURFACE_MAX (24) 5 | #define GFXDATA_MAX (0x800 * 0x800) 6 | 7 | #define BLENDTABLE_YSIZE (0x100) 8 | #define BLENDTABLE_XSIZE (0x20) 9 | #define BLENDTABLE_SIZE (BLENDTABLE_XSIZE * BLENDTABLE_YSIZE) 10 | #define TINTTABLE_SIZE (0x1000) 11 | 12 | #define DRAWLAYER_COUNT (7) 13 | 14 | enum FlipFlags { FLIP_NONE, FLIP_X, FLIP_Y, FLIP_XY }; 15 | enum InkFlags { INK_NONE, INK_BLEND, INK_ALPHA, INK_ADD, INK_SUB }; 16 | enum DrawFXFlags { FX_SCALE, FX_ROTATE, FX_ROTOZOOM, FX_INK, FX_TINT, FX_FLIP }; 17 | 18 | struct DrawListEntry { 19 | int entityRefs[ENTITY_COUNT]; 20 | int listSize; 21 | }; 22 | 23 | struct GFXSurface { 24 | char fileName[0x40]; 25 | int height; 26 | int width; 27 | int widthShifted; 28 | int texStartX; 29 | int texStartY; 30 | int dataPosition; 31 | }; 32 | 33 | extern short blendLookupTable[BLENDTABLE_SIZE]; 34 | extern short subtractLookupTable[BLENDTABLE_SIZE]; 35 | extern short tintLookupTable[TINTTABLE_SIZE]; 36 | 37 | extern int SCREEN_XSIZE; 38 | extern int SCREEN_CENTERX; 39 | extern int SCREEN_XSIZE_CONFIG; 40 | 41 | extern int touchWidth; 42 | extern int touchHeight; 43 | 44 | extern float videoAR; 45 | extern bool videoPlaying; 46 | 47 | extern DrawListEntry drawListEntries[DRAWLAYER_COUNT]; 48 | 49 | extern int gfxDataPosition; 50 | extern GFXSurface gfxSurface[SURFACE_MAX]; 51 | extern byte graphicData[GFXDATA_MAX]; 52 | 53 | #define VERTEX_LIMIT (0x2000) 54 | #define INDEX_LIMIT (VERTEX_LIMIT * 6) 55 | #define VERTEX3D_LIMIT (0x1904) 56 | #define TILEUV_SIZE (0x1000) 57 | #define HW_TEXTURE_LIMIT (6) 58 | #define HW_TEXTURE_SIZE (0x400) 59 | #define HW_TEXTURE_DATASIZE (HW_TEXTURE_SIZE * HW_TEXTURE_SIZE * 2) 60 | #define HW_TEXBUFFER_SIZE (HW_TEXTURE_SIZE * HW_TEXTURE_SIZE) 61 | 62 | struct DrawVertex { 63 | short x; 64 | short y; 65 | short u; 66 | short v; 67 | 68 | Colour colour; 69 | }; 70 | 71 | struct DrawVertex3D { 72 | float x; 73 | float y; 74 | float z; 75 | short u; 76 | short v; 77 | 78 | Colour colour; 79 | }; 80 | 81 | extern DrawVertex gfxPolyList[VERTEX_LIMIT]; 82 | extern short gfxPolyListIndex[INDEX_LIMIT]; 83 | extern ushort gfxVertexSize; 84 | extern ushort gfxVertexSizeOpaque; 85 | extern ushort gfxIndexSize; 86 | extern ushort gfxIndexSizeOpaque; 87 | 88 | extern DrawVertex3D polyList3D[VERTEX3D_LIMIT]; 89 | 90 | extern ushort vertexSize3D; 91 | extern ushort indexSize3D; 92 | extern ushort tileUVArray[TILEUV_SIZE]; 93 | extern float floor3DXPos; 94 | extern float floor3DYPos; 95 | extern float floor3DZPos; 96 | extern float floor3DAngle; 97 | extern bool render3DEnabled; 98 | extern bool hq3DFloorEnabled; 99 | 100 | extern ushort texBuffer[HW_TEXBUFFER_SIZE]; 101 | extern byte texBufferMode; 102 | 103 | #if !RETRO_USE_ORIGINAL_CODE 104 | extern int viewOffsetX; 105 | #endif 106 | extern int viewWidth; 107 | extern int viewHeight; 108 | extern float viewAspect; 109 | extern int bufferWidth; 110 | extern int bufferHeight; 111 | extern int virtualX; 112 | extern int virtualY; 113 | extern int virtualWidth; 114 | extern int virtualHeight; 115 | extern float viewAngle; 116 | extern float viewAnglePos; 117 | 118 | #if RETRO_USING_OPENGL 119 | extern GLuint gfxTextureID[HW_TEXTURE_LIMIT]; 120 | extern GLuint framebufferHW; 121 | extern GLuint renderbufferHW; 122 | extern GLuint retroBuffer; 123 | extern GLuint retroBuffer2x; 124 | extern GLuint videoBuffer; 125 | #endif 126 | extern DrawVertex screenRect[4]; 127 | extern DrawVertex retroScreenRect[4]; 128 | 129 | int InitRenderDevice(); 130 | void FlipScreen(); 131 | void FlipScreenFB(); 132 | void FlipScreenNoFB(); 133 | void FlipScreenHRes(); 134 | void RenderFromTexture(); 135 | void RenderFromRetroBuffer(); 136 | 137 | void FlipScreenVideo(); 138 | 139 | void ReleaseRenderDevice(); 140 | 141 | void setFullScreen(bool fs); 142 | 143 | void GenerateBlendLookupTable(); 144 | 145 | inline void ClearGraphicsData() 146 | { 147 | for (int i = 0; i < SURFACE_MAX; ++i) StrCopy(gfxSurface[i].fileName, ""); 148 | gfxDataPosition = 0; 149 | } 150 | void ClearScreen(byte index); 151 | 152 | void SetScreenSize(int width, int height); 153 | void CopyFrameOverlay2x(); 154 | void TransferRetroBuffer(); 155 | 156 | inline bool CheckSurfaceSize(int size) 157 | { 158 | for (int cnt = 2; cnt < 2048; cnt <<= 1) { 159 | if (cnt == size) 160 | return true; 161 | } 162 | return false; 163 | } 164 | 165 | void UpdateHardwareTextures(); 166 | void SetScreenDimensions(int width, int height, int winWidth, int winHeight); 167 | void ScaleViewport(int width, int height); 168 | void CalcPerspective(float fov, float aspectRatio, float nearPlane, float farPlane); 169 | 170 | void SetupPolygonLists(); 171 | void UpdateTextureBufferWithTiles(); 172 | void UpdateTextureBufferWithSortedSprites(); 173 | void UpdateTextureBufferWithSprites(); 174 | 175 | // Layer Drawing 176 | void DrawObjectList(int layer); 177 | void DrawStageGFX(); 178 | 179 | // TileLayer Drawing 180 | void DrawHLineScrollLayer(int layerID); 181 | void DrawVLineScrollLayer(int layerID); 182 | void Draw3DFloorLayer(int layerID); 183 | void Draw3DSkyLayer(int layerID); 184 | 185 | // Shape Drawing 186 | void DrawRectangle(int XPos, int YPos, int width, int height, int R, int G, int B, int A); 187 | void SetFadeHQ(int R, int G, int B, int A); 188 | void DrawTintRectangle(int XPos, int YPos, int width, int height); 189 | void DrawScaledTintMask(int direction, int XPos, int YPos, int pivotX, int pivotY, int scaleX, int scaleY, int width, int height, int sprX, int sprY, 190 | int sheetID); 191 | 192 | // Sprite Drawing 193 | void DrawSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int sheetID); 194 | void DrawSpriteFlipped(int XPos, int YPos, int width, int height, int sprX, int sprY, int direction, int sheetID); 195 | void DrawSpriteScaled(int direction, int XPos, int YPos, int pivotX, int pivotY, int scaleX, int scaleY, int width, int height, int sprX, int sprY, 196 | int sheetID); 197 | void DrawScaledChar(int direction, int XPos, int YPos, int pivotX, int pivotY, int scaleX, int scaleY, int width, int height, int sprX, int sprY, 198 | int sheetID); 199 | void DrawSpriteRotated(int direction, int XPos, int YPos, int pivotX, int pivotY, int sprX, int sprY, int width, int height, int rotation, 200 | int sheetID); 201 | void DrawSpriteRotozoom(int direction, int XPos, int YPos, int pivotX, int pivotY, int sprX, int sprY, int width, int height, int rotation, int scale, 202 | int sheetID); 203 | 204 | void DrawBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int sheetID); 205 | void DrawAlphaBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int alpha, int sheetID); 206 | void DrawAdditiveBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int alpha, int sheetID); 207 | void DrawSubtractiveBlendedSprite(int XPos, int YPos, int width, int height, int sprX, int sprY, int alpha, int sheetID); 208 | 209 | void DrawObjectAnimation(void *objScr, void *ent, int XPos, int YPos); 210 | 211 | void DrawFace(void *v, uint colour); 212 | void DrawTexturedFace(void *v, byte sheetID); 213 | 214 | void DrawBitmapText(void *menu, int XPos, int YPos, int scale, int spacing, int rowStart, int rowCount); 215 | 216 | void DrawTextMenu(void *menu, int XPos, int YPos); 217 | void DrawTextMenuEntry(void *menu, int rowID, int XPos, int YPos, int textHighlight); 218 | void DrawStageTextEntry(void *menu, int rowID, int XPos, int YPos, int textHighlight); 219 | void DrawBlendedTextMenuEntry(void *menu, int rowID, int XPos, int YPos, int textHighlight); 220 | void DrawBitmapText(void *menu, int XPos, int YPos, int scale, int spacing, int rowStart, int rowCount); 221 | 222 | #endif // !DRAWING_H 223 | -------------------------------------------------------------------------------- /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 | struct InputButton { 29 | bool press, hold; 30 | int keyMappings, contMappings; 31 | 32 | inline void setHeld() 33 | { 34 | press = !hold; 35 | hold = true; 36 | } 37 | inline void setReleased() 38 | { 39 | press = false; 40 | hold = false; 41 | } 42 | 43 | inline bool down() { return (press || hold); } 44 | }; 45 | 46 | enum DefaultHapticIDs { 47 | HAPTIC_NONE = -2, 48 | HAPTIC_STOP = -1, 49 | }; 50 | 51 | extern InputData keyPress; 52 | extern InputData keyDown; 53 | 54 | extern bool anyPress; 55 | 56 | extern int touchDown[8]; 57 | extern int touchX[8]; 58 | extern int touchY[8]; 59 | extern int touchID[8]; 60 | extern int touches; 61 | 62 | extern int hapticEffectNum; 63 | 64 | #if !RETRO_USE_ORIGINAL_CODE 65 | extern InputButton inputDevice[INPUT_MAX]; 66 | extern int inputType; 67 | 68 | extern float LSTICK_DEADZONE; 69 | extern float RSTICK_DEADZONE; 70 | extern float LTRIGGER_DEADZONE; 71 | extern float RTRIGGER_DEADZONE; 72 | 73 | extern int mouseHideTimer; 74 | #endif 75 | 76 | #if !RETRO_USE_ORIGINAL_CODE 77 | #if RETRO_USING_SDL2 78 | // Easier this way 79 | enum ExtraSDLButtons { 80 | SDL_CONTROLLER_BUTTON_ZL = SDL_CONTROLLER_BUTTON_MAX + 1, 81 | SDL_CONTROLLER_BUTTON_ZR, 82 | SDL_CONTROLLER_BUTTON_LSTICK_UP, 83 | SDL_CONTROLLER_BUTTON_LSTICK_DOWN, 84 | SDL_CONTROLLER_BUTTON_LSTICK_LEFT, 85 | SDL_CONTROLLER_BUTTON_LSTICK_RIGHT, 86 | SDL_CONTROLLER_BUTTON_RSTICK_UP, 87 | SDL_CONTROLLER_BUTTON_RSTICK_DOWN, 88 | SDL_CONTROLLER_BUTTON_RSTICK_LEFT, 89 | SDL_CONTROLLER_BUTTON_RSTICK_RIGHT, 90 | SDL_CONTROLLER_BUTTON_MAX_EXTRA, 91 | }; 92 | 93 | void controllerInit(byte controllerID); 94 | void controllerClose(byte controllerID); 95 | #endif 96 | 97 | #if RETRO_USING_SDL1 98 | extern byte keyState[SDLK_LAST]; 99 | 100 | extern SDL_Joystick *controller; 101 | #endif 102 | 103 | void ProcessInput(); 104 | #endif 105 | 106 | void CheckKeyPress(InputData *input, byte Flags); 107 | void CheckKeyDown(InputData *input, byte Flags); 108 | 109 | inline int GetHapticEffectNum() 110 | { 111 | int num = hapticEffectNum; 112 | hapticEffectNum = HAPTIC_NONE; 113 | return num; 114 | } 115 | void QueueHapticEffect(int hapticID); 116 | void PlayHaptics(int left, int right, int power); 117 | void PlayHapticsID(int hapticID); 118 | void StopHaptics(int hapticID); 119 | 120 | #endif // !INPUT_H 121 | -------------------------------------------------------------------------------- /RSDKv3/Math.cpp: -------------------------------------------------------------------------------- 1 | #include "RetroEngine.hpp" 2 | #include 3 | #include 4 | 5 | #ifndef M_PI 6 | #define M_PI 3.14159265358979323846264338327950288 7 | #endif 8 | 9 | int sinM[512]; 10 | int cosM[512]; 11 | 12 | int sinVal512[512]; 13 | int cosVal512[512]; 14 | 15 | int sinVal256[256]; 16 | int cosVal256[256]; 17 | 18 | byte atanVal256[0x100 * 0x100]; 19 | 20 | void CalculateTrigAngles() 21 | { 22 | srand((unsigned)time(NULL)); 23 | 24 | for (int i = 0; i < 0x200; ++i) { 25 | float Val = sin(((float)i / 256.0) * M_PI); 26 | sinM[i] = (Val * 4096.0); 27 | Val = cos(((float)i / 256.0) * M_PI); 28 | cosM[i] = (Val * 4096.0); 29 | } 30 | 31 | cosM[0] = 4096; 32 | cosM[128] = 0; 33 | cosM[256] = -4096; 34 | cosM[384] = 0; 35 | sinM[0] = 0; 36 | sinM[128] = 4096; 37 | sinM[256] = 0; 38 | sinM[384] = -4096; 39 | 40 | for (int i = 0; i < 0x200; ++i) { 41 | float Val = sinf(((float)i / 256) * M_PI); 42 | sinVal512[i] = (signed int)(Val * 512.0); 43 | Val = cosf(((float)i / 256) * M_PI); 44 | cosVal512[i] = (signed int)(Val * 512.0); 45 | } 46 | 47 | cosVal512[0] = 0x200; 48 | cosVal512[128] = 0; 49 | cosVal512[256] = -0x200; 50 | cosVal512[384] = 0; 51 | sinVal512[0] = 0; 52 | sinVal512[128] = 0x200; 53 | sinVal512[256] = 0; 54 | sinVal512[384] = -0x200; 55 | 56 | for (int i = 0; i < 0x100; i++) { 57 | sinVal256[i] = (sinVal512[i * 2] >> 1); 58 | cosVal256[i] = (cosVal512[i * 2] >> 1); 59 | } 60 | 61 | for (int Y = 0; Y < 0x100; ++Y) { 62 | byte *ATan = (byte *)&atanVal256[Y]; 63 | for (int X = 0; X < 0x100; ++X) { 64 | float angle = atan2f(Y, X); 65 | *ATan = (signed int)(angle * 40.743664f); 66 | ATan += 0x100; 67 | } 68 | } 69 | } 70 | 71 | byte ArcTanLookup(int X, int Y) 72 | { 73 | int XVal; 74 | byte result = 0; 75 | int YVal; 76 | 77 | if (X >= 0) 78 | XVal = X; 79 | else 80 | XVal = -X; 81 | 82 | if (Y >= 0) 83 | YVal = Y; 84 | else 85 | YVal = -Y; 86 | 87 | if (XVal <= YVal) { 88 | while (YVal > 0xFF) { 89 | XVal >>= 4; 90 | YVal >>= 4; 91 | } 92 | } 93 | else { 94 | while (XVal > 0xFF) { 95 | XVal >>= 4; 96 | YVal >>= 4; 97 | } 98 | } 99 | if (X <= 0) { 100 | if (Y <= 0) 101 | result = atanVal256[0x100 * XVal + YVal] + -0x80; 102 | else 103 | result = -0x80 - atanVal256[0x100 * XVal + YVal]; 104 | } 105 | else if (Y <= 0) 106 | result = -atanVal256[0x100 * XVal + YVal]; 107 | else 108 | result = atanVal256[0x100 * XVal + YVal]; 109 | return result; 110 | } 111 | -------------------------------------------------------------------------------- /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 | { 25 | if (angle < 0) 26 | angle = 0x200 - angle; 27 | angle &= 0x1FFu; 28 | return sinVal512[angle]; 29 | } 30 | 31 | inline int cos512(int angle) 32 | { 33 | if (angle < 0) 34 | angle = 0x200 - angle; 35 | angle &= 0x1FFu; 36 | return cosVal512[angle]; 37 | } 38 | 39 | inline int sin256(int angle) 40 | { 41 | if (angle < 0) 42 | angle = 0x100 - angle; 43 | angle &= 0xFFu; 44 | return sinVal256[angle]; 45 | } 46 | 47 | inline int cos256(int angle) 48 | { 49 | if (angle < 0) 50 | angle = 0x100 - angle; 51 | angle &= 0xFFu; 52 | return cosVal256[angle]; 53 | } 54 | 55 | // Get Arc Tan value 56 | byte ArcTanLookup(int X, int Y); 57 | 58 | #endif // !MATH_H 59 | -------------------------------------------------------------------------------- /RSDKv3/ModAPI.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MOD_API_H 2 | #define MOD_API_H 3 | 4 | #if RETRO_USE_MOD_LOADER 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define PLAYER_MAX (0x10) 11 | 12 | struct ModInfo { 13 | std::string name; 14 | std::string desc; 15 | std::string author; 16 | std::string version; 17 | std::map fileMap; 18 | std::string folder; 19 | bool useScripts; 20 | bool disableFocusPause; 21 | bool redirectSave; 22 | std::string savePath; 23 | bool active; 24 | }; 25 | 26 | extern std::vector modList; 27 | extern int activeMod; 28 | 29 | extern char modsPath[0x100]; 30 | 31 | extern bool redirectSave; 32 | extern char savePath[0x100]; 33 | 34 | extern char modTypeNames[OBJECT_COUNT][0x40]; 35 | extern char modScriptPaths[OBJECT_COUNT][0x40]; 36 | extern byte modScriptFlags[OBJECT_COUNT]; 37 | extern byte modObjCount; 38 | 39 | extern char playerNames[PLAYER_MAX][0x20]; 40 | extern byte playerCount; 41 | 42 | inline void SetActiveMod(int id) { activeMod = id; } 43 | 44 | void initMods(); 45 | bool loadMod(ModInfo *info, std::string modsPath, std::string folder, bool active); 46 | void scanModFolder(ModInfo *info); 47 | void saveMods(); 48 | 49 | int OpenModMenu(); 50 | 51 | void RefreshEngine(); 52 | 53 | int GetSceneID(byte listID, const char *sceneName); 54 | 55 | #endif 56 | 57 | #endif -------------------------------------------------------------------------------- /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 && y > yScrollOffset - OBJECT_BORDER_Y1 63 | && 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 || y <= yScrollOffset - OBJECT_BORDER_Y1 75 | || 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 | int texPaletteNum = 0; 22 | 23 | uint gfxPalette16to32[0x10000]; 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 | PACK_RGB888(activePalette[i], (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 (renderType == RENDER_HW) 79 | activePalette[i] |= 1; 80 | } 81 | } -------------------------------------------------------------------------------- /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 | extern int texPaletteNum; 37 | 38 | extern uint gfxPalette16to32[0x10000]; 39 | 40 | #define RGB888_TO_RGB5551(r, g, b) ((((b) >> 3) << 1) | (((g) >> 3) << 6) | (((r) >> 3) << 11) | 0) // used in mobile vers 41 | #define RGB888_TO_RGB565(r, g, b) ((b) >> 3) | (((g) >> 2) << 5) | (((r) >> 3) << 11) // used in pc vers 42 | 43 | #define PACK_RGB888(colour, r, g, b) \ 44 | if (renderType == RENDER_SW) \ 45 | colour = RGB888_TO_RGB565(r, g, b); \ 46 | else if (renderType == RENDER_HW) \ 47 | colour = RGB888_TO_RGB5551(r, g, b); 48 | 49 | void LoadPalette(const char *filePath, int paletteID, int startPaletteIndex, int startIndex, int endIndex); 50 | 51 | inline void SetActivePalette(byte newActivePal, int startLine, int endLine) 52 | { 53 | if (renderType == RENDER_SW) { 54 | if (newActivePal < PALETTE_COUNT) 55 | for (int l = startLine; l < endLine && l < SCREEN_YSIZE; l++) gfxLineBuffer[l] = newActivePal; 56 | 57 | activePalette = fullPalette[gfxLineBuffer[0]]; 58 | activePalette32 = fullPalette32[gfxLineBuffer[0]]; 59 | } 60 | 61 | if (renderType == RENDER_HW) { 62 | if (newActivePal < PALETTE_COUNT) 63 | texPaletteNum = newActivePal; 64 | } 65 | } 66 | 67 | inline void SetPaletteEntry(byte paletteIndex, byte index, byte r, byte g, byte b) 68 | { 69 | if (paletteIndex != 0xFF) { 70 | PACK_RGB888(fullPalette[paletteIndex][index], r, g, b); 71 | fullPalette32[paletteIndex][index].r = r; 72 | fullPalette32[paletteIndex][index].g = g; 73 | fullPalette32[paletteIndex][index].b = b; 74 | 75 | if (renderType == RENDER_HW) { 76 | if (index) 77 | fullPalette[paletteIndex][index] |= 1; 78 | } 79 | } 80 | else { 81 | PACK_RGB888(activePalette[index], r, g, b); 82 | activePalette32[index].r = r; 83 | activePalette32[index].g = g; 84 | activePalette32[index].b = b; 85 | 86 | if (renderType == RENDER_HW) { 87 | if (index) 88 | activePalette[index] |= 1; 89 | } 90 | } 91 | } 92 | 93 | inline void CopyPalette(byte src, byte dest) 94 | { 95 | if (src < PALETTE_COUNT && dest < PALETTE_COUNT) { 96 | for (int i = 0; i < PALETTE_SIZE; ++i) { 97 | fullPalette[dest][i] = fullPalette[src][i]; 98 | fullPalette32[dest][i] = fullPalette32[src][i]; 99 | } 100 | } 101 | } 102 | 103 | inline void RotatePalette(byte startIndex, byte endIndex, bool right) 104 | { 105 | if (right) { 106 | ushort startClr = activePalette[endIndex]; 107 | PaletteEntry startClr32 = activePalette32[endIndex]; 108 | for (int i = endIndex; i > startIndex; --i) { 109 | activePalette[i] = activePalette[i - 1]; 110 | activePalette32[i] = activePalette32[i - 1]; 111 | } 112 | activePalette[startIndex] = startClr; 113 | activePalette32[startIndex] = startClr32; 114 | } 115 | else { 116 | ushort startClr = activePalette[startIndex]; 117 | PaletteEntry startClr32 = activePalette32[startIndex]; 118 | for (int i = startIndex; i < endIndex; ++i) { 119 | activePalette[i] = activePalette[i + 1]; 120 | activePalette32[i] = activePalette32[i + 1]; 121 | } 122 | activePalette[endIndex] = startClr; 123 | activePalette32[endIndex] = startClr32; 124 | } 125 | } 126 | 127 | inline void SetFade(byte R, byte G, byte B, ushort A) 128 | { 129 | fadeMode = 1; 130 | fadeR = R; 131 | fadeG = G; 132 | fadeB = B; 133 | fadeA = A > 0xFF ? 0xFF : A; 134 | } 135 | void SetLimitedFade(byte paletteID, byte R, byte G, byte B, ushort alpha, int startIndex, int endIndex); 136 | 137 | #endif // !PALETTE_H 138 | -------------------------------------------------------------------------------- /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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/RSDKv3.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 | {874fbe36-9fda-4467-ab8c-2f260ab0988a} 27 | 28 | 29 | {a8464249-4810-4bf0-b48e-1f89f064f4ec} 30 | 31 | 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files\theoraPlay 38 | 39 | 40 | Header Files\theoraPlay 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 101 | 102 | 103 | Header Files 104 | 105 | 106 | Header Files\vdf_parser 107 | 108 | 109 | Header Files\tinyxml2 110 | 111 | 112 | Header Files 113 | 114 | 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 166 | 167 | 168 | Source Files 169 | 170 | 171 | Source Files 172 | 173 | 174 | Source Files 175 | 176 | 177 | Source Files\theoraPlay 178 | 179 | 180 | Source Files 181 | 182 | 183 | Source Files 184 | 185 | 186 | Source Files\tinyxml2 187 | 188 | 189 | Source Files 190 | 191 | 192 | 193 | 194 | Resource Files 195 | 196 | 197 | 198 | 199 | Resource Files 200 | 201 | 202 | Resource Files 203 | 204 | 205 | -------------------------------------------------------------------------------- /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 | #if RETRO_USING_SDL2 18 | #define FileIO SDL_RWops 19 | #define fOpen(path, mode) SDL_RWFromFile(path, mode) 20 | #define fRead(buffer, elementSize, elementCount, file) SDL_RWread(file, buffer, elementSize, elementCount) 21 | #define fSeek(file, offset, whence) SDL_RWseek(file, offset, whence) 22 | #define fTell(file) SDL_RWtell(file) 23 | #define fClose(file) SDL_RWclose(file) 24 | #define fWrite(buffer, elementSize, elementCount, file) SDL_RWwrite(file, buffer, elementSize, elementCount) 25 | #else 26 | #define FileIO FILE 27 | #define fOpen(path, mode) fopen(path, mode) 28 | #define fRead(buffer, elementSize, elementCount, file) fread(buffer, elementSize, elementCount, file) 29 | #define fSeek(file, offset, whence) fseek(file, offset, whence) 30 | #define fTell(file) ftell(file) 31 | #define fClose(file) fclose(file) 32 | #define fWrite(buffer, elementSize, elementCount, file) fwrite(buffer, elementSize, elementCount, file) 33 | #endif 34 | 35 | #endif 36 | 37 | struct FileInfo { 38 | char fileName[0x100]; 39 | int fileSize; 40 | int vFileSize; 41 | int readPos; 42 | int bufferPosition; 43 | int virtualFileOffset; 44 | byte eStringPosA; 45 | byte eStringPosB; 46 | byte eStringNo; 47 | byte eNybbleSwap; 48 | FileIO *cFileHandle; 49 | byte *fileBuffer; 50 | #if RETRO_USE_MOD_LOADER 51 | byte isMod; 52 | #endif 53 | }; 54 | 55 | extern char rsdkName[0x400]; 56 | 57 | extern char fileName[0x100]; 58 | extern byte fileBuffer[0x2000]; 59 | extern int fileSize; 60 | extern int vFileSize; 61 | extern int readPos; 62 | extern int readSize; 63 | extern int bufferPosition; 64 | extern int virtualFileOffset; 65 | extern byte eStringPosA; 66 | extern byte eStringPosB; 67 | extern byte eStringNo; 68 | extern byte eNybbleSwap; 69 | extern char encryptionStringA[21]; 70 | extern char encryptionStringB[13]; 71 | #if RETRO_USE_MOD_LOADER 72 | extern byte isModdedFile; 73 | #endif 74 | 75 | extern FileIO *cFileHandle; 76 | 77 | inline void CopyFilePath(char *dest, const char *src) 78 | { 79 | strcpy(dest, src); 80 | for (int i = 0;; ++i) { 81 | if (i >= strlen(dest)) { 82 | break; 83 | } 84 | 85 | if (dest[i] == '/') 86 | dest[i] = '\\'; 87 | } 88 | } 89 | bool CheckRSDKFile(const char *filePath); 90 | 91 | bool LoadFile(const char *filePath, FileInfo *fileInfo); 92 | inline bool CloseFile() 93 | { 94 | int result = 0; 95 | if (cFileHandle) 96 | result = fClose(cFileHandle); 97 | 98 | cFileHandle = NULL; 99 | return result; 100 | } 101 | 102 | void FileRead(void *dest, int size); 103 | 104 | bool ParseVirtualFileSystem(FileInfo *fileInfo); 105 | 106 | inline size_t FillFileBuffer() 107 | { 108 | if (readPos + 0x2000 <= fileSize) 109 | readSize = 0x2000; 110 | else 111 | readSize = fileSize - readPos; 112 | 113 | size_t result = fRead(fileBuffer, 1u, readSize, cFileHandle); 114 | readPos += readSize; 115 | bufferPosition = 0; 116 | return result; 117 | } 118 | 119 | inline void GetFileInfo(FileInfo *fileInfo) 120 | { 121 | StrCopy(fileInfo->fileName, fileName); 122 | fileInfo->bufferPosition = bufferPosition; 123 | fileInfo->readPos = readPos - readSize; 124 | fileInfo->fileSize = fileSize; 125 | fileInfo->vFileSize = vFileSize; 126 | fileInfo->virtualFileOffset = virtualFileOffset; 127 | fileInfo->eStringPosA = eStringPosA; 128 | fileInfo->eStringPosB = eStringPosB; 129 | fileInfo->eStringNo = eStringNo; 130 | fileInfo->eNybbleSwap = eNybbleSwap; 131 | #if RETRO_USE_MOD_LOADER 132 | fileInfo->isMod = isModdedFile; 133 | #endif 134 | } 135 | void SetFileInfo(FileInfo *fileInfo); 136 | size_t GetFilePosition(); 137 | void SetFilePosition(int newPos); 138 | bool ReachedEndOfFile(); 139 | 140 | #endif // !READER_H 141 | -------------------------------------------------------------------------------- /RSDKv3/Scene.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SCENE_H 2 | #define SCENE_H 3 | 4 | #define LAYER_COUNT (9) 5 | #define DEFORM_STORE (0x100) 6 | #define DEFORM_SIZE (320) 7 | #define DEFORM_COUNT (DEFORM_STORE + DEFORM_SIZE) 8 | #define PARALLAX_COUNT (0x100) 9 | 10 | #define TILE_COUNT (0x400) 11 | #define TILE_SIZE (0x10) 12 | #define CHUNK_SIZE (0x80) 13 | #define TILE_DATASIZE (TILE_SIZE * TILE_SIZE) 14 | #define TILESET_SIZE (TILE_COUNT * TILE_DATASIZE) 15 | 16 | #define TILELAYER_CHUNK_W (0x100) 17 | #define TILELAYER_CHUNK_H (0x100) 18 | #define TILELAYER_CHUNK_MAX (TILELAYER_CHUNK_W * TILELAYER_CHUNK_H) 19 | #define TILELAYER_SCROLL_MAX (TILELAYER_CHUNK_H * CHUNK_SIZE) 20 | 21 | #define CHUNKTILE_COUNT (0x200 * (8 * 8)) 22 | 23 | #define CPATH_COUNT (2) 24 | 25 | enum StageListNames { 26 | STAGELIST_PRESENTATION = 0, 27 | STAGELIST_REGULAR = 1, 28 | STAGELIST_BONUS = 2, 29 | STAGELIST_SPECIAL = 3, 30 | STAGELIST_MAX, // StageList size 31 | }; 32 | 33 | enum TileLayerTypes { 34 | LAYER_NOSCROLL = 0, 35 | LAYER_HSCROLL = 1, 36 | LAYER_VSCROLL = 2, 37 | LAYER_3DFLOOR = 3, 38 | LAYER_3DSKY = 4, 39 | }; 40 | 41 | enum StageModes { 42 | STAGEMODE_LOAD = 0, 43 | STAGEMODE_NORMAL = 1, 44 | STAGEMODE_PAUSED = 2, 45 | }; 46 | 47 | enum TileInfo { 48 | TILEINFO_INDEX = 0, 49 | TILEINFO_DIRECTION = 1, 50 | TILEINFO_VISUALPLANE = 2, 51 | TILEINFO_SOLIDITYA = 3, 52 | TILEINFO_SOLIDITYB = 4, 53 | TILEINFO_FLAGSA = 5, 54 | TILEINFO_ANGLEA = 6, 55 | TILEINFO_FLAGSB = 7, 56 | TILEINFO_ANGLEB = 8, 57 | }; 58 | 59 | enum DeformationModes { 60 | DEFORM_FG = 0, 61 | DEFORM_FG_WATER = 1, 62 | DEFORM_BG = 2, 63 | DEFORM_BG_WATER = 3, 64 | }; 65 | 66 | struct SceneInfo { 67 | char name[0x40]; 68 | char folder[0x40]; 69 | char id[0x40]; 70 | bool highlighted; 71 | }; 72 | 73 | struct CollisionMasks { 74 | sbyte floorMasks[TILE_COUNT * TILE_SIZE]; 75 | sbyte lWallMasks[TILE_COUNT * TILE_SIZE]; 76 | sbyte rWallMasks[TILE_COUNT * TILE_SIZE]; 77 | sbyte roofMasks[TILE_COUNT * TILE_SIZE]; 78 | int angles[TILE_COUNT]; 79 | byte flags[TILE_COUNT]; 80 | }; 81 | 82 | struct TileLayer { 83 | ushort tiles[TILELAYER_CHUNK_MAX]; 84 | byte lineScroll[TILELAYER_SCROLL_MAX]; 85 | int parallaxFactor; 86 | int scrollSpeed; 87 | int scrollPos; 88 | int angle; 89 | int XPos; 90 | int YPos; 91 | int ZPos; 92 | int deformationOffset; 93 | int deformationOffsetW; 94 | byte type; 95 | byte width; 96 | byte height; 97 | }; 98 | 99 | struct LineScroll { 100 | int parallaxFactor[PARALLAX_COUNT]; 101 | int scrollSpeed[PARALLAX_COUNT]; 102 | int scrollPos[PARALLAX_COUNT]; 103 | int linePos[PARALLAX_COUNT]; 104 | int deform[PARALLAX_COUNT]; 105 | byte entryCount; 106 | }; 107 | 108 | struct Tiles128x128 { 109 | int gfxDataPos[CHUNKTILE_COUNT]; 110 | ushort tileIndex[CHUNKTILE_COUNT]; 111 | byte direction[CHUNKTILE_COUNT]; 112 | byte visualPlane[CHUNKTILE_COUNT]; 113 | byte collisionFlags[CPATH_COUNT][CHUNKTILE_COUNT]; 114 | }; 115 | 116 | extern int stageListCount[STAGELIST_MAX]; 117 | extern char stageListNames[STAGELIST_MAX][0x20]; 118 | extern SceneInfo stageList[STAGELIST_MAX][0x100]; 119 | 120 | extern int stageMode; 121 | 122 | extern int cameraTarget; 123 | extern int cameraStyle; 124 | extern int cameraEnabled; 125 | extern int cameraAdjustY; 126 | extern int xScrollOffset; 127 | extern int yScrollOffset; 128 | extern int yScrollA; 129 | extern int yScrollB; 130 | extern int xScrollA; 131 | extern int xScrollB; 132 | extern int yScrollMove; 133 | extern int cameraShakeX; 134 | extern int cameraShakeY; 135 | extern int cameraLag; 136 | extern int cameraLagStyle; 137 | 138 | extern int xBoundary1; 139 | extern int newXBoundary1; 140 | extern int yBoundary1; 141 | extern int newYBoundary1; 142 | extern int xBoundary2; 143 | extern int yBoundary2; 144 | extern int waterLevel; 145 | extern int waterDrawPos; 146 | extern int newXBoundary2; 147 | extern int newYBoundary2; 148 | 149 | extern int SCREEN_SCROLL_LEFT; 150 | extern int SCREEN_SCROLL_RIGHT; 151 | #define SCREEN_SCROLL_UP ((SCREEN_YSIZE / 2) - 16) 152 | #define SCREEN_SCROLL_DOWN ((SCREEN_YSIZE / 2) + 16) 153 | 154 | extern int lastXSize; 155 | extern int lastYSize; 156 | 157 | extern bool pauseEnabled; 158 | extern bool timeEnabled; 159 | extern bool debugMode; 160 | extern int frameCounter; 161 | extern int stageMilliseconds; 162 | extern int stageSeconds; 163 | extern int stageMinutes; 164 | 165 | // Category and Scene IDs 166 | extern int activeStageList; 167 | extern int stageListPosition; 168 | extern char currentStageFolder[0x100]; 169 | extern int actID; 170 | 171 | extern char titleCardText[0x100]; 172 | extern byte titleCardWord2; 173 | 174 | extern byte activeTileLayers[4]; 175 | extern byte tLayerMidPoint; 176 | extern TileLayer stageLayouts[LAYER_COUNT]; 177 | 178 | extern int bgDeformationData0[DEFORM_COUNT]; 179 | extern int bgDeformationData1[DEFORM_COUNT]; 180 | extern int bgDeformationData2[DEFORM_COUNT]; 181 | extern int bgDeformationData3[DEFORM_COUNT]; 182 | 183 | extern LineScroll hParallax; 184 | extern LineScroll vParallax; 185 | 186 | extern Tiles128x128 tiles128x128; 187 | extern CollisionMasks collisionMasks[2]; 188 | 189 | extern byte tilesetGFXData[TILESET_SIZE]; 190 | 191 | extern ushort tile3DFloorBuffer[0x13334]; 192 | extern bool drawStageGFXHQ; 193 | 194 | void InitFirstStage(); 195 | void ProcessStage(); 196 | 197 | void ResetBackgroundSettings(); 198 | inline void ResetCurrentStageFolder() { strcpy(currentStageFolder, ""); } 199 | inline bool CheckCurrentStageFolder(int stage) 200 | { 201 | if (strcmp(currentStageFolder, stageList[activeStageList][stage].folder) == 0) { 202 | return true; 203 | } 204 | else { 205 | strcpy(currentStageFolder, stageList[activeStageList][stage].folder); 206 | return false; 207 | } 208 | } 209 | 210 | void LoadStageFiles(); 211 | int LoadActFile(const char *ext, int stageID, FileInfo *info); 212 | int LoadStageFile(const char *filePath, int stageID, FileInfo *info); 213 | 214 | void LoadActLayout(); 215 | void LoadStageBackground(); 216 | void LoadStageChunks(); 217 | void LoadStageCollisions(); 218 | void LoadStageGIFFile(int stageID); 219 | void LoadStageGFXFile(int stageID); 220 | 221 | inline void Init3DFloorBuffer(int layerID) 222 | { 223 | for (int y = 0; y < TILELAYER_CHUNK_H; ++y) { 224 | for (int x = 0; x < TILELAYER_CHUNK_W; ++x) { 225 | int c = stageLayouts[layerID].tiles[(x >> 3) + (y >> 3 << 8)] << 6; 226 | int tx = x & 7; 227 | tile3DFloorBuffer[x + (y << 8)] = c + tx + ((y & 7) << 3); 228 | } 229 | } 230 | } 231 | 232 | inline void Copy16x16Tile(ushort dest, ushort src) 233 | { 234 | if (renderType == RENDER_SW) { 235 | byte *destPtr = &tilesetGFXData[TILELAYER_CHUNK_W * dest]; 236 | byte *srcPtr = &tilesetGFXData[TILELAYER_CHUNK_W * src]; 237 | int cnt = TILE_DATASIZE; 238 | while (cnt--) *destPtr++ = *srcPtr++; 239 | } 240 | else if (renderType == RENDER_HW) { 241 | tileUVArray[4 * dest] = tileUVArray[4 * src]; 242 | tileUVArray[4 * dest + 1] = tileUVArray[4 * src + 1]; 243 | tileUVArray[4 * dest + 2] = tileUVArray[4 * src + 2]; 244 | tileUVArray[4 * dest + 3] = tileUVArray[4 * src + 3]; 245 | } 246 | } 247 | 248 | void SetLayerDeformation(int selectedDef, int waveLength, int waveType, int deformType, int YPos, int waveSize); 249 | 250 | void SetPlayerScreenPosition(Player *player); 251 | void SetPlayerScreenPositionCDStyle(Player *player); 252 | void SetPlayerHLockedScreenPosition(Player *player); 253 | void SetPlayerLockedScreenPosition(Player *player); 254 | 255 | #endif // !SCENE_H 256 | -------------------------------------------------------------------------------- /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 | int id; 30 | short srcX; 31 | short srcY; 32 | short width; 33 | short height; 34 | short pivotX; 35 | short pivotY; 36 | short xAdvance; 37 | }; 38 | 39 | extern TextMenu gameMenu[TEXTMENU_COUNT]; 40 | extern int textMenuSurfaceNo; 41 | 42 | extern FontCharacter fontCharacterList[FONTCHAR_COUNT]; 43 | 44 | void LoadFontFile(const char *filePath); 45 | void LoadTextFile(TextMenu *menu, const char *filePath, byte mapCode); 46 | void LoadConfigListText(TextMenu *menu, int listNo); 47 | 48 | void SetupTextMenu(TextMenu *menu, int rowCount); 49 | void AddTextMenuEntry(TextMenu *menu, const char *text); 50 | void AddTextMenuEntryMapped(TextMenu *menu, const char *text); 51 | void SetTextMenuEntry(TextMenu *menu, const char *text, int rowID); 52 | void EditTextMenuEntry(TextMenu *menu, const char *text, int rowID); 53 | 54 | #endif // !TEXTSYSTEM_H 55 | -------------------------------------------------------------------------------- /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 | enum OnlineMenuTypes { 14 | ONLINEMENU_ACHIEVEMENTS = 0, 15 | ONLINEMENU_LEADERBOARDS = 1, 16 | }; 17 | 18 | struct Achievement { 19 | char name[0x40]; 20 | int status; 21 | }; 22 | 23 | struct LeaderboardEntry { 24 | int score; 25 | }; 26 | 27 | extern int globalVariablesCount; 28 | extern int globalVariables[GLOBALVAR_COUNT]; 29 | extern char globalVariableNames[GLOBALVAR_COUNT][0x20]; 30 | 31 | extern char gamePath[0x100]; 32 | extern int saveRAM[SAVEDATA_MAX]; 33 | extern Achievement achievements[ACHIEVEMENT_MAX]; 34 | extern LeaderboardEntry leaderboards[LEADERBOARD_MAX]; 35 | 36 | extern int controlMode; 37 | extern bool disableTouchControls; 38 | extern bool disableFocusPause; 39 | extern bool disableFocusPause_Config; 40 | 41 | #if RETRO_USE_MOD_LOADER 42 | extern bool forceUseScripts; 43 | extern bool forceUseScripts_Config; 44 | #endif 45 | 46 | inline int GetGlobalVariableByName(const char *name) 47 | { 48 | for (int v = 0; v < globalVariablesCount; ++v) { 49 | if (StrComp(name, globalVariableNames[v])) 50 | return globalVariables[v]; 51 | } 52 | return 0; 53 | } 54 | 55 | inline void SetGlobalVariableByName(const char *name, int value) 56 | { 57 | for (int v = 0; v < globalVariablesCount; ++v) { 58 | if (StrComp(name, globalVariableNames[v])) { 59 | globalVariables[v] = value; 60 | break; 61 | } 62 | } 63 | } 64 | 65 | extern bool useSGame; 66 | bool ReadSaveRAMData(); 67 | bool WriteSaveRAMData(); 68 | 69 | void InitUserdata(); 70 | void writeSettings(); 71 | void ReadUserdata(); 72 | void WriteUserdata(); 73 | 74 | void AwardAchievement(int id, int status); 75 | void SetAchievement(int achievementID, int achievementDone); 76 | void SetLeaderboard(int leaderboardID, int result); 77 | inline void LoadAchievementsMenu() { ReadUserdata(); } 78 | inline void LoadLeaderboardsMenu() { ReadUserdata(); } 79 | 80 | #endif //! USERDATA_H 81 | -------------------------------------------------------------------------------- /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 | d = opendir("/"); 44 | p = p + 1; 45 | } 46 | else { 47 | d = opendir("."); 48 | r[0] = '.'; 49 | r[1] = 0; 50 | rl = 1; 51 | } 52 | 53 | int last = 0; 54 | char *c = strsep(&p, "/"); 55 | while (c) { 56 | if (!d) { 57 | return 0; 58 | } 59 | 60 | if (last) { 61 | closedir(d); 62 | return 0; 63 | } 64 | 65 | r[rl] = '/'; 66 | rl += 1; 67 | r[rl] = 0; 68 | 69 | struct dirent *e = readdir(d); 70 | while (e) { 71 | if (strcasecmp(c, e->d_name) == 0) { 72 | strcpy(r + rl, e->d_name); 73 | rl += strlen(e->d_name); 74 | 75 | closedir(d); 76 | d = opendir(r); 77 | 78 | break; 79 | } 80 | 81 | e = readdir(d); 82 | } 83 | 84 | if (!e) { 85 | strcpy(r + rl, c); 86 | rl += strlen(c); 87 | last = 1; 88 | } 89 | 90 | c = strsep(&p, "/"); 91 | } 92 | 93 | if (d) 94 | closedir(d); 95 | return 1; 96 | } 97 | #endif 98 | 99 | FILE *fcaseopen(char const *path, char const *mode) 100 | { 101 | FILE *f = fopen(path, mode); 102 | #if !defined(_WIN32) 103 | if (!f) { 104 | char *r = (char *)alloca(strlen(path) + 2); 105 | if (casepath(path, r)) { 106 | f = fopen(r, mode); 107 | } 108 | } 109 | #endif 110 | return f; 111 | } 112 | 113 | void casechdir(char const *path) 114 | { 115 | #if !defined(_WIN32) 116 | char *r = (char *)alloca(strlen(path) + 2); 117 | if (casepath(path, r)) { 118 | chdir(r); 119 | } 120 | else { 121 | errno = ENOENT; 122 | } 123 | #else 124 | chdir(path); 125 | #endif 126 | } 127 | -------------------------------------------------------------------------------- /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 | #ifdef NXLINK 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | static int s_nxlinkSock = -1; 14 | 15 | static void initNxLink() 16 | { 17 | if (R_FAILED(socketInitializeDefault())) 18 | return; 19 | 20 | s_nxlinkSock = nxlinkStdio(); 21 | if (s_nxlinkSock >= 0) 22 | printf("printf output now goes to nxlink server\n"); 23 | else 24 | socketExit(); 25 | } 26 | #endif 27 | 28 | int main(int argc, char *argv[]) 29 | { 30 | #ifdef NXLINK 31 | initNxLink(); 32 | #endif 33 | 34 | for (int i = 0; i < argc; ++i) { 35 | if (StrComp(argv[i], "UsingCWD")) 36 | usingCWD = true; 37 | } 38 | 39 | Engine.Init(); 40 | Engine.Run(); 41 | 42 | #ifdef NXLINK 43 | socketExit(); 44 | #endif 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /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 = [] 25 | abiFilters.addAll(ABIFILTERS.split(';').collect{it as String}) 26 | } 27 | //cmake { 28 | // arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static" 29 | // // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' 30 | // abiFilters 'arm64-v8a' 31 | //} 32 | } 33 | } 34 | buildTypes { 35 | release { 36 | minifyEnabled false 37 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 38 | } 39 | } 40 | if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) { 41 | sourceSets.main { 42 | jniLibs.srcDir 'libs' 43 | } 44 | externalNativeBuild { 45 | ndkBuild { 46 | path 'jni/Android.mk' 47 | } 48 | //cmake { 49 | // path 'jni/CMakeLists.txt' 50 | //} 51 | } 52 | 53 | } 54 | lintOptions { 55 | abortOnError false 56 | } 57 | 58 | if (buildAsLibrary) { 59 | libraryVariants.all { variant -> 60 | variant.outputs.each { output -> 61 | def outputFile = output.outputFile 62 | if (outputFile != null && outputFile.name.endsWith(".aar")) { 63 | def fileName = "com.decomp.rsdkv3.aar" 64 | output.outputFile = new File(outputFile.parent, fileName) 65 | } 66 | } 67 | } 68 | } 69 | } 70 | 71 | dependencies { 72 | implementation fileTree(include: ['*.jar'], dir: 'libs') 73 | } 74 | -------------------------------------------------------------------------------- /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 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 51 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /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.os.Environment; 6 | 7 | import java.io.File; 8 | 9 | import org.libsdl.app.*; 10 | 11 | 12 | public class RSDKv3 extends SDLActivity { 13 | @Override 14 | protected void onStart() { 15 | super.onStart(); 16 | getBasePath(); 17 | 18 | } 19 | 20 | public String getBasePath() { 21 | Context c = getApplicationContext(); 22 | requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0); 23 | String p = Environment.getExternalStorageDirectory().getAbsolutePath() + "/RSDK/v3"; 24 | //getExternalStorageDirectory is deprecated. I do not care. 25 | new File(p).mkdirs(); 26 | return p + "/"; 27 | } 28 | } -------------------------------------------------------------------------------- /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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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 | ABIFILTERS=armeabi-v7a;arm64-v8a;x86;x86_64 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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 | tinyxml2: download https://github.com/leethomason/tinyxml2/releases 2 | download the source code of the latest release and unzip it in "./tinyxml2/" -------------------------------------------------------------------------------- /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/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/config_types.h: -------------------------------------------------------------------------------- 1 | #ifndef __CONFIG_TYPES_H__ 2 | #define __CONFIG_TYPES_H__ 3 | 4 | #include 5 | typedef int16_t ogg_int16_t; 6 | typedef uint16_t ogg_uint16_t; 7 | typedef int32_t ogg_int32_t; 8 | typedef uint32_t ogg_uint32_t; 9 | typedef int64_t ogg_int64_t; 10 | typedef uint64_t ogg_uint64_t; 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/dependencies/mac/icons/RSDKv3 Decomp Icon-1024.png -------------------------------------------------------------------------------- /dependencies/mac/icons/RSDKv3 Decomp Icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/dependencies/mac/icons/RSDKv3 Decomp Icon-128.png -------------------------------------------------------------------------------- /dependencies/mac/icons/RSDKv3 Decomp Icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/dependencies/mac/icons/RSDKv3 Decomp Icon-16.png -------------------------------------------------------------------------------- /dependencies/mac/icons/RSDKv3 Decomp Icon-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/dependencies/mac/icons/RSDKv3 Decomp Icon-256.png -------------------------------------------------------------------------------- /dependencies/mac/icons/RSDKv3 Decomp Icon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/dependencies/mac/icons/RSDKv3 Decomp Icon-32.png -------------------------------------------------------------------------------- /dependencies/mac/icons/RSDKv3 Decomp Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/dependencies/mac/icons/RSDKv3 Decomp Icon-512.png -------------------------------------------------------------------------------- /dependencies/mac/icons/RSDKv3 Decomp Icon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/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: http://glew.sourceforge.net/ download binaries, place the unzipped folder into "./" and rename it to "glew" -------------------------------------------------------------------------------- /header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/header.png -------------------------------------------------------------------------------- /icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heyjoeway/Sonic-CD-11-Decompilation/c5c08f4bb033a498cbbc41d0152004f76a9086ef/icon.jpg -------------------------------------------------------------------------------- /props/winactions.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)/;$(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 | --------------------------------------------------------------------------------