├── .clang-format ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ └── config.yml └── workflows │ └── build.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── FAQ.md ├── Game ├── LICENSE.md ├── Makefile ├── README.md ├── RSDKv5.sln ├── RSDKv5.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── WorkspaceSettings.xcsettings │ └── xcuserdata │ │ └── rubberduckycooly.xcuserdatad │ │ └── WorkspaceSettings.xcsettings └── xcshareddata │ └── xcschemes │ └── RSDKv5.xcscheme ├── RSDKv5 ├── RSDK │ ├── Audio │ │ ├── Audio.cpp │ │ ├── Audio.hpp │ │ ├── Legacy │ │ │ ├── AudioLegacy.cpp │ │ │ └── AudioLegacy.hpp │ │ ├── MiniAudio │ │ │ ├── MiniAudioDevice.cpp │ │ │ └── MiniAudioDevice.hpp │ │ ├── NX │ │ │ ├── NXAudioDevice.cpp │ │ │ └── NXAudioDevice.hpp │ │ ├── Oboe │ │ │ ├── OboeAudioDevice.cpp │ │ │ └── OboeAudioDevice.hpp │ │ ├── PortAudio │ │ │ ├── PortAudioDevice.cpp │ │ │ └── PortAudioDevice.hpp │ │ ├── SDL2 │ │ │ ├── SDL2AudioDevice.cpp │ │ │ └── SDL2AudioDevice.hpp │ │ └── XAudio │ │ │ ├── XAudioDevice.cpp │ │ │ └── XAudioDevice.hpp │ ├── Core │ │ ├── Legacy │ │ │ ├── ModAPILegacy.cpp │ │ │ ├── ModAPILegacy.hpp │ │ │ ├── RetroEngineLegacy.cpp │ │ │ ├── RetroEngineLegacy.hpp │ │ │ ├── v3 │ │ │ │ ├── RetroEnginev3.cpp │ │ │ │ └── RetroEnginev3.hpp │ │ │ └── v4 │ │ │ │ ├── RetroEnginev4.cpp │ │ │ │ └── RetroEnginev4.hpp │ │ ├── Link.cpp │ │ ├── Link.hpp │ │ ├── Math.cpp │ │ ├── Math.hpp │ │ ├── ModAPI.cpp │ │ ├── ModAPI.hpp │ │ ├── Reader.cpp │ │ ├── Reader.hpp │ │ ├── RetroEngine.cpp │ │ └── RetroEngine.hpp │ ├── Dev │ │ ├── Debug.cpp │ │ ├── Debug.hpp │ │ └── DevFont.hpp │ ├── Graphics │ │ ├── Animation.cpp │ │ ├── Animation.hpp │ │ ├── DX11 │ │ │ ├── BackupShaders.hpp │ │ │ ├── DX11RenderDevice.cpp │ │ │ └── DX11RenderDevice.hpp │ │ ├── DX9 │ │ │ ├── DX9RenderDevice.cpp │ │ │ └── DX9RenderDevice.hpp │ │ ├── Drawing.cpp │ │ ├── Drawing.hpp │ │ ├── EGL │ │ │ ├── EGLRenderDevice.cpp │ │ │ └── EGLRenderDevice.hpp │ │ ├── GLFW │ │ │ ├── GLFWRenderDevice.cpp │ │ │ └── GLFWRenderDevice.hpp │ │ ├── Legacy │ │ │ ├── AnimationLegacy.cpp │ │ │ ├── AnimationLegacy.hpp │ │ │ ├── DrawingLegacy.cpp │ │ │ ├── DrawingLegacy.hpp │ │ │ ├── PaletteLegacy.cpp │ │ │ ├── PaletteLegacy.hpp │ │ │ ├── Scene3DLegacy.cpp │ │ │ ├── Scene3DLegacy.hpp │ │ │ ├── SpriteLegacy.cpp │ │ │ ├── SpriteLegacy.hpp │ │ │ ├── v3 │ │ │ │ ├── DrawingLegacyv3.cpp │ │ │ │ ├── DrawingLegacyv3.hpp │ │ │ │ ├── Scene3DLegacyv3.cpp │ │ │ │ └── Scene3DLegacyv3.hpp │ │ │ └── v4 │ │ │ │ ├── DrawingLegacyv4.cpp │ │ │ │ ├── DrawingLegacyv4.hpp │ │ │ │ ├── Scene3DLegacyv4.cpp │ │ │ │ └── Scene3DLegacyv4.hpp │ │ ├── Palette.cpp │ │ ├── Palette.hpp │ │ ├── SDL2 │ │ │ ├── SDL2RenderDevice.cpp │ │ │ └── SDL2RenderDevice.hpp │ │ ├── Scene3D.cpp │ │ ├── Scene3D.hpp │ │ ├── Sprite.cpp │ │ ├── Sprite.hpp │ │ ├── Video.cpp │ │ ├── Video.hpp │ │ └── Vulkan │ │ │ ├── BackupShaders.hpp │ │ │ ├── VulkanRenderDevice.cpp │ │ │ └── VulkanRenderDevice.hpp │ ├── Input │ │ ├── GLFW │ │ │ ├── GLFWInputDevice.cpp │ │ │ └── GLFWInputDevice.hpp │ │ ├── Input.cpp │ │ ├── Input.hpp │ │ ├── Keyboard │ │ │ ├── KBInputDevice.cpp │ │ │ └── KBInputDevice.hpp │ │ ├── NX │ │ │ ├── NXInputDevice.cpp │ │ │ └── NXInputDevice.hpp │ │ ├── Paddleboat │ │ │ ├── PDBInputDevice.cpp │ │ │ └── PDBInputDevice.hpp │ │ ├── RawInput │ │ │ ├── RawInputDevice.cpp │ │ │ └── RawInputDevice.hpp │ │ ├── SDL2 │ │ │ ├── SDL2InputDevice.cpp │ │ │ └── SDL2InputDevice.hpp │ │ ├── Steam │ │ │ ├── SteamInputDevice.cpp │ │ │ └── SteamInputDevice.hpp │ │ └── XInput │ │ │ ├── XInputDevice.cpp │ │ │ └── XInputDevice.hpp │ ├── Scene │ │ ├── Collision.cpp │ │ ├── Collision.hpp │ │ ├── Legacy │ │ │ ├── CollisionLegacy.cpp │ │ │ ├── CollisionLegacy.hpp │ │ │ ├── ObjectLegacy.cpp │ │ │ ├── ObjectLegacy.hpp │ │ │ ├── SceneLegacy.cpp │ │ │ ├── SceneLegacy.hpp │ │ │ ├── v3 │ │ │ │ ├── CollisionLegacyv3.cpp │ │ │ │ ├── CollisionLegacyv3.hpp │ │ │ │ ├── ObjectLegacyv3.cpp │ │ │ │ ├── ObjectLegacyv3.hpp │ │ │ │ ├── PlayerLegacyv3.cpp │ │ │ │ ├── PlayerLegacyv3.hpp │ │ │ │ ├── SceneLegacyv3.cpp │ │ │ │ ├── SceneLegacyv3.hpp │ │ │ │ ├── ScriptLegacyv3.cpp │ │ │ │ └── ScriptLegacyv3.hpp │ │ │ └── v4 │ │ │ │ ├── CollisionLegacyv4.cpp │ │ │ │ ├── CollisionLegacyv4.hpp │ │ │ │ ├── ObjectLegacyv4.cpp │ │ │ │ ├── ObjectLegacyv4.hpp │ │ │ │ ├── SceneLegacyv4.cpp │ │ │ │ ├── SceneLegacyv4.hpp │ │ │ │ ├── ScriptLegacyv4.cpp │ │ │ │ └── ScriptLegacyv4.hpp │ │ ├── Object.cpp │ │ ├── Object.hpp │ │ ├── Objects │ │ │ ├── DefaultObject.cpp │ │ │ ├── DefaultObject.hpp │ │ │ ├── DevOutput.cpp │ │ │ └── DevOutput.hpp │ │ ├── Scene.cpp │ │ └── Scene.hpp │ ├── Storage │ │ ├── Legacy │ │ │ ├── TextLegacy.cpp │ │ │ ├── TextLegacy.hpp │ │ │ ├── UserStorageLegacy.cpp │ │ │ └── UserStorageLegacy.hpp │ │ ├── Storage.cpp │ │ ├── Storage.hpp │ │ ├── Text.cpp │ │ └── Text.hpp │ └── User │ │ ├── Core │ │ ├── UserAchievements.cpp │ │ ├── UserAchievements.hpp │ │ ├── UserCore.cpp │ │ ├── UserCore.hpp │ │ ├── UserLeaderboards.cpp │ │ ├── UserLeaderboards.hpp │ │ ├── UserPresence.cpp │ │ ├── UserPresence.hpp │ │ ├── UserStats.cpp │ │ ├── UserStats.hpp │ │ ├── UserStorage.cpp │ │ └── UserStorage.hpp │ │ ├── Dummy │ │ ├── DummyAchievements.cpp │ │ ├── DummyAchievements.hpp │ │ ├── DummyCore.cpp │ │ ├── DummyCore.hpp │ │ ├── DummyLeaderboards.cpp │ │ ├── DummyLeaderboards.hpp │ │ ├── DummyPresence.cpp │ │ ├── DummyPresence.hpp │ │ ├── DummyStats.cpp │ │ ├── DummyStats.hpp │ │ ├── DummyStorage.cpp │ │ └── DummyStorage.hpp │ │ ├── EOS │ │ ├── EOSAchievements.cpp │ │ ├── EOSAchievements.hpp │ │ ├── EOSCore.cpp │ │ ├── EOSCore.hpp │ │ ├── EOSLeaderboards.cpp │ │ ├── EOSLeaderboards.hpp │ │ ├── EOSPresence.cpp │ │ ├── EOSPresence.hpp │ │ ├── EOSStats.cpp │ │ ├── EOSStats.hpp │ │ ├── EOSStorage.cpp │ │ └── EOSStorage.hpp │ │ ├── NX │ │ ├── NXAchievements.cpp │ │ ├── NXAchievements.hpp │ │ ├── NXCore.cpp │ │ ├── NXCore.hpp │ │ ├── NXLeaderboards.cpp │ │ ├── NXLeaderboards.hpp │ │ ├── NXPresence.cpp │ │ ├── NXPresence.hpp │ │ ├── NXStats.cpp │ │ ├── NXStats.hpp │ │ ├── NXStorage.cpp │ │ └── NXStorage.hpp │ │ └── Steam │ │ ├── SteamAchievements.cpp │ │ ├── SteamAchievements.hpp │ │ ├── SteamCore.cpp │ │ ├── SteamCore.hpp │ │ ├── SteamLeaderboards.cpp │ │ ├── SteamLeaderboards.hpp │ │ ├── SteamPresence.cpp │ │ ├── SteamPresence.hpp │ │ ├── SteamStats.cpp │ │ ├── SteamStats.hpp │ │ ├── SteamStorage.cpp │ │ └── SteamStorage.hpp ├── RSDKv5.ico ├── RSDKv5.rc ├── RSDKv5_dx11.vcxproj ├── RSDKv5_dx11.vcxproj.filters ├── RSDKv5_dx9.vcxproj ├── RSDKv5_dx9.vcxproj.filters ├── RSDKv5_ogl.vcxproj ├── RSDKv5_ogl.vcxproj.filters ├── RSDKv5_sdl2.vcxproj ├── RSDKv5_sdl2.vcxproj.filters ├── RSDKv5_vk.vcxproj ├── RSDKv5_vk.vcxproj.filters ├── Shaders │ ├── .gitignore │ ├── DX11 │ │ ├── CRT-Yee64.hlsl │ │ ├── CRT-Yeetron.hlsl │ │ ├── Clean.hlsl │ │ ├── None.hlsl │ │ ├── RGB-Image.hlsl │ │ ├── YUV-420.hlsl │ │ ├── YUV-422.hlsl │ │ └── YUV-444.hlsl │ ├── DX9 │ │ ├── CRT-Yee64.hlsl │ │ ├── CRT-Yeetron.hlsl │ │ ├── Clean.hlsl │ │ ├── None.hlsl │ │ ├── RGB-Image.hlsl │ │ ├── YUV-420.hlsl │ │ ├── YUV-422.hlsl │ │ └── YUV-444.hlsl │ ├── OGL │ │ ├── CRT-Yee64.fs │ │ ├── CRT-Yeetron.fs │ │ ├── Clean.fs │ │ ├── None.fs │ │ ├── None.vs │ │ ├── RGB-Image.fs │ │ ├── YUV-420.fs │ │ ├── YUV-422.fs │ │ └── YUV-444.fs │ ├── README.md │ └── Vulkan │ │ ├── CRT-Yee64.frag │ │ ├── CRT-Yeetron.frag │ │ ├── Clean.frag │ │ ├── None.frag │ │ ├── None.vert │ │ ├── RGB-Image.frag │ │ ├── YUV-420.frag │ │ ├── YUV-422.frag │ │ ├── YUV-444.frag │ │ ├── backup.frag │ │ ├── backup.vert │ │ └── compile.py ├── main.cpp ├── main.hpp ├── resource.h └── switch-icon.jpg ├── RSDKv5U.sln ├── RSDKv5U.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── WorkspaceSettings.xcsettings │ └── xcuserdata │ │ └── rubberduckycooly.xcuserdatad │ │ └── WorkspaceSettings.xcsettings └── xcshareddata │ └── xcschemes │ └── RSDKv5U.xcscheme ├── RSDKv5U ├── RSDKv5U.ico ├── RSDKv5U.rc ├── RSDKv5U_dx11.vcxproj ├── RSDKv5U_dx11.vcxproj.filters ├── RSDKv5U_dx9.vcxproj ├── RSDKv5U_dx9.vcxproj.filters ├── RSDKv5U_ogl.vcxproj ├── RSDKv5U_ogl.vcxproj.filters ├── RSDKv5U_sdl2.vcxproj ├── RSDKv5U_sdl2.vcxproj.filters ├── RSDKv5U_vk.vcxproj ├── RSDKv5U_vk.vcxproj.filters ├── resource.h └── switch-icon.jpg ├── android ├── app │ ├── .gitignore │ ├── build.gradle │ ├── jni │ │ ├── .gitignore │ │ ├── Application.mk │ │ └── CMakeLists.txt │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── org │ │ │ └── rems │ │ │ └── rsdkv5 │ │ │ ├── Launcher.java │ │ │ ├── LoadingIcon.java │ │ │ └── RSDK.java │ │ └── res │ │ ├── mipmap-anydpi-v26 │ │ └── ic_launcher.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_background.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_monochrome.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_background.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_monochrome.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_background.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_monochrome.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_background.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_monochrome.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_background.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_monochrome.png │ │ └── 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 ├── release-key.jks └── settings.gradle ├── clang-format-commands.txt ├── dependencies ├── all │ ├── iniparser │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dictionary.cpp │ │ ├── dictionary.h │ │ ├── iniparser.cpp │ │ └── iniparser.h │ ├── miniaudio │ │ └── miniaudio.h │ └── miniz │ │ ├── LICENSE.md │ │ ├── miniz.c │ │ └── miniz.h ├── android │ ├── .gitignore │ ├── README.md │ ├── androidHelpers.cpp │ ├── androidHelpers.hpp │ └── libogg │ │ └── include │ │ └── ogg │ │ └── config_types.h ├── ios │ ├── .gitignore │ ├── Default.png │ ├── Info.plist │ └── README.md ├── mac │ ├── .gitignore │ ├── Info.plist │ ├── README.md │ ├── cocoaHelpers.hpp │ └── cocoaHelpers.mm ├── ogl │ ├── .gitignore │ └── README.md ├── switch │ └── libnx-dyn │ │ ├── README.md │ │ ├── address_space.c │ │ ├── address_space.h │ │ ├── application │ │ └── source │ │ │ └── main.c │ │ ├── dyn.c │ │ ├── dyn.h │ │ └── dynamic_wrap.c └── windows │ ├── .gitignore │ └── README.md ├── filters ├── DX11.slnf ├── DX9.slnf ├── GL3.slnf ├── SDL2.slnf └── all │ ├── DX11.slnf │ ├── DX9.slnf │ ├── GL3.slnf │ └── SDL2.slnf ├── header.png ├── makefiles ├── Linux.cfg ├── Switch.cfg └── Windows.cfg ├── mingw64-make.sh ├── platforms ├── Android.cmake ├── Linux.cmake ├── NintendoSwitch.cmake └── Windows.cmake └── 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 | BreakBeforeTernaryOperators: true 16 | BreakBeforeBinaryOperators: NonAssignment 17 | Cpp11BracedListStyle: false 18 | IndentCaseLabels: true 19 | AlignTrailingComments: true 20 | AlignOperands: true 21 | AlignConsecutiveAssignments: true 22 | AlignConsecutiveDeclarations: false 23 | AlignConsecutiveMacros: true 24 | UseTab: Never 25 | BreakBeforeBraces: Custom 26 | BraceWrapping: 27 | AfterClass: true 28 | AfterControlStatement: false 29 | AfterEnum: false 30 | AfterFunction: true 31 | AfterNamespace: true 32 | AfterObjCDeclaration: false 33 | AfterStruct: false 34 | AfterUnion: false 35 | BeforeCatch: false 36 | BeforeElse: true 37 | IndentBraces: false 38 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # default behaviour 2 | * text=auto 3 | 4 | # I do not like \r\n, \n supremacy 5 | *.txt text eol=lf -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Retro Engine Modding Server 4 | url: https://dc.railgun.works/retroengine 5 | about: If you have any questions about the decompilation or want help with modding, ask here. 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "dependencies/all/tinyxml2"] 2 | path = dependencies/all/tinyxml2 3 | url = https://github.com/leethomason/tinyxml2 4 | [submodule "dependencies/all/stb_vorbis"] 5 | path = dependencies/all/stb_vorbis 6 | url = https://github.com/nothings/stb 7 | -------------------------------------------------------------------------------- /Game: -------------------------------------------------------------------------------- 1 | ../../SonicMania -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # RSDKv5(U) DECOMPILATION SOURCE CODE LICENSE v2.1 2 | 3 | The code in this repository is a decompilation of RSDK (Retro-Engine) version 5 and 5-Ultimate. 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 | - All pre-built executables provided TO ANYONE *PRIVATE OR OTHERWISE* **must be built with DLC disabled by __default.__** 11 | - DLC is managed by the DummyCore Usercore. A define, `RSDK_AUTOBUILD`, and a CMake flag, `RETRO_DISABLE_PLUS`, are already provided for you to force DLC off. 12 | - Creating a configuration setting *is allowed,* so long as it is set to off by default. 13 | - *No such configuration will be pushed to the master repository.* 14 | - This is to ensure an extra layer of legal protection for Sonic Mania Plus and Sonic Origins Plus. 15 | - You may not use the decompilation for commercial (any sort of profit) use. 16 | - You must clearly specify that the decompilation and original code are not yours: the developers of both must be credited. 17 | - You may not distribute assets used to run any game not directly provided by the repository (other than unique, modded assets). 18 | - This license must be in all modified copies of source code, and all forks must follow this license. 19 | 20 | Original RSDK authors: Evening Star 21 | 22 | Decompilation authors: Rubberduckycooly and chuliRMG 23 | -------------------------------------------------------------------------------- /RSDKv5.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RSDKv5.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /RSDKv5.xcodeproj/project.xcworkspace/xcuserdata/rubberduckycooly.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseAppPreferences 7 | CustomBuildIntermediatesPath 8 | Build/mac/Intermediates.noindex 9 | CustomBuildLocationType 10 | RelativeToDerivedData 11 | CustomBuildProductsPath 12 | Build/mac/Products 13 | DerivedDataCustomLocation 14 | build/mac/v5 15 | DerivedDataLocationStyle 16 | WorkspaceRelativePath 17 | IssueFilterStyle 18 | ShowActiveSchemeOnly 19 | LiveSourceIssuesEnabled 20 | 21 | ShowSharedSchemesAutomaticallyEnabled 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Audio/Legacy/AudioLegacy.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | #define LEGACY_TRACK_COUNT (0x10) 5 | 6 | struct TrackInfo { 7 | char fileName[0x40]; 8 | bool32 trackLoop; 9 | uint32 loopPoint; 10 | }; 11 | 12 | extern int32 globalSFXCount; 13 | extern int32 stageSFXCount; 14 | 15 | extern int32 musicVolume; 16 | extern int32 sfxVolume; 17 | extern int32 bgmVolume; 18 | extern int32 musicCurrentTrack; 19 | extern int32 musicChannel; 20 | 21 | extern TrackInfo musicTracks[LEGACY_TRACK_COUNT]; 22 | 23 | void SetMusicTrack(const char *filePath, uint8 trackID, bool32 loop, uint32 loopPoint); 24 | int32 PlayMusic(int32 trackID); 25 | inline void StopMusic() { StopChannel(musicChannel); } 26 | void SetMusicVolume(int32 volume); 27 | 28 | // helper func to ensure compatibility with how v3/v4 expects it (no plays var and slot is set manually) 29 | void LoadSfx(char *filename, uint8 slot, uint8 scope); 30 | inline int32 PlaySfx(int32 sfxID, bool32 loop) { return RSDK::PlaySfx(sfxID, loop, 0xFF); } 31 | inline void StopSfx(int32 sfxID) { RSDK::StopSfx(sfxID); } 32 | 33 | namespace v3 34 | { 35 | extern char globalSfxNames[SFX_COUNT][0x40]; 36 | extern char stageSfxNames[SFX_COUNT][0x40]; 37 | 38 | void SetSfxName(const char *sfxName, int32 sfxID, bool32 global); 39 | void SetSfxAttributes(int32 channelID, int32 loop, int8 pan); 40 | } // namespace v3 41 | 42 | namespace v4 43 | { 44 | extern float musicRatio; 45 | extern char sfxNames[SFX_COUNT][0x40]; 46 | 47 | void SwapMusicTrack(const char *filePath, uint8 trackID, uint32 loopPoint, uint32 ratio); 48 | void SetSfxAttributes(int32 sfxID, int32 loop, int8 pan); 49 | 50 | void SetSfxName(const char *sfxName, int32 sfxID); 51 | } // namespace v4 52 | 53 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Audio/MiniAudio/MiniAudioDevice.cpp: -------------------------------------------------------------------------------- 1 | #define MINIAUDIO_IMPLEMENTATION 2 | #include 3 | 4 | uint8 AudioDevice::contextInitialized; 5 | ma_device AudioDevice::device; 6 | 7 | bool32 AudioDevice::Init() 8 | { 9 | if (!contextInitialized) { 10 | contextInitialized = true; 11 | InitAudioChannels(); 12 | } 13 | 14 | ma_device_config config = ma_device_config_init(ma_device_type_playback); 15 | config.playback.format = ma_format_f32; // Set to ma_format_unknown to use the device's native format. 16 | config.playback.channels = 2; // Set to 0 to use the device's native channel count. 17 | config.periodSizeInFrames = MIX_BUFFER_SIZE; 18 | config.sampleRate = AUDIO_FREQUENCY; // Set to 0 to use the device's native sample rate. 19 | config.dataCallback = AudioCallback; // This function will be called when miniaudio needs more data. 20 | 21 | ma_result result = ma_device_init(NULL, &config, &device); 22 | if (result != MA_SUCCESS) { 23 | PrintLog(PRINT_NORMAL, "[MA] Initializing device failed: %d", result); 24 | return false; 25 | } 26 | 27 | result = ma_device_start(&device); 28 | if (result != MA_SUCCESS) { 29 | PrintLog(PRINT_NORMAL, "[MA] Starting device failed: %d", result); 30 | return false; 31 | } 32 | 33 | return true; 34 | } 35 | 36 | void AudioDevice::Release() 37 | { 38 | ma_device_uninit(&device); 39 | } 40 | 41 | void AudioDevice::InitAudioChannels() { AudioDeviceBase::InitAudioChannels(); } 42 | 43 | void RSDK::AudioDevice::AudioCallback(ma_device* device, void *output, const void *input, ma_uint32 frameCount) 44 | { 45 | (void)input; 46 | (void)device; 47 | 48 | AudioDevice::ProcessAudioMixing(output, frameCount * AUDIO_CHANNELS); 49 | } 50 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Audio/MiniAudio/MiniAudioDevice.hpp: -------------------------------------------------------------------------------- 1 | #define LockAudioDevice() 2 | #define UnlockAudioDevice() 3 | 4 | #include 5 | 6 | namespace RSDK 7 | { 8 | class AudioDevice : public AudioDeviceBase 9 | { 10 | public: 11 | static ma_device device; 12 | 13 | static bool32 Init(); 14 | static void Release(); 15 | 16 | static void FrameInit() {} 17 | 18 | inline static void HandleStreamLoad(ChannelInfo *channel, bool32 async) 19 | { 20 | if (async) { 21 | std::thread thread(LoadStream, channel); 22 | thread.detach(); 23 | } 24 | else 25 | LoadStream(channel); 26 | } 27 | 28 | private: 29 | static uint8 contextInitialized; 30 | 31 | static void InitAudioChannels(); 32 | 33 | static void AudioCallback(ma_device* device, void *output, const void *input, ma_uint32 frameCount); 34 | }; 35 | } // namespace RSDK -------------------------------------------------------------------------------- /RSDKv5/RSDK/Audio/NX/NXAudioDevice.cpp: -------------------------------------------------------------------------------- 1 | 2 | uint8 AudioDevice::contextInitialized; 3 | 4 | bool32 AudioDevice::Init() 5 | { 6 | if (!contextInitialized) { 7 | contextInitialized = true; 8 | InitAudioChannels(); 9 | } 10 | 11 | return true; 12 | } 13 | 14 | void AudioDevice::Release() 15 | { 16 | LockAudioDevice(); 17 | AudioDeviceBase::Release(); 18 | UnlockAudioDevice(); 19 | } 20 | 21 | void AudioDevice::InitAudioChannels() 22 | { 23 | AudioDeviceBase::InitAudioChannels(); 24 | } 25 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Audio/NX/NXAudioDevice.hpp: -------------------------------------------------------------------------------- 1 | 2 | #define LockAudioDevice() ; 3 | #define UnlockAudioDevice() ; 4 | 5 | namespace RSDK 6 | { 7 | class AudioDevice : public AudioDeviceBase 8 | { 9 | public: 10 | static bool32 Init(); 11 | static void Release(); 12 | 13 | static void FrameInit() {} 14 | 15 | inline static void HandleStreamLoad(ChannelInfo *channel, bool32 async) { LoadStream(channel); } 16 | 17 | private: 18 | static uint8 contextInitialized; 19 | 20 | static void InitAudioChannels(); 21 | static void InitMixBuffer() {} 22 | }; 23 | } // namespace RSDK -------------------------------------------------------------------------------- /RSDKv5/RSDK/Audio/Oboe/OboeAudioDevice.hpp: -------------------------------------------------------------------------------- 1 | #define LockAudioDevice() pthread_mutex_lock(&AudioDevice::mutex); 2 | #define UnlockAudioDevice() pthread_mutex_unlock(&AudioDevice::mutex); 3 | 4 | #include 5 | 6 | namespace RSDK 7 | { 8 | struct AudioDevice : public AudioDeviceBase, public oboe::AudioStreamDataCallback, public oboe::AudioStreamErrorCallback { 9 | static bool32 Init(); 10 | static void Release(); 11 | 12 | static void FrameInit(); 13 | 14 | static void HandleStreamLoad(ChannelInfo *channel, bool32 async); 15 | 16 | static pthread_mutex_t mutex; 17 | 18 | oboe::DataCallbackResult onAudioReady(oboe::AudioStream *s, void *data, int32 len); 19 | void onErrorAfterClose(oboe::AudioStream *s, oboe::Result error); 20 | 21 | private: 22 | static uint8 contextInitialized; 23 | static oboe::Result status; 24 | static oboe::AudioStream *stream; 25 | 26 | static AudioDevice *audioDevice; // can't believe i have to do this 27 | 28 | static void InitAudioChannels(); 29 | static void InitMixBuffer() {} 30 | 31 | static void *LoadStreamASync(void *channel) 32 | { 33 | LoadStream((ChannelInfo *)channel); 34 | pthread_exit(NULL); 35 | }; 36 | 37 | static bool createStream(); 38 | static bool shutdownStream(); 39 | }; 40 | } // namespace RSDK 41 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Audio/PortAudio/PortAudioDevice.cpp: -------------------------------------------------------------------------------- 1 | uint8 AudioDevice::contextInitialized; 2 | PaStream *AudioDevice::stream; 3 | 4 | bool32 AudioDevice::Init() 5 | { 6 | if (!contextInitialized) { 7 | contextInitialized = true; 8 | InitAudioChannels(); 9 | } 10 | 11 | PaError result; 12 | result = Pa_Initialize(); 13 | if (result != paNoError) { 14 | PrintLog(PRINT_NORMAL, "[PA] Initialization failed: %s", Pa_GetErrorText(result)); 15 | return false; 16 | } 17 | result = Pa_OpenDefaultStream(&stream, 0, AUDIO_CHANNELS, paFloat32, AUDIO_FREQUENCY, MIX_BUFFER_SIZE, AudioCallback, nullptr); 18 | if (result != paNoError) { 19 | PrintLog(PRINT_NORMAL, "[PA] Opening stream failed: %s", Pa_GetErrorText(result)); 20 | return false; 21 | } 22 | result = Pa_StartStream(stream); 23 | if (result != paNoError) { 24 | PrintLog(PRINT_NORMAL, "[PA] Starting stream failed: %s", Pa_GetErrorText(result)); 25 | return false; 26 | } 27 | return true; 28 | } 29 | 30 | void AudioDevice::Release() 31 | { 32 | Pa_StopStream(stream); 33 | Pa_Terminate(); 34 | } 35 | 36 | void AudioDevice::InitAudioChannels() { AudioDeviceBase::InitAudioChannels(); } 37 | 38 | int RSDK::AudioDevice::AudioCallback(const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo *timeInfo, 39 | PaStreamCallbackFlags statusFlags, void *userData) 40 | { 41 | (void)input; 42 | (void)timeInfo; 43 | (void)statusFlags; 44 | (void)userData; 45 | 46 | AudioDevice::ProcessAudioMixing(output, frameCount * AUDIO_CHANNELS); 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Audio/PortAudio/PortAudioDevice.hpp: -------------------------------------------------------------------------------- 1 | #define LockAudioDevice() 2 | #define UnlockAudioDevice() 3 | 4 | #include 5 | 6 | namespace RSDK 7 | { 8 | class AudioDevice : public AudioDeviceBase 9 | { 10 | public: 11 | static PaStream *stream; 12 | 13 | static bool32 Init(); 14 | static void Release(); 15 | 16 | static void FrameInit() {} 17 | 18 | inline static void HandleStreamLoad(ChannelInfo *channel, bool32 async) 19 | { 20 | if (async) { 21 | std::thread thread(LoadStream, channel); 22 | thread.detach(); 23 | } 24 | else 25 | LoadStream(channel); 26 | } 27 | 28 | private: 29 | static uint8 contextInitialized; 30 | 31 | static void InitAudioChannels(); 32 | 33 | static int AudioCallback(const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo *timeInfo, 34 | PaStreamCallbackFlags statusFlags, void *userData); 35 | }; 36 | } // namespace RSDK -------------------------------------------------------------------------------- /RSDKv5/RSDK/Audio/SDL2/SDL2AudioDevice.cpp: -------------------------------------------------------------------------------- 1 | 2 | uint8 AudioDevice::contextInitialized; 3 | 4 | SDL_AudioDeviceID AudioDevice::device; 5 | SDL_AudioSpec AudioDevice::deviceSpec; 6 | 7 | bool32 AudioDevice::Init() 8 | { 9 | SDL_InitSubSystem(SDL_INIT_AUDIO); 10 | if (!contextInitialized) { 11 | contextInitialized = true; 12 | InitAudioChannels(); 13 | } 14 | 15 | SDL_AudioSpec want; 16 | want.freq = AUDIO_FREQUENCY; 17 | want.format = AUDIO_F32SYS; 18 | want.samples = MIX_BUFFER_SIZE / AUDIO_CHANNELS; 19 | want.channels = AUDIO_CHANNELS; 20 | want.callback = AudioCallback; 21 | 22 | audioState = false; 23 | if ((device = SDL_OpenAudioDevice(nullptr, 0, &want, &deviceSpec, SDL_AUDIO_ALLOW_SAMPLES_CHANGE)) > 0) { 24 | SDL_PauseAudioDevice(device, SDL_FALSE); 25 | audioState = true; 26 | } 27 | else { 28 | PrintLog(PRINT_NORMAL, "ERROR: Unable to open audio device!"); 29 | PrintLog(PRINT_NORMAL, "ERROR: %s", SDL_GetError()); 30 | } 31 | 32 | return true; 33 | } 34 | 35 | void AudioDevice::Release() 36 | { 37 | SDL_PauseAudioDevice(device, SDL_TRUE); 38 | 39 | LockAudioDevice(); 40 | AudioDeviceBase::Release(); 41 | UnlockAudioDevice(); 42 | 43 | SDL_CloseAudioDevice(device); 44 | SDL_QuitSubSystem(SDL_INIT_AUDIO); 45 | } 46 | 47 | void AudioDevice::InitAudioChannels() 48 | { 49 | AudioDeviceBase::InitAudioChannels(); 50 | } 51 | 52 | void AudioDevice::AudioCallback(void *data, uint8 *stream, int32 len) 53 | { 54 | (void)data; // Unused 55 | 56 | AudioDevice::ProcessAudioMixing(stream, len / sizeof(SAMPLE_FORMAT)); 57 | } 58 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Audio/SDL2/SDL2AudioDevice.hpp: -------------------------------------------------------------------------------- 1 | #define LockAudioDevice() SDL_LockAudioDevice(AudioDevice::device) 2 | #define UnlockAudioDevice() SDL_UnlockAudioDevice(AudioDevice::device) 3 | 4 | namespace RSDK 5 | { 6 | class AudioDevice : public AudioDeviceBase 7 | { 8 | public: 9 | static SDL_AudioDeviceID device; 10 | 11 | static bool32 Init(); 12 | static void Release(); 13 | 14 | static void FrameInit() {} 15 | 16 | inline static void HandleStreamLoad(ChannelInfo *channel, bool32 async) 17 | { 18 | if (async) 19 | SDL_CreateThread((SDL_ThreadFunction)LoadStream, "LoadStream", (void *)channel); 20 | else 21 | LoadStream(channel); 22 | } 23 | 24 | private: 25 | static SDL_AudioSpec deviceSpec; 26 | 27 | static uint8 contextInitialized; 28 | 29 | static void InitAudioChannels(); 30 | 31 | static void AudioCallback(void *data, uint8 *stream, int32 len); 32 | }; 33 | } // namespace RSDK -------------------------------------------------------------------------------- /RSDKv5/RSDK/Audio/XAudio/XAudioDevice.hpp: -------------------------------------------------------------------------------- 1 | #define LockAudioDevice() EnterCriticalSection(&AudioDevice::criticalSection) 2 | #define UnlockAudioDevice() LeaveCriticalSection(&AudioDevice::criticalSection) 3 | 4 | // DX9 5 | namespace RSDK 6 | { 7 | class AudioDeviceCallback : public IXAudio2VoiceCallback 8 | { 9 | void WINAPI OnVoiceProcessingPassStart(UINT32 BytesRequired) {} 10 | void WINAPI OnVoiceProcessingPassEnd() {} 11 | void WINAPI OnStreamEnd() {} 12 | void WINAPI OnBufferStart(void *pBufferContext) {} 13 | void WINAPI OnBufferEnd(void *pBufferContext); 14 | void WINAPI OnLoopEnd(void *pBufferContext) {} 15 | void WINAPI OnVoiceError(void *pBufferContext, HRESULT Error) {} 16 | }; 17 | 18 | #ifdef __GNUC__ 19 | // using clang to compile? stfu 20 | #pragma GCC diagnostic push 21 | #pragma GCC diagnostic ignored "-Wmicrosoft-exception-spec" 22 | #endif 23 | 24 | class AudioEngineCallback : public IXAudio2EngineCallback 25 | { 26 | void WINAPI OnProcessingPassStart(void) {} 27 | void WINAPI OnProcessingPassEnd(void) {} 28 | void WINAPI OnCriticalError(HRESULT Error); 29 | }; 30 | 31 | #ifdef __GNUC__ 32 | #pragma GCC diagnostic pop 33 | #endif 34 | 35 | struct AudioDevice : public AudioDeviceBase { 36 | static bool32 Init(); 37 | static void Release(); 38 | 39 | static void FrameInit(); 40 | 41 | static void HandleStreamLoad(ChannelInfo *channel, bool32 async); 42 | 43 | static uint8 contextInitialized; 44 | 45 | static IXAudio2 *audioContext; 46 | static IXAudio2MasteringVoice *masteringVoice; 47 | static IXAudio2SourceVoice *sourceVoice; 48 | static AudioDeviceCallback voiceCallback; 49 | static AudioEngineCallback engineCallback; 50 | 51 | static RTL_CRITICAL_SECTION criticalSection; 52 | 53 | static int32 mixBufferID; 54 | static SAMPLE_FORMAT mixBuffer[3][MIX_BUFFER_SIZE]; 55 | 56 | private: 57 | static void InitAudioChannels(); 58 | static void InitMixBuffer(); 59 | static HRESULT InitContext(); 60 | 61 | DWORD static WINAPI LoadStreamASync(LPVOID channel) 62 | { 63 | LoadStream((ChannelInfo *)channel); 64 | return 0; 65 | } 66 | }; 67 | } // namespace RSDK -------------------------------------------------------------------------------- /RSDKv5/RSDK/Core/Legacy/ModAPILegacy.hpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | namespace Legacy 4 | { 5 | 6 | #if RETRO_USE_MOD_LOADER 7 | 8 | #define LEGACY_PLAYERNAME_COUNT (0x10) 9 | 10 | extern char modTypeNames[OBJECT_COUNT][0x40]; 11 | extern char modScriptPaths[OBJECT_COUNT][0x40]; 12 | extern uint8 modScriptFlags[OBJECT_COUNT]; 13 | extern uint8 modObjCount; 14 | 15 | namespace v4 16 | { 17 | 18 | // Native Functions 19 | int32 OpenModMenu(); 20 | 21 | void RefreshEngine(); 22 | void GetModCount(); 23 | void GetModName(int32 *textMenu, int32 *highlight, uint32 *id, int32 *unused); 24 | void GetModDescription(int32 *textMenu, int32 *highlight, uint32 *id, int32 *unused); 25 | void GetModAuthor(int32 *textMenu, int32 *highlight, uint32 *id, int32 *unused); 26 | void GetModVersion(int32 *textMenu, int32 *highlight, uint32 *id, int32 *unused); 27 | void GetModActive(uint32 *id, int32 *unused); 28 | void SetModActive(uint32 *id, int32 *active); 29 | void MoveMod(uint32 *id, int32 *up); 30 | 31 | void ExitGame(); 32 | void FileExists(int32 *unused, const char *filePath); 33 | 34 | void AddGameAchievement(int32 *unused, const char *name); 35 | void SetAchievementDescription(uint32 *id, const char *desc); 36 | void ClearAchievements(); 37 | void GetAchievementCount(); 38 | void GetAchievementName(uint32 *id, int32 *textMenu); 39 | void GetAchievementDescription(uint32 *id, int32 *textMenu); 40 | void GetAchievement(uint32 *id, void *unused); 41 | 42 | void GetScreenWidth(); 43 | void SetScreenWidth(int32 *width, int32 *unused); 44 | void GetWindowScale(); 45 | void SetWindowScale(int32 *scale, int32 *unused); 46 | void GetWindowScaleMode(); 47 | void SetWindowScaleMode(int32 *mode, int32 *unused); 48 | void GetWindowFullScreen(); 49 | void SetWindowFullScreen(int32 *fullscreen, int32 *unused); 50 | void GetWindowBorderless(); 51 | void SetWindowBorderless(int32 *borderless, int32 *unused); 52 | void GetWindowVSync(); 53 | void SetWindowVSync(int32 *enabled, int32 *unused); 54 | void ApplyWindowChanges(); 55 | } // namespace v4 56 | 57 | #endif 58 | 59 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Core/Legacy/RetroEngineLegacy.cpp: -------------------------------------------------------------------------------- 1 | #if RETRO_USE_MOD_LOADER 2 | // both v3 and v4 use these 3 | std::vector listData; 4 | std::vector listCategory; 5 | #endif 6 | 7 | namespace RSDK 8 | { 9 | namespace Legacy 10 | { 11 | 12 | #include "v3/RetroEnginev3.cpp" 13 | #include "v4/RetroEnginev4.cpp" 14 | 15 | int32 gameMode = ENGINE_MAINGAME; 16 | bool32 usingBytecode = false; 17 | 18 | bool32 trialMode = false; 19 | int32 gamePlatformID = LEGACY_RETRO_WIN; 20 | int32 deviceType = DEVICE_STANDARD; 21 | bool32 onlineActive = false; 22 | int32 language = LEGACY_LANGUAGE_EN; 23 | #if LEGACY_RETRO_USE_HAPTICS 24 | bool32 hapticsEnabled = false; 25 | #endif 26 | 27 | int32 sinM7LookupTable[0x200]; 28 | int32 cosM7LookupTable[0x200]; 29 | 30 | void CalculateTrigAnglesM7() 31 | { 32 | for (int32 i = 0; i < 0x200; ++i) { 33 | sinM7LookupTable[i] = (int32)(sinf((i / 256.0) * RSDK_PI) * 4096.0); 34 | cosM7LookupTable[i] = (int32)(cosf((i / 256.0) * RSDK_PI) * 4096.0); 35 | } 36 | 37 | cosM7LookupTable[0x00] = 0x1000; 38 | cosM7LookupTable[0x80] = 0; 39 | cosM7LookupTable[0x100] = -0x1000; 40 | cosM7LookupTable[0x180] = 0; 41 | 42 | sinM7LookupTable[0x00] = 0; 43 | sinM7LookupTable[0x80] = 0x1000; 44 | sinM7LookupTable[0x100] = 0; 45 | sinM7LookupTable[0x180] = -0x1000; 46 | } 47 | 48 | } // namespace Legacy 49 | } // namespace RSDK -------------------------------------------------------------------------------- /RSDKv5/RSDK/Core/Legacy/RetroEngineLegacy.hpp: -------------------------------------------------------------------------------- 1 | 2 | #include "v3/RetroEnginev3.hpp" 3 | #include "v4/RetroEnginev4.hpp" 4 | 5 | namespace Legacy 6 | { 7 | 8 | #define LEGACY_RETRO_USE_HAPTICS (1) 9 | 10 | enum RetroStates { 11 | ENGINE_DEVMENU = 0, 12 | ENGINE_MAINGAME = 1, 13 | ENGINE_INITDEVMENU = 2, 14 | 15 | ENGINE_SCRIPTERROR = 4, 16 | }; 17 | 18 | enum DeviceTypes { DEVICE_STANDARD = 0, DEVICE_MOBILE = 1 }; 19 | 20 | enum GamePlatformID { 21 | LEGACY_RETRO_WIN = 0, 22 | LEGACY_RETRO_OSX = 1, 23 | LEGACY_RETRO_XBOX_360 = 2, 24 | LEGACY_RETRO_PS3 = 3, 25 | LEGACY_RETRO_iOS = 4, 26 | LEGACY_RETRO_ANDROID = 5, 27 | LEGACY_RETRO_WP7 = 6 28 | }; 29 | 30 | enum RetroLanguages { 31 | LEGACY_LANGUAGE_EN = 0, 32 | LEGACY_LANGUAGE_FR = 1, 33 | LEGACY_LANGUAGE_IT = 2, 34 | LEGACY_LANGUAGE_DE = 3, 35 | LEGACY_LANGUAGE_ES = 4, 36 | LEGACY_LANGUAGE_JP = 5, 37 | LEGACY_LANGUAGE_PT = 6, 38 | LEGACY_LANGUAGE_RU = 7, 39 | LEGACY_LANGUAGE_KO = 8, 40 | LEGACY_LANGUAGE_ZH = 9, 41 | LEGACY_LANGUAGE_ZS = 10 42 | }; 43 | 44 | extern int32 gameMode; 45 | extern bool32 usingBytecode; 46 | 47 | extern bool32 trialMode; 48 | extern int32 gamePlatformID; 49 | extern int32 deviceType; 50 | extern bool32 onlineActive; 51 | extern int32 language; 52 | #if LEGACY_RETRO_USE_HAPTICS 53 | extern bool32 hapticsEnabled; 54 | #endif 55 | 56 | extern int32 sinM7LookupTable[0x200]; 57 | extern int32 cosM7LookupTable[0x200]; 58 | 59 | void CalculateTrigAnglesM7(); 60 | 61 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Core/Legacy/v3/RetroEnginev3.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | namespace v3 5 | { 6 | enum RetroStates { 7 | ENGINE_EXITGAME = 3, 8 | ENGINE_ENTER_HIRESMODE = 5, 9 | ENGINE_EXIT_HIRESMODE = 6, 10 | ENGINE_PAUSE = 7, 11 | ENGINE_WAIT = 8, 12 | ENGINE_VIDEOWAIT = 9, 13 | }; 14 | 15 | extern int32 engineMessage; 16 | 17 | bool32 LoadGameConfig(const char *filepath); 18 | void ProcessEngine(); 19 | 20 | void RetroEngineCallback(int32 callbackID); 21 | 22 | #if RETRO_USE_MOD_LOADER 23 | void LoadGameXML(bool pal = false); 24 | void LoadXMLWindowText(const tinyxml2::XMLElement *gameElement); 25 | void LoadXMLVariables(const tinyxml2::XMLElement* gameElement); 26 | void LoadXMLPalettes(const tinyxml2::XMLElement* gameElement); 27 | void LoadXMLObjects(const tinyxml2::XMLElement* gameElement); 28 | void LoadXMLSoundFX(const tinyxml2::XMLElement* gameElement); 29 | void LoadXMLPlayers(const tinyxml2::XMLElement* gameElement); 30 | void LoadXMLStages(const tinyxml2::XMLElement* gameElement); 31 | #endif 32 | 33 | } // namespace v3 34 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Core/Legacy/v4/RetroEnginev4.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | namespace v4 5 | { 6 | enum RetroStates { 7 | ENGINE_WAIT = 3, 8 | ENGINE_INITPAUSE = 5, 9 | ENGINE_EXITPAUSE = 6, 10 | ENGINE_ENDGAME = 7, 11 | ENGINE_RESETGAME = 8, 12 | }; 13 | 14 | bool32 LoadGameConfig(const char *filepath); 15 | void ProcessEngine(); 16 | 17 | #if RETRO_USE_MOD_LOADER 18 | void LoadGameXML(bool pal = false); 19 | void LoadXMLWindowText(const tinyxml2::XMLElement *gameElement); 20 | void LoadXMLVariables(const tinyxml2::XMLElement *gameElement); 21 | void LoadXMLPalettes(const tinyxml2::XMLElement* gameElement); 22 | void LoadXMLObjects(const tinyxml2::XMLElement* gameElement); 23 | void LoadXMLSoundFX(const tinyxml2::XMLElement* gameElement); 24 | void LoadXMLPlayers(const tinyxml2::XMLElement* gameElement); 25 | void LoadXMLStages(const tinyxml2::XMLElement* gameElement); 26 | #endif 27 | 28 | } // namespace v4 29 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Graphics/DX11/BackupShaders.hpp: -------------------------------------------------------------------------------- 1 | const char backupHLSL[] = 2 | R"( 3 | cbuffer RSDKBuffer : register(b0) 4 | { 5 | float2 pixelSize; 6 | float2 textureSize; 7 | float2 viewSize; 8 | 9 | #if defined(RETRO_REV02) 10 | float2 screenDim; 11 | #endif 12 | }; 13 | 14 | Texture2D texDiffuse : register(t0); 15 | SamplerState sampDiffuse : register(s0); 16 | 17 | struct VertexInput { 18 | float3 pos : SV_POSITION; 19 | float2 tex : TEXCOORD; 20 | }; 21 | 22 | struct VertexOutput { 23 | float4 pos : SV_POSITION; 24 | float4 tex : TEXCOORD; 25 | }; 26 | 27 | struct PixelInput { 28 | float4 pos : SV_POSITION; 29 | float2 tex : TEXCOORD; 30 | }; 31 | 32 | VertexOutput VSMain(VertexInput input) 33 | { 34 | VertexOutput output; 35 | 36 | output.pos = float4(input.pos.xyz, 1.0); 37 | output.tex = float4(input.tex.xy, 0.0, 0.0); 38 | 39 | return output; 40 | } 41 | 42 | float4 PSMain(PixelInput input) : SV_TARGET 43 | { 44 | return texDiffuse.Sample(sampDiffuse, input.tex); 45 | } 46 | )"; 47 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Graphics/Legacy/AnimationLegacy.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | 5 | #define LEGACY_ANIFILE_COUNT (0x100) 6 | #define LEGACY_ANIMATION_COUNT (0x400) 7 | #define LEGACY_SPRITEFRAME_COUNT (0x1000) 8 | 9 | #define LEGACY_HITBOX_COUNT (0x20) 10 | #define LEGACY_HITBOX_DIR_COUNT (0x8) 11 | 12 | enum AnimRotationFlags { ROTSTYLE_NONE, ROTSTYLE_FULL, ROTSTYLE_45DEG, ROTSTYLE_STATICFRAMES }; 13 | 14 | struct AnimationFile { 15 | char fileName[0x20]; 16 | int32 animCount; 17 | int32 aniListOffset; 18 | int32 hitboxListOffset; 19 | }; 20 | 21 | struct SpriteAnimation { 22 | char name[16]; 23 | uint8 frameCount; 24 | uint8 speed; 25 | uint8 loopPoint; 26 | uint8 rotationStyle; 27 | int32 frameListOffset; 28 | }; 29 | 30 | struct SpriteFrame { 31 | int32 sprX; 32 | int32 sprY; 33 | int32 width; 34 | int32 height; 35 | int32 pivotX; 36 | int32 pivotY; 37 | uint8 sheetID; 38 | uint8 hitboxID; 39 | }; 40 | 41 | struct Hitbox { 42 | int8 left[LEGACY_HITBOX_DIR_COUNT]; 43 | int8 top[LEGACY_HITBOX_DIR_COUNT]; 44 | int8 right[LEGACY_HITBOX_DIR_COUNT]; 45 | int8 bottom[LEGACY_HITBOX_DIR_COUNT]; 46 | }; 47 | 48 | extern AnimationFile animationFileList[LEGACY_ANIFILE_COUNT]; 49 | extern int32 animationFileCount; 50 | 51 | extern SpriteFrame scriptFrames[LEGACY_SPRITEFRAME_COUNT]; 52 | extern int32 scriptFrameCount; 53 | 54 | extern SpriteFrame animFrames[LEGACY_SPRITEFRAME_COUNT]; 55 | extern int32 animFrameCount; 56 | extern SpriteAnimation animationList[LEGACY_ANIMATION_COUNT]; 57 | extern int32 animationCount; 58 | extern Hitbox hitboxList[LEGACY_HITBOX_COUNT]; 59 | extern int32 hitboxCount; 60 | 61 | void LoadAnimationFile(char *filePath); 62 | void ClearAnimationData(); 63 | 64 | AnimationFile *AddAnimationFile(char *filePath); 65 | 66 | inline AnimationFile *GetDefaultAnimationRef() { return &animationFileList[0]; } 67 | 68 | namespace v3 69 | { 70 | void ProcessObjectAnimation(void *objScr, void *ent); 71 | } 72 | 73 | namespace v4 74 | { 75 | void ProcessObjectAnimation(void *objScr, void *ent); 76 | } 77 | 78 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Graphics/Legacy/Scene3DLegacy.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | 5 | enum FaceFlags { 6 | FACE_FLAG_TEXTURED_3D = 0, 7 | FACE_FLAG_TEXTURED_2D = 1, 8 | FACE_FLAG_COLORED_3D = 2, 9 | FACE_FLAG_COLORED_2D = 3, 10 | FACE_FLAG_FADED = 4, 11 | FACE_FLAG_TEXTURED_C = 5, 12 | FACE_FLAG_TEXTURED_C_BLEND = 6, 13 | FACE_FLAG_3DSPRITE = 7 14 | }; 15 | 16 | enum MatrixTypes { 17 | MAT_WORLD = 0, 18 | MAT_VIEW = 1, 19 | MAT_TEMP = 2, 20 | }; 21 | 22 | struct Matrix { 23 | int32 values[4][4]; 24 | }; 25 | 26 | struct Vertex { 27 | int32 x; 28 | int32 y; 29 | int32 z; 30 | int32 u; 31 | int32 v; 32 | }; 33 | 34 | struct Face { 35 | int32 a; 36 | int32 b; 37 | int32 c; 38 | int32 d; 39 | uint32 color; 40 | int32 flag; 41 | }; 42 | 43 | struct DrawListEntry3D { 44 | int32 faceID; 45 | int32 depth; 46 | }; 47 | 48 | extern int32 vertexCount; 49 | extern int32 faceCount; 50 | 51 | extern Matrix matFinal; 52 | extern Matrix matWorld; 53 | extern Matrix matView; 54 | extern Matrix matTemp; 55 | 56 | extern int32 projectionX; 57 | extern int32 projectionY; 58 | 59 | extern int32 faceLineStart[SCREEN_YSIZE]; 60 | extern int32 faceLineEnd[SCREEN_YSIZE]; 61 | 62 | extern int32 faceLineStartU[SCREEN_YSIZE]; 63 | extern int32 faceLineEndU[SCREEN_YSIZE]; 64 | extern int32 faceLineStartV[SCREEN_YSIZE]; 65 | extern int32 faceLineEndV[SCREEN_YSIZE]; 66 | 67 | void ProcessScanEdge(Vertex *vertA, Vertex *vertB); 68 | void ProcessScanEdgeUV(Vertex *vertA, Vertex *vertB); 69 | 70 | } // namespace Legacy 71 | 72 | #include "v3/Scene3DLegacyv3.hpp" 73 | #include "v4/Scene3DLegacyv4.hpp" -------------------------------------------------------------------------------- /RSDKv5/RSDK/Graphics/Legacy/SpriteLegacy.cpp: -------------------------------------------------------------------------------- 1 | 2 | int32 RSDK::Legacy::AddGraphicsFile(const char *filePath) 3 | { 4 | char sheetPath[0x100]; 5 | 6 | StrCopy(sheetPath, "Data/Sprites/"); 7 | StrAdd(sheetPath, filePath); 8 | 9 | int32 sheetID = 0; 10 | while (StrLength(gfxSurface[sheetID].fileName) > 0) { 11 | if (StrComp(gfxSurface[sheetID].fileName, sheetPath)) 12 | return sheetID; 13 | if (++sheetID == LEGACY_SURFACE_COUNT) 14 | return 0; 15 | } 16 | 17 | ImageGIF image; 18 | if (image.Load(sheetPath, true)) { 19 | GFXSurface *surface = &gfxSurface[sheetID]; 20 | 21 | StrCopy(surface->fileName, sheetPath); 22 | surface->width = image.width; 23 | surface->height = image.height; 24 | 25 | surface->dataPosition = gfxDataPosition; 26 | gfxDataPosition += surface->width * surface->height; 27 | 28 | if (gfxDataPosition < LEGACY_GFXDATA_SIZE) { 29 | image.pixels = &graphicData[surface->dataPosition]; 30 | image.Load(NULL, false); 31 | } 32 | else { 33 | gfxDataPosition = 0; 34 | PrintLog(PRINT_NORMAL, "WARNING: Exceeded max gfx size!"); 35 | } 36 | 37 | surface->widthShift = 0; 38 | int32 w = surface->width; 39 | while (w > 1) { 40 | w >>= 1; 41 | ++surface->widthShift; 42 | } 43 | } 44 | 45 | return sheetID; 46 | } 47 | 48 | void RSDK::Legacy::RemoveGraphicsFile(const char *filePath, int32 sheetID) 49 | { 50 | if (sheetID < 0) { 51 | for (int32 i = 0; i < LEGACY_SURFACE_COUNT; ++i) { 52 | if (StrLength(gfxSurface[i].fileName) > 0 && StrComp(gfxSurface[i].fileName, filePath)) 53 | sheetID = i; 54 | } 55 | } 56 | 57 | if (sheetID >= 0 && StrLength(gfxSurface[sheetID].fileName)) { 58 | StrCopy(gfxSurface[sheetID].fileName, ""); 59 | int32 dataPosStart = gfxSurface[sheetID].dataPosition; 60 | int32 dataPosEnd = gfxSurface[sheetID].dataPosition + gfxSurface[sheetID].height * gfxSurface[sheetID].width; 61 | 62 | for (int32 i = LEGACY_GFXDATA_SIZE - dataPosEnd; i > 0; --i) graphicData[dataPosStart++] = graphicData[dataPosEnd++]; 63 | gfxDataPosition -= gfxSurface[sheetID].height * gfxSurface[sheetID].width; 64 | 65 | for (int32 i = 0; i < LEGACY_SURFACE_COUNT; ++i) { 66 | if (gfxSurface[i].dataPosition > gfxSurface[sheetID].dataPosition) 67 | gfxSurface[i].dataPosition -= gfxSurface[sheetID].height * gfxSurface[sheetID].width; 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /RSDKv5/RSDK/Graphics/Legacy/SpriteLegacy.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | 5 | int32 AddGraphicsFile(const char *filePath); 6 | void RemoveGraphicsFile(const char *filePath, int32 sheetID); 7 | 8 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Graphics/Legacy/v3/DrawingLegacyv3.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | 5 | namespace v3 6 | { 7 | void DrawObjectList(int32 group); 8 | void DrawStageGFX(); 9 | 10 | #if !RETRO_USE_ORIGINAL_CODE 11 | void DrawDebugOverlays(); 12 | #endif 13 | 14 | bool32 VideoSkipCB(); 15 | } // namespace v3 16 | 17 | } // namespace Legacy 18 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Graphics/Legacy/v3/Scene3DLegacyv3.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | 5 | namespace v3 6 | { 7 | 8 | #define LEGACY_v3_VERTEXBUFFER_SIZE (0x1000) 9 | #define LEGACY_v3_FACEBUFFER_SIZE (0x400) 10 | 11 | extern Face faceBuffer[LEGACY_v3_FACEBUFFER_SIZE]; 12 | extern Vertex vertexBuffer[LEGACY_v3_VERTEXBUFFER_SIZE]; 13 | extern Vertex vertexBufferT[LEGACY_v3_VERTEXBUFFER_SIZE]; 14 | 15 | extern DrawListEntry3D drawList3D[LEGACY_v3_FACEBUFFER_SIZE]; 16 | 17 | void SetIdentityMatrix(Matrix *matrix); 18 | void MatrixMultiply(Matrix *matrixA, Matrix *matrixB); 19 | void MatrixTranslateXYZ(Matrix *Matrix, int32 x, int32 y, int32 z); 20 | void MatrixScaleXYZ(Matrix *matrix, int32 scaleX, int32 scaleY, int32 scaleZ); 21 | void MatrixRotateX(Matrix *matrix, int32 rotationX); 22 | void MatrixRotateY(Matrix *matrix, int32 rotationY); 23 | void MatrixRotateZ(Matrix *matrix, int32 rotationZ); 24 | void MatrixRotateXYZ(Matrix *matrix, int32 rotationX, int32 rotationY, int32 rotationZ); 25 | void TransformVertexBuffer(); 26 | void TransformVerticies(Matrix *matrix, int32 startIndex, int32 endIndex); 27 | void Sort3DDrawList(); 28 | void Draw3DScene(int32 spriteSheetID); 29 | 30 | } // namespace v3 31 | 32 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Graphics/Legacy/v4/DrawingLegacyv4.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | 5 | namespace v4 6 | { 7 | void DrawObjectList(int32 group); 8 | void DrawStageGFX(); 9 | 10 | #if !RETRO_USE_ORIGINAL_CODE 11 | void DrawDebugOverlays(); 12 | #endif 13 | } // namespace v4 14 | 15 | } // namespace Legacy 16 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Graphics/Legacy/v4/Scene3DLegacyv4.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | 5 | namespace v4 6 | { 7 | 8 | #define LEGACY_v4_VERTEXBUFFER_SIZE (0x1000) 9 | #define LEGACY_v4_FACEBUFFER_SIZE (0x400) 10 | 11 | extern Face faceBuffer[LEGACY_v4_FACEBUFFER_SIZE]; 12 | extern Vertex vertexBuffer[LEGACY_v4_VERTEXBUFFER_SIZE]; 13 | extern Vertex vertexBufferT[LEGACY_v4_VERTEXBUFFER_SIZE]; 14 | 15 | extern DrawListEntry3D drawList3D[LEGACY_v4_FACEBUFFER_SIZE]; 16 | 17 | extern int32 fogColor; 18 | extern int32 fogStrength; 19 | 20 | void SetIdentityMatrix(Matrix *matrix); 21 | void MatrixMultiply(Matrix *matrixA, Matrix *matrixB); 22 | void MatrixTranslateXYZ(Matrix *Matrix, int32 x, int32 y, int32 z); 23 | void MatrixScaleXYZ(Matrix *matrix, int32 scaleX, int32 scaleY, int32 scaleZ); 24 | void MatrixRotateX(Matrix *matrix, int32 rotationX); 25 | void MatrixRotateY(Matrix *matrix, int32 rotationY); 26 | void MatrixRotateZ(Matrix *matrix, int32 rotationZ); 27 | void MatrixRotateXYZ(Matrix *matrix, int16 rotationX, int16 rotationY, int16 rotationZ); 28 | void MatrixInverse(Matrix *matrix); 29 | void TransformVertexBuffer(); 30 | void TransformVertices(Matrix *matrix, int32 startIndex, int32 endIndex); 31 | void Sort3DDrawList(); 32 | void Draw3DScene(int32 spriteSheetID); 33 | 34 | } // namespace v4 35 | 36 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Graphics/Video.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VIDEO_H 2 | #define VIDEO_H 3 | 4 | namespace RSDK 5 | { 6 | 7 | struct VideoManager { 8 | static FileInfo file; 9 | 10 | static ogg_sync_state oy; 11 | static ogg_page og; 12 | static ogg_stream_state vo; 13 | static ogg_stream_state to; 14 | static ogg_packet op; 15 | static th_info ti; 16 | static th_comment tc; 17 | static th_dec_ctx *td; 18 | static th_setup_info *ts; 19 | 20 | static th_pixel_fmt pixelFormat; 21 | static ogg_int64_t granulePos; 22 | static bool32 initializing; 23 | }; 24 | 25 | bool32 LoadVideo(const char *filename, double startDelay, bool32 (*skipCallback)()); 26 | void ProcessVideo(); 27 | 28 | } // namespace RSDK 29 | 30 | #endif // VIDEO_H 31 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Input/GLFW/GLFWInputDevice.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace SKU 3 | { 4 | 5 | struct InputDeviceGLFW : InputDevice { 6 | void UpdateInput(); 7 | void ProcessInput(int32 controllerID); 8 | void CloseDevice(); 9 | 10 | uint32 currentState; 11 | GLFWgamepadstate states[2]; 12 | uint32 jid; 13 | 14 | bool32 swapABXY; 15 | }; 16 | 17 | InputDeviceGLFW *InitGLFWInputDevice(uint32 id, uint8 controllerID); 18 | void InitGLFWInputAPI(); 19 | 20 | } // namespace SKU -------------------------------------------------------------------------------- /RSDKv5/RSDK/Input/Keyboard/KBInputDevice.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace SKU 3 | { 4 | 5 | extern int32 keyState[PLAYER_COUNT]; 6 | 7 | struct InputDeviceKeyboard : InputDevice { 8 | void UpdateInput(); 9 | void ProcessInput(int32 controllerID); 10 | 11 | uint16 buttonMasks; 12 | uint16 prevButtonMasks; 13 | uint8 controllerID; 14 | int32 mouseHideTimer; 15 | uint8 stateUp; 16 | uint8 stateDown; 17 | uint8 stateLeft; 18 | uint8 stateRight; 19 | uint8 stateA; 20 | uint8 stateB; 21 | uint8 stateC; 22 | uint8 stateX; 23 | uint8 stateY; 24 | uint8 stateZ; 25 | uint8 stateStart; 26 | uint8 stateSelect; 27 | }; 28 | 29 | void InitKeyboardInputAPI(); 30 | InputDeviceKeyboard *InitKeyboardDevice(uint32 id); 31 | 32 | void UpdateKeyState(int32 keyCode); 33 | void ClearKeyState(int32 keyCode); 34 | 35 | #if !RETRO_REV02 36 | extern int32 specialKeyStates[4]; 37 | extern int32 prevSpecialKeyStates[4]; 38 | extern int32 buttonDownCount; 39 | extern int32 prevButtonDownCount; 40 | 41 | void HandleSpecialKeys(); 42 | #endif 43 | 44 | } // namespace SKU 45 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Input/NX/NXInputDevice.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace SKU 3 | { 4 | 5 | struct InputDeviceNX : InputDevice { 6 | void ProcessInput(int32 controllerID); 7 | 8 | int64 buttonMasks; 9 | float hDelta_L; 10 | float hDelta_R; 11 | float vDelta_L; 12 | float vDelta_R; 13 | HidNpadIdType npadType; 14 | }; 15 | 16 | struct InputDeviceNXHandheld : InputDeviceNX { 17 | void UpdateInput(); 18 | }; 19 | 20 | struct InputDeviceNXJoyL : InputDeviceNX { 21 | void UpdateInput(); 22 | }; 23 | 24 | struct InputDeviceNXJoyR : InputDeviceNX { 25 | void UpdateInput(); 26 | }; 27 | 28 | struct InputDeviceNXJoyGrip : InputDeviceNX { 29 | void UpdateInput(); 30 | }; 31 | 32 | struct InputDeviceNXPro : InputDeviceNX { 33 | void UpdateInput(); 34 | }; 35 | 36 | extern int32 currentNXControllerType; 37 | 38 | InputDeviceNXHandheld *InitNXHandheldInputDevice(uint32 id, HidNpadIdType type); 39 | InputDeviceNXJoyL *InitNXJoyLInputDevice(uint32 id, HidNpadIdType type); 40 | InputDeviceNXJoyR *InitNXJoyRInputDevice(uint32 id, HidNpadIdType type); 41 | InputDeviceNXJoyGrip *InitNXJoyGripInputDevice(uint32 id, HidNpadIdType type); 42 | InputDeviceNXPro *InitNXProInputDevice(uint32 id, HidNpadIdType type); 43 | 44 | void InitNXInputAPI(); 45 | void ProcessNXInputDevices(); 46 | 47 | } // namespace SKU -------------------------------------------------------------------------------- /RSDKv5/RSDK/Input/Paddleboat/PDBInputDevice.hpp: -------------------------------------------------------------------------------- 1 | namespace SKU 2 | { 3 | 4 | struct InputDevicePaddleboat : InputDevice { 5 | void UpdateInput(); 6 | void ProcessInput(int32 controllerID); 7 | void CloseDevice(); 8 | 9 | Paddleboat_Controller_Data inputState[2]; 10 | uint8 activeState; 11 | uint8 controllerID; 12 | 13 | uint8 stateUp; 14 | uint8 stateDown; 15 | uint8 stateLeft; 16 | uint8 stateRight; 17 | uint8 stateA; 18 | uint8 stateB; 19 | uint8 stateX; 20 | uint8 stateY; 21 | uint8 stateStart; 22 | uint8 stateSelect; 23 | uint8 stateBumper_L; 24 | uint8 stateBumper_R; 25 | uint8 stateStick_L; 26 | uint8 stateStick_R; 27 | float hDelta_L; 28 | float vDelta_L; 29 | float hDelta_R; 30 | float vDelta_R; 31 | float deltaBumper_L; 32 | float deltaTrigger_L; 33 | float deltaBumper_R; 34 | float deltaTrigger_R; 35 | }; 36 | 37 | InputDevicePaddleboat *InitPaddleboatInputDevice(uint32 id, uint8 controllerID); 38 | void InitPaddleboatInputAPI(); 39 | void ProcessPaddleboatInputDevices(); 40 | 41 | void PaddleboatStatusCallback(const int32 jid, const Paddleboat_ControllerStatus status, void *); 42 | 43 | } // namespace SKU -------------------------------------------------------------------------------- /RSDKv5/RSDK/Input/RawInput/RawInputDevice.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace SKU 3 | { 4 | 5 | enum RawInputMappingTypes { 6 | RAWMAP_NONE, 7 | RAWMAP_ONBUTTONDOWN, 8 | RAWMAP_ONBUTTONUP, 9 | RAWMAP_DIRECTIONAL, 10 | RAWMAP_ANALOG_NEG, 11 | RAWMAP_ANALOG_POS, 12 | }; 13 | 14 | enum RawInputButtonIDs { 15 | RAWBUTTON_UP, 16 | RAWBUTTON_DOWN, 17 | RAWBUTTON_LEFT, 18 | RAWBUTTON_RIGHT, 19 | RAWBUTTON_START, 20 | RAWBUTTON_SELECT, 21 | RAWBUTTON_STICKL, 22 | RAWBUTTON_STICKR, 23 | RAWBUTTON_L1, 24 | RAWBUTTON_R1, 25 | RAWBUTTON_C, 26 | RAWBUTTON_Z, 27 | RAWBUTTON_A, 28 | RAWBUTTON_B, 29 | RAWBUTTON_X, 30 | RAWBUTTON_Y, 31 | RAWBUTTON_L2, 32 | RAWBUTTON_R2, 33 | RAWBUTTON_TRIGGER_L, 34 | RAWBUTTON_TRIGGER_R, 35 | RAWBUTTON_HDELTA_L, 36 | RAWBUTTON_VDELTA_L, 37 | RAWBUTTON_HDELTA_R, 38 | RAWBUTTON_VDELTA_R, 39 | RAWBUTTON_COUNT, 40 | }; 41 | 42 | struct InputDeviceRaw : InputDevice { 43 | void UpdateInput(); 44 | void ProcessInput(int32 controllerID); 45 | 46 | HANDLE deviceHandle; 47 | 48 | int32 activeButtons; 49 | int32 buttonMasks; 50 | int32 prevButtonMasks; 51 | uint8 stateUp; 52 | uint8 stateDown; 53 | uint8 stateLeft; 54 | uint8 stateRight; 55 | uint8 stateA; 56 | uint8 stateB; 57 | uint8 stateC; 58 | uint8 stateX; 59 | uint8 stateY; 60 | uint8 stateZ; 61 | uint8 stateStart; 62 | uint8 stateSelect; 63 | uint8 stateBumper_L; 64 | uint8 stateBumper_R; 65 | uint8 stateStick_L; 66 | uint8 stateStick_R; 67 | uint8 stateTrigger_L; 68 | uint8 stateTrigger_R; 69 | float triggerDeltaL; 70 | float triggerDeltaR; 71 | float hDelta_L; 72 | float vDelta_L; 73 | float vDelta_R; 74 | float hDelta_R; 75 | float unused1; 76 | float unused2; 77 | GamePadButtonMap buttons[24]; 78 | }; 79 | 80 | extern bool32 HIDEnabled; 81 | 82 | extern InputDevice *rawInputDevices[INPUTDEVICE_COUNT]; 83 | extern int32 rawInputDeviceCount; 84 | 85 | extern tagRAWINPUT rawInputData; 86 | 87 | InputDeviceRaw *InitRawInputDevice(uint32 id); 88 | 89 | inline InputDeviceRaw *GetRawInputDevice(uint8 *deviceID) 90 | { 91 | if (*deviceID >= inputDeviceCount) 92 | return NULL; 93 | 94 | for (int32 d = *deviceID; d < inputDeviceCount; ++d) { 95 | if (!inputDeviceList[d]) 96 | continue; 97 | 98 | InputDeviceRaw *device = (InputDeviceRaw *)inputDeviceList[d]; 99 | 100 | if (((device->gamepadType >> 16) & 0xFF) == DEVICE_API_RAWINPUT) { 101 | *deviceID = d; 102 | return device; 103 | } 104 | } 105 | 106 | return NULL; 107 | } 108 | 109 | void InitHIDAPI(); 110 | void InitHIDDevices(); 111 | void UpdateHIDButtonStates(HRAWINPUT hRawInput); 112 | 113 | } // namespace SKU -------------------------------------------------------------------------------- /RSDKv5/RSDK/Input/SDL2/SDL2InputDevice.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace SKU 3 | { 4 | 5 | struct InputDeviceSDL : InputDevice { 6 | void UpdateInput(); 7 | void ProcessInput(int32 controllerID); 8 | void CloseDevice(); 9 | 10 | int32 buttonMasks; 11 | int32 prevButtonMasks; 12 | uint8 stateUp; 13 | uint8 stateDown; 14 | uint8 stateLeft; 15 | uint8 stateRight; 16 | uint8 stateA; 17 | uint8 stateB; 18 | uint8 stateC; 19 | uint8 stateX; 20 | uint8 stateY; 21 | uint8 stateZ; 22 | uint8 stateStart; 23 | uint8 stateSelect; 24 | uint8 stateBumper_L; 25 | uint8 stateBumper_R; 26 | uint8 stateStick_L; 27 | uint8 stateStick_R; 28 | float bumperDeltaL; 29 | float bumperDeltaR; 30 | float triggerDeltaL; 31 | float triggerDeltaR; 32 | float hDelta_L; 33 | float vDelta_L; 34 | float vDelta_R; 35 | float hDelta_R; 36 | 37 | SDL_GameController *controllerPtr; 38 | bool32 swapABXY; 39 | }; 40 | 41 | InputDeviceSDL *InitSDL2InputDevice(uint32 id, SDL_GameController *game_controller); 42 | 43 | void InitSDL2InputAPI(); 44 | void ReleaseSDL2InputAPI(); 45 | 46 | } // namespace SKU -------------------------------------------------------------------------------- /RSDKv5/RSDK/Input/Steam/SteamInputDevice.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace SKU 3 | { 4 | 5 | struct InputDeviceSteam : InputDevice { 6 | void UpdateInput(); 7 | void ProcessInput(int32 controllerID); 8 | 9 | int32 keyMasks[9]; 10 | 11 | uint16 buttonMasks; 12 | uint16 prevButtonMasks; 13 | uint8 controllerID; 14 | uint8 stateUp; 15 | uint8 stateDown; 16 | uint8 stateLeft; 17 | uint8 stateRight; 18 | uint8 stateA; 19 | uint8 stateB; 20 | uint8 stateC; 21 | uint8 stateX; 22 | uint8 stateY; 23 | uint8 stateZ; 24 | uint8 stateStart; 25 | uint8 stateSelect; 26 | }; 27 | 28 | void InitSteamInputAPI(); 29 | InputDeviceSteam *InitSteamInputDevice(uint32 id); 30 | 31 | } // namespace SKU -------------------------------------------------------------------------------- /RSDKv5/RSDK/Input/XInput/XInputDevice.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace SKU 3 | { 4 | 5 | struct InputDeviceXInput : InputDevice { 6 | void UpdateInput(); 7 | void ProcessInput(int32 controllerID); 8 | 9 | XINPUT_STATE inputState[2]; 10 | uint8 activeState; 11 | uint8 controllerID; 12 | uint8 stateUp; 13 | uint8 stateDown; 14 | uint8 stateLeft; 15 | uint8 stateRight; 16 | uint8 stateA; 17 | uint8 stateB; 18 | uint8 stateX; 19 | uint8 stateY; 20 | uint8 stateStart; 21 | uint8 stateSelect; 22 | uint8 stateBumper_L; 23 | uint8 stateBumper_R; 24 | uint8 stateStick_L; 25 | uint8 stateStick_R; 26 | int32 unused; 27 | float hDelta_L; 28 | float vDelta_L; 29 | float hDelta_R; 30 | float vDelta_R; 31 | float deltaBumper_L; 32 | float deltaTrigger_L; 33 | float deltaBumper_R; 34 | float deltaTrigger_R; 35 | }; 36 | 37 | extern bool32 disabledXInputDevices[PLAYER_COUNT]; 38 | 39 | InputDeviceXInput *InitXInputDevice(uint32 id); 40 | 41 | void InitXInputAPI(); 42 | void UpdateXInputDevices(); 43 | 44 | } // namespace SKU -------------------------------------------------------------------------------- /RSDKv5/RSDK/Scene/Legacy/CollisionLegacy.cpp: -------------------------------------------------------------------------------- 1 | #include "v3/CollisionLegacyv3.cpp" 2 | #include "v4/CollisionLegacyv4.cpp" -------------------------------------------------------------------------------- /RSDKv5/RSDK/Scene/Legacy/CollisionLegacy.hpp: -------------------------------------------------------------------------------- 1 | #include "v3/CollisionLegacyv3.hpp" 2 | #include "v4/CollisionLegacyv4.hpp" -------------------------------------------------------------------------------- /RSDKv5/RSDK/Scene/Legacy/ObjectLegacy.hpp: -------------------------------------------------------------------------------- 1 | 2 | #define LEGACY_RETRO_USE_COMPILER (1) 3 | 4 | #include "v3/ObjectLegacyv3.hpp" 5 | #include "v3/PlayerLegacyv3.hpp" 6 | #include "v3/ScriptLegacyv3.hpp" 7 | 8 | #include "v4/ObjectLegacyv4.hpp" 9 | #include "v4/ScriptLegacyv4.hpp" 10 | 11 | namespace Legacy 12 | { 13 | 14 | extern int32 OBJECT_BORDER_X1; 15 | extern int32 OBJECT_BORDER_X2; 16 | extern int32 OBJECT_BORDER_X3; 17 | extern int32 OBJECT_BORDER_X4; 18 | extern const int32 OBJECT_BORDER_Y1; 19 | extern const int32 OBJECT_BORDER_Y2; 20 | extern const int32 OBJECT_BORDER_Y3; 21 | extern const int32 OBJECT_BORDER_Y4; 22 | 23 | extern char scriptErrorMessage[0x400]; 24 | 25 | bool32 ConvertStringToInteger(const char *text, int32 *value); 26 | 27 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Scene/Legacy/v3/ObjectLegacyv3.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | 5 | namespace v3 6 | { 7 | #define LEGACY_v3_ENTITY_COUNT (0x4A0) 8 | #define LEGACY_v3_TEMPENTITY_START (LEGACY_v3_ENTITY_COUNT - 0x80) 9 | #define LEGACY_v3_OBJECT_COUNT (0x100) 10 | 11 | struct Entity { 12 | int32 XPos; 13 | int32 YPos; 14 | int32 values[8]; 15 | int32 scale; 16 | int32 rotation; 17 | int32 animationTimer; 18 | int32 animationSpeed; 19 | uint8 type; 20 | uint8 propertyValue; 21 | uint8 state; 22 | uint8 priority; 23 | uint8 drawOrder; 24 | uint8 direction; 25 | uint8 inkEffect; 26 | uint8 alpha; 27 | uint8 animation; 28 | uint8 prevAnimation; 29 | uint8 frame; 30 | }; 31 | 32 | enum ObjectTypes { 33 | OBJ_TYPE_BLANKOBJECT = 0 // 0 is always blank obj 34 | }; 35 | 36 | enum ObjectPriority { 37 | // The entity is active if the entity is on screen or within 128 pixels of the screen borders on any axis 38 | PRIORITY_BOUNDS, 39 | // The entity is always active, unless the stage state is PAUSED or FROZEN 40 | PRIORITY_ACTIVE, 41 | // Same as PRIORITY_ACTIVE, the entity even runs when the stage state is PAUSED or FROZEN 42 | PRIORITY_ALWAYS, 43 | // Same as PRIORITY_BOUNDS, however it only does checks on the x-axis, so when in bounds on the x-axis, the y position doesn't matter 44 | PRIORITY_XBOUNDS, 45 | // Same as PRIORITY_BOUNDS, however the entity's type will be set to BLANK OBJECT when it becomes inactive 46 | PRIORITY_BOUNDS_DESTROY, 47 | // Never Active. 48 | PRIORITY_INACTIVE, 49 | }; 50 | 51 | extern int32 objectLoop; 52 | extern int32 curObjectType; 53 | extern Entity objectEntityList[LEGACY_v3_ENTITY_COUNT]; 54 | 55 | extern char typeNames[LEGACY_v3_OBJECT_COUNT][0x40]; 56 | 57 | void ProcessStartupObjects(); 58 | void ProcessObjects(); 59 | void ProcessPausedObjects(); 60 | 61 | void SetObjectTypeName(const char *objectName, int32 objectID); 62 | } // namespace v3 63 | 64 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Scene/Legacy/v3/PlayerLegacyv3.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | 5 | namespace v3 6 | { 7 | #define LEGACY_v3_PLAYER_COUNT (2) 8 | 9 | enum PlayerControlModes { 10 | CONTROLMODE_NONE = -1, 11 | CONTROLMODE_NORMAL = 0, 12 | CONTROLMODE_SIDEKICK = 1, 13 | }; 14 | 15 | struct Player { 16 | int32 entityNo; 17 | int32 XPos; 18 | int32 YPos; 19 | int32 XVelocity; 20 | int32 YVelocity; 21 | int32 speed; 22 | int32 screenXPos; 23 | int32 screenYPos; 24 | int32 angle; 25 | int32 timer; 26 | int32 lookPos; 27 | int32 values[8]; 28 | uint8 collisionMode; 29 | uint8 skidding; 30 | uint8 pushing; 31 | uint8 collisionPlane; 32 | int8 controlMode; 33 | uint8 controlLock; 34 | int32 topSpeed; 35 | int32 acceleration; 36 | int32 deceleration; 37 | int32 airAcceleration; 38 | int32 airDeceleration; 39 | int32 gravityStrength; 40 | int32 jumpStrength; 41 | int32 jumpCap; 42 | int32 rollingAcceleration; 43 | int32 rollingDeceleration; 44 | uint8 visible; 45 | uint8 tileCollisions; 46 | uint8 objectInteractions; 47 | uint8 left; 48 | uint8 right; 49 | uint8 up; 50 | uint8 down; 51 | uint8 jumpPress; 52 | uint8 jumpHold; 53 | uint8 followPlayer1; 54 | uint8 trackScroll; 55 | uint8 gravity; 56 | uint8 water; 57 | uint8 flailing[3]; 58 | AnimationFile *animationFile; 59 | Entity *boundEntity; 60 | }; 61 | 62 | extern Player playerList[LEGACY_v3_PLAYER_COUNT]; 63 | extern int32 playerListPos; 64 | extern int32 activePlayer; 65 | extern int32 activePlayerCount; 66 | 67 | extern uint16 upBuffer; 68 | extern uint16 downBuffer; 69 | extern uint16 leftBuffer; 70 | extern uint16 rightBuffer; 71 | extern uint16 jumpPressBuffer; 72 | extern uint16 jumpHoldBuffer; 73 | 74 | extern uint8 nextLeaderPosID; 75 | extern uint8 lastLeaderPosID; 76 | 77 | extern int16 leaderPositionBufferX[16]; 78 | extern int16 leaderPositionBufferY[16]; 79 | 80 | void ProcessPlayerControl(Player *player); 81 | } // namespace v3 82 | 83 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Scene/Legacy/v3/SceneLegacyv3.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | 5 | namespace v3 6 | { 7 | 8 | extern int32 yScrollA; 9 | extern int32 yScrollB; 10 | extern int32 xScrollA; 11 | extern int32 xScrollB; 12 | extern int32 yScrollMove; 13 | 14 | void InitFirstStage(); 15 | void ProcessStage(); 16 | void HandleCameras(); 17 | 18 | void ProcessParallaxAutoScroll(); 19 | 20 | void LoadStageFiles(); 21 | void LoadActLayout(); 22 | void LoadStageBackground(); 23 | 24 | void SetPlayerScreenPosition(Player *player); 25 | void SetPlayerScreenPositionCDStyle(Player *player); 26 | void SetPlayerHLockedScreenPosition(Player *player); 27 | void SetPlayerLockedScreenPosition(Player *player); 28 | 29 | } // namespace v3 30 | 31 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Scene/Legacy/v3/ScriptLegacyv3.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | 5 | namespace v3 6 | { 7 | 8 | #define LEGACY_v3_SCRIPTDATA_COUNT (0x40000) 9 | #define LEGACY_v3_JUMPTABLE_COUNT (0x4000) 10 | #define LEGACY_v3_FUNCTION_COUNT (0x200) 11 | 12 | #define LEGACY_v3_JUMPSTACK_COUNT (0x400) 13 | #define LEGACY_v3_FUNCSTACK_COUNT (0x400) 14 | 15 | struct ScriptPtr { 16 | int32 scriptCodePtr; 17 | int32 jumpTablePtr; 18 | }; 19 | 20 | struct ScriptFunction { 21 | #if LEGACY_RETRO_USE_COMPILER 22 | char name[0x20]; 23 | #endif 24 | ScriptPtr ptr; 25 | }; 26 | 27 | struct ObjectScript { 28 | int32 frameCount; 29 | int32 spriteSheetID; 30 | ScriptPtr subMain; 31 | ScriptPtr subPlayerInteraction; 32 | ScriptPtr subDraw; 33 | ScriptPtr subStartup; 34 | int32 frameListOffset; 35 | AnimationFile *animFile; 36 | }; 37 | 38 | struct ScriptEngine { 39 | int32 operands[10]; 40 | int32 tempValue[8]; 41 | int32 arrayPosition[3]; 42 | int32 checkResult; 43 | }; 44 | 45 | enum ScriptSubs { SUB_MAIN = 0, SUB_PLAYERINTERACTION = 1, SUB_DRAW = 2, SUB_SETUP = 3 }; 46 | 47 | extern ObjectScript objectScriptList[LEGACY_v3_OBJECT_COUNT]; 48 | 49 | extern ScriptFunction scriptFunctionList[LEGACY_v3_FUNCTION_COUNT]; 50 | extern int32 scriptFunctionCount; 51 | 52 | extern int32 scriptCode[LEGACY_v3_SCRIPTDATA_COUNT]; 53 | extern int32 jumpTable[LEGACY_v3_JUMPTABLE_COUNT]; 54 | 55 | extern int32 jumpTableStack[LEGACY_v3_JUMPSTACK_COUNT]; 56 | extern int32 functionStack[LEGACY_v3_FUNCSTACK_COUNT]; 57 | 58 | extern int32 scriptCodePos; 59 | extern int32 scriptCodeOffset; 60 | extern int32 jumpTablePos; 61 | extern int32 jumpTableOffset; 62 | 63 | extern int32 jumpTableStackPos; 64 | extern int32 functionStackPos; 65 | 66 | extern ScriptEngine scriptEng; 67 | extern char scriptText[0x100]; 68 | 69 | extern int32 aliasCount; 70 | extern int32 lineID; 71 | 72 | #if LEGACY_RETRO_USE_COMPILER 73 | 74 | void CheckAliasText(char *text); 75 | void ConvertArithmaticSyntax(char *text); 76 | void ConvertIfWhileStatement(char *text); 77 | bool32 ConvertSwitchStatement(char *text); 78 | void ConvertFunctionText(char *text); 79 | void CheckCaseNumber(char *text); 80 | bool32 ReadSwitchCase(char *text); 81 | void AppendIntegerToString(char *text, int32 value); 82 | void CopyAliasStr(char *dest, char *text, bool32 arrayIndex); 83 | bool32 CheckOpcodeType(char *text); // Never actually used 84 | 85 | void ParseScriptFile(char *scriptName, int32 scriptID); 86 | #endif 87 | 88 | void LoadBytecode(int32 scriptID, bool32 globalCode); 89 | 90 | void ProcessScript(int32 scriptCodeStart, int32 jumpTableStart, uint8 scriptSub); 91 | 92 | void ClearScriptData(); 93 | 94 | } // namespace v3 95 | 96 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Scene/Legacy/v4/SceneLegacyv4.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | 5 | namespace v4 6 | { 7 | 8 | enum StageModes { 9 | STAGEMODE_FROZEN = 3, 10 | STAGEMODE_2P, 11 | }; 12 | 13 | void InitFirstStage(); 14 | void ProcessStage(); 15 | void HandleCameras(); 16 | 17 | void ProcessParallaxAutoScroll(); 18 | 19 | void LoadStageFiles(); 20 | 21 | void LoadActLayout(); 22 | void LoadStageBackground(); 23 | 24 | void SetPlayerScreenPosition(Entity *target); 25 | void SetPlayerScreenPositionCDStyle(Entity *target); 26 | void SetPlayerHLockedScreenPosition(Entity *target); 27 | void SetPlayerLockedScreenPosition(Entity *target); 28 | void SetPlayerScreenPositionFixed(Entity *target); 29 | void SetPlayerScreenPositionStatic(Entity *target); 30 | } // namespace v4 31 | 32 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Scene/Objects/DefaultObject.cpp: -------------------------------------------------------------------------------- 1 | #include "RSDK/Core/RetroEngine.hpp" 2 | 3 | using namespace RSDK; 4 | 5 | ObjectDefaultObject *RSDK::DefaultObject; 6 | 7 | void RSDK::DefaultObject_Update() 8 | { 9 | if (controller[CONT_ANY].keyUp.down) { 10 | if (screens[CONT_ANY].position.y > 0) 11 | screens[CONT_ANY].position.y -= 4; 12 | } 13 | else if (controller[CONT_ANY].keyDown.down) { 14 | screens[CONT_ANY].position.y += 4; 15 | } 16 | 17 | if (controller[CONT_ANY].keyLeft.down) { 18 | if (screens[CONT_ANY].position.x > 0) 19 | screens[CONT_ANY].position.x -= 4; 20 | } 21 | else if (controller[CONT_ANY].keyRight.down) { 22 | screens[CONT_ANY].position.x += 4; 23 | } 24 | } 25 | 26 | void RSDK::DefaultObject_LateUpdate() {} 27 | 28 | void RSDK::DefaultObject_StaticUpdate() {} 29 | 30 | void RSDK::DefaultObject_Draw() {} 31 | 32 | void RSDK::DefaultObject_Create(void *data) 33 | { 34 | RSDK_THIS(DefaultObject); 35 | 36 | self->active = ACTIVE_ALWAYS; 37 | DefaultObject->active = ACTIVE_ALWAYS; 38 | } 39 | 40 | void RSDK::DefaultObject_StageLoad() {} 41 | 42 | #if RETRO_REV0U 43 | void RSDK::DefaultObject_StaticLoad(ObjectDefaultObject *staticVars) { memset(staticVars, 0, sizeof(*staticVars)); } 44 | #endif 45 | 46 | void RSDK::DefaultObject_EditorLoad() {} 47 | 48 | void RSDK::DefaultObject_EditorDraw() {} 49 | 50 | void RSDK::DefaultObject_Serialize() {} 51 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Scene/Objects/DefaultObject.hpp: -------------------------------------------------------------------------------- 1 | #ifndef OBJ_DEFAULTOBJECT_H 2 | #define OBJ_DEFAULTOBJECT_H 3 | 4 | namespace RSDK 5 | { 6 | 7 | // Object Class 8 | struct ObjectDefaultObject : Object { 9 | // Nothin' 10 | }; 11 | 12 | // Entity Class 13 | struct EntityDefaultObject : Entity { 14 | // Nothin' 15 | }; 16 | 17 | // Object Entity 18 | extern ObjectDefaultObject *DefaultObject; 19 | 20 | // Standard Entity Events 21 | void DefaultObject_Update(); 22 | void DefaultObject_LateUpdate(); 23 | void DefaultObject_StaticUpdate(); 24 | void DefaultObject_Draw(); 25 | void DefaultObject_Create(void *data); 26 | void DefaultObject_StageLoad(); 27 | #if RETRO_REV0U 28 | void DefaultObject_StaticLoad(ObjectDefaultObject *staticVars); 29 | #endif 30 | void DefaultObject_EditorLoad(); 31 | void DefaultObject_EditorDraw(); 32 | void DefaultObject_Serialize(); 33 | 34 | // Extra Entity Functions 35 | 36 | } // namespace RSDK 37 | 38 | #endif //! OBJ_DEFAULTOBJECT_H 39 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Scene/Objects/DevOutput.cpp: -------------------------------------------------------------------------------- 1 | #include "RSDK/Core/RetroEngine.hpp" 2 | 3 | #if RETRO_REV02 4 | using namespace RSDK; 5 | 6 | ObjectDevOutput *RSDK::DevOutput; 7 | 8 | void RSDK::DevOutput_Update() 9 | { 10 | RSDK_THIS(DevOutput); 11 | 12 | switch (self->state) { 13 | default: break; 14 | 15 | case DEVOUTPUT_DELAY: 16 | if (self->timer <= 0) 17 | self->state = DEVOUTPUT_ENTERPOPUP; 18 | else 19 | self->timer--; 20 | break; 21 | 22 | case DEVOUTPUT_ENTERPOPUP: 23 | if (self->position.y >= 0) 24 | self->state = DEVOUTPUT_SHOWPOPUP; 25 | else 26 | self->position.y += 2; 27 | break; 28 | 29 | case DEVOUTPUT_SHOWPOPUP: 30 | if (self->timer >= 120) 31 | self->state = 3; 32 | else 33 | self->timer++; 34 | break; 35 | 36 | case DEVOUTPUT_EXITPOPUP: 37 | self->position.y -= 2; 38 | if (-self->position.y > self->ySize) 39 | ResetEntity(self, TYPE_DEFAULTOBJECT, NULL); 40 | break; 41 | } 42 | } 43 | 44 | void RSDK::DevOutput_LateUpdate() {} 45 | 46 | void RSDK::DevOutput_StaticUpdate() {} 47 | 48 | void RSDK::DevOutput_Draw() 49 | { 50 | RSDK_THIS(DevOutput); 51 | 52 | DrawRectangle(0, 0, currentScreen->size.x, self->position.y + self->ySize, 0x000080, 0xFF, INK_NONE, true); 53 | DrawDevString(self->message, 8, self->position.y + 8, 0, 0xF0F0F0); 54 | } 55 | 56 | void RSDK::DevOutput_Create(void *data) 57 | { 58 | RSDK_THIS(DevOutput); 59 | strncpy(self->message, (char *)data, 0x3F4); 60 | 61 | self->active = ACTIVE_ALWAYS; 62 | self->visible = true; 63 | self->isPermanent = true; 64 | self->drawGroup = 15; 65 | self->timer = 180 * GetEntityCount(DevOutput->classID, false); 66 | self->ySize = DevOutput_GetStringYSize(self->message); 67 | self->position.y = -self->ySize; 68 | } 69 | 70 | void RSDK::DevOutput_StageLoad() {} 71 | 72 | #if RETRO_REV0U 73 | void RSDK::DevOutput_StaticLoad(ObjectDevOutput *staticVars) { memset(staticVars, 0, sizeof(*staticVars)); } 74 | #endif 75 | 76 | void RSDK::DevOutput_EditorLoad() {} 77 | 78 | void RSDK::DevOutput_EditorDraw() {} 79 | 80 | void RSDK::DevOutput_Serialize() {} 81 | 82 | int32 RSDK::DevOutput_GetStringYSize(char *string) 83 | { 84 | if (!*string) 85 | return 24; 86 | 87 | int32 lineCount = 0; 88 | while (*string) { 89 | if (*string == '\n') 90 | lineCount++; 91 | 92 | ++string; 93 | } 94 | 95 | if (lineCount >= 1) 96 | return 8 * lineCount + 16; 97 | else 98 | return 24; 99 | } 100 | #endif 101 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Scene/Objects/DevOutput.hpp: -------------------------------------------------------------------------------- 1 | #ifndef OBJ_DEVOUTPUT_H 2 | #define OBJ_DEVOUTPUT_H 3 | 4 | #if RETRO_REV02 5 | namespace RSDK 6 | { 7 | 8 | enum DevOutputStates { 9 | DEVOUTPUT_DELAY, 10 | DEVOUTPUT_ENTERPOPUP, 11 | DEVOUTPUT_SHOWPOPUP, 12 | DEVOUTPUT_EXITPOPUP, 13 | }; 14 | 15 | // Object Class 16 | struct ObjectDevOutput : Object { 17 | // Nothin' 18 | }; 19 | 20 | // Entity Class 21 | struct EntityDevOutput : Entity { 22 | int32 state; 23 | int32 timer; 24 | int32 ySize; 25 | char message[1012]; 26 | }; 27 | 28 | // Object Entity 29 | extern ObjectDevOutput *DevOutput; 30 | 31 | // Standard Entity Events 32 | void DevOutput_Update(); 33 | void DevOutput_LateUpdate(); 34 | void DevOutput_StaticUpdate(); 35 | void DevOutput_Draw(); 36 | void DevOutput_Create(void *data); 37 | void DevOutput_StageLoad(); 38 | #if RETRO_REV0U 39 | void DevOutput_StaticLoad(ObjectDevOutput *staticVars); 40 | #endif 41 | void DevOutput_EditorLoad(); 42 | void DevOutput_EditorDraw(); 43 | void DevOutput_Serialize(); 44 | 45 | // Extra Entity Functions 46 | int32 DevOutput_GetStringYSize(char *string); 47 | 48 | } // namespace RSDK 49 | #endif 50 | 51 | #endif //! OBJ_DEVOUTPUT_H 52 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/Storage/Legacy/TextLegacy.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | 5 | #define LEGACY_TEXTDATA_COUNT (0x2800) 6 | #define LEGACY_TEXTENTRY_COUNT (0x200) 7 | #define LEGACY_TEXTMENU_COUNT (0x2) 8 | 9 | enum TextInfoTypes { TEXTINFO_TEXTDATA = 0, TEXTINFO_TEXTSIZE = 1, TEXTINFO_ROWCOUNT = 2 }; 10 | 11 | struct TextMenu { 12 | uint16 textData[LEGACY_TEXTDATA_COUNT]; 13 | int32 entryStart[LEGACY_TEXTENTRY_COUNT]; 14 | int32 entrySize[LEGACY_TEXTENTRY_COUNT]; 15 | uint8 entryHighlight[LEGACY_TEXTENTRY_COUNT]; 16 | int32 textDataPos; 17 | int32 selection1; 18 | int32 selection2; 19 | uint16 rowCount; 20 | uint16 visibleRowCount; 21 | uint16 visibleRowOffset; 22 | uint8 alignment; 23 | uint8 selectionCount; 24 | int8 timer; 25 | }; 26 | 27 | enum TextMenuAlignments { 28 | MENU_ALIGN_LEFT, 29 | MENU_ALIGN_RIGHT, 30 | MENU_ALIGN_CENTER, 31 | }; 32 | 33 | extern TextMenu gameMenu[LEGACY_TEXTMENU_COUNT]; 34 | extern int32 textMenuSurfaceNo; 35 | 36 | void SetupTextMenu(TextMenu *menu, int32 rowCount); 37 | void AddTextMenuEntry(TextMenu *menu, const char *text); 38 | void SetTextMenuEntry(TextMenu *menu, const char *text, int32 rowID); 39 | void EditTextMenuEntry(TextMenu *menu, const char *text, int32 rowID); 40 | 41 | namespace v4 42 | { 43 | void LoadTextFile(TextMenu *menu, const char *filePath); 44 | } 45 | 46 | namespace v3 47 | { 48 | 49 | #define LEGACY_v3_FONTCHAR_COUNT (0x400) 50 | 51 | struct FontCharacter { 52 | int32 id; 53 | int16 srcX; 54 | int16 srcY; 55 | int16 width; 56 | int16 height; 57 | int16 pivotX; 58 | int16 pivotY; 59 | int16 xAdvance; 60 | }; 61 | 62 | extern FontCharacter fontCharacterList[LEGACY_v3_FONTCHAR_COUNT]; 63 | 64 | void LoadTextFile(TextMenu *menu, const char *filePath, uint8 mapCode); 65 | 66 | void LoadFontFile(const char *filePath); 67 | void DrawBitmapText(void *menu, int32 XPos, int32 YPos, int32 scale, int32 spacing, int32 rowStart, int32 rowCount); 68 | } // namespace v3 69 | 70 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/Storage/Legacy/UserStorageLegacy.hpp: -------------------------------------------------------------------------------- 1 | 2 | namespace Legacy 3 | { 4 | 5 | #define LEGACY_GLOBALVAR_COUNT (0x100) 6 | 7 | #define LEGACY_SAVEDATA_SIZE (0x2000) 8 | 9 | #if RETRO_USE_MOD_LOADER 10 | #define LEGACY_v4_NATIIVEFUNCTION_COUNT (0x30) 11 | #else 12 | #define LEGACY_v4_NATIIVEFUNCTION_COUNT (0x10) 13 | #endif 14 | 15 | struct GlobalVariable { 16 | char name[0x20]; 17 | int32 value; 18 | }; 19 | 20 | extern void *nativeFunction[LEGACY_v4_NATIIVEFUNCTION_COUNT]; 21 | extern int32 nativeFunctionCount; 22 | 23 | extern int32 globalVariablesCount; 24 | extern GlobalVariable globalVariables[LEGACY_GLOBALVAR_COUNT]; 25 | 26 | extern int32 saveRAM[LEGACY_SAVEDATA_SIZE]; 27 | 28 | int32 GetGlobalVariableByName(const char *name); 29 | void SetGlobalVariableByName(const char *name, int32 value); 30 | int32 GetGlobalVariableID(const char *name); 31 | 32 | #define AddNativeFunction(name, funcPtr) \ 33 | if (nativeFunctionCount < LEGACY_v4_NATIIVEFUNCTION_COUNT) { \ 34 | SetGlobalVariableByName(name, nativeFunctionCount); \ 35 | nativeFunction[nativeFunctionCount++] = (void *)funcPtr; \ 36 | } 37 | 38 | bool32 ReadSaveRAM(); 39 | bool32 WriteSaveRAM(); 40 | 41 | namespace v3 42 | { 43 | 44 | void SetAchievement(int32 achievementID, int32 achievementDone); 45 | void SetLeaderboard(int32 leaderboardID, int32 score); 46 | inline void LoadAchievementsMenu() {} 47 | inline void LoadLeaderboardsMenu() {} 48 | 49 | } // namespace v3 50 | 51 | namespace v4 52 | { 53 | // Native Functions 54 | void SetAchievement(int32 *achievementID, int32 *status); 55 | void SetLeaderboard(int32 *leaderboardID, int32 *score); 56 | void HapticEffect(int32 *id, int32 *unknown1, int32 *unknown2, int32 *unknown3); 57 | 58 | void NotifyCallback(int32 *callback, int32 *param1, int32 *param2, int32 *param3); 59 | 60 | } // namespace v4 61 | 62 | } // namespace Legacy -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Core/UserPresence.cpp: -------------------------------------------------------------------------------- 1 | #include "RSDK/Core/RetroEngine.hpp" 2 | 3 | // ==================== 4 | // API Cores 5 | // ==================== 6 | 7 | namespace RSDK 8 | { 9 | namespace SKU 10 | { 11 | // Dummy API 12 | #if RETRO_USERCORE_DUMMY 13 | #include "RSDK/User/Dummy/DummyPresence.cpp" 14 | #endif 15 | 16 | // Steam API 17 | #if RETRO_USERCORE_STEAM 18 | #include "RSDK/User/Steam/SteamPresence.cpp" 19 | #endif 20 | 21 | // Epic Games API 22 | #if RETRO_USERCORE_EOS 23 | #include "RSDK/User/EOS/EOSPresence.cpp" 24 | #endif 25 | 26 | // Switch API 27 | #if RETRO_USERCORE_NX 28 | #include "RSDK/User/NX/NXPresence.cpp" 29 | #endif 30 | 31 | } // namespace SKU 32 | } // namespace RSDK 33 | 34 | using namespace RSDK; 35 | 36 | #if RETRO_REV02 37 | SKU::UserRichPresence *RSDK::SKU::richPresence = NULL; 38 | #endif 39 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Core/UserPresence.hpp: -------------------------------------------------------------------------------- 1 | #ifndef USER_PRESENCE_H 2 | #define USER_PRESENCE_H 3 | 4 | namespace RSDK 5 | { 6 | namespace SKU 7 | { 8 | #if RETRO_REV02 9 | 10 | // This is the base struct, it serves as the base for any API-specific stats 11 | // This struct should never be removed 12 | struct UserRichPresence { 13 | virtual ~UserRichPresence() = default; 14 | 15 | virtual void StageLoad() {} 16 | virtual void FrameInit() {} 17 | virtual void OnUnknownEvent() {} 18 | virtual void SetPresence(int32 id, String *message) {} 19 | 20 | int32 curID = 0; 21 | }; 22 | 23 | extern UserRichPresence *richPresence; 24 | 25 | // ==================== 26 | // API Cores 27 | // ==================== 28 | 29 | // Dummy API 30 | #if RETRO_USERCORE_DUMMY 31 | #include "RSDK/User/Dummy/DummyPresence.hpp" 32 | #endif 33 | 34 | // Steam API 35 | #if RETRO_USERCORE_STEAM 36 | #include "RSDK/User/Steam/SteamPresence.hpp" 37 | #endif 38 | 39 | // Epic Games API 40 | #if RETRO_USERCORE_EOS 41 | #include "RSDK/User/EOS/EOSPresence.hpp" 42 | #endif 43 | 44 | // Switch API 45 | #if RETRO_USERCORE_NX 46 | #include "RSDK/User/NX/NXPresence.hpp" 47 | #endif 48 | 49 | inline void SetPresence(int32 id, String *message) { richPresence->SetPresence(id, message); } 50 | #endif 51 | 52 | } // namespace SKU 53 | } // namespace RSDK 54 | 55 | #endif // USER_PRESENCE_H 56 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Core/UserStats.cpp: -------------------------------------------------------------------------------- 1 | #include "RSDK/Core/RetroEngine.hpp" 2 | 3 | #if RETRO_REV02 4 | // ==================== 5 | // API Cores 6 | // ==================== 7 | 8 | namespace RSDK 9 | { 10 | namespace SKU 11 | { 12 | 13 | // Dummy API 14 | #if RETRO_USERCORE_DUMMY 15 | #include "RSDK/User/Dummy/DummyStats.cpp" 16 | #endif 17 | 18 | // Steam API 19 | #if RETRO_USERCORE_STEAM 20 | #include "RSDK/User/Steam/SteamStats.cpp" 21 | #endif 22 | 23 | // Epic Games API 24 | #if RETRO_USERCORE_EOS 25 | #include "RSDK/User/EOS/EOSStats.cpp" 26 | #endif 27 | 28 | // Switch API 29 | #if RETRO_USERCORE_NX 30 | #include "RSDK/User/NX/NXStats.cpp" 31 | #endif 32 | 33 | } // namespace SKU 34 | } // namespace RSDK 35 | #endif 36 | 37 | using namespace RSDK; 38 | 39 | #if RETRO_REV02 40 | SKU::UserStats *RSDK::SKU::stats = NULL; 41 | #endif 42 | 43 | #if !RETRO_REV02 44 | void GetLeaderboardName(char *buffer, int32 zoneID, int32 actID, int32 characterID) 45 | { 46 | const char *characterIDs[] = { "S", "T", "K" }; 47 | const char *zoneIDs[] = { "GHZ", "CPZ", "SPZ", "FBZ", "PGZ", "SSZ", "HCZ", "MSZ", "OOZ", "LRZ", "MMZ", "TMZ" }; 48 | 49 | sprintf(buffer, "%s%d_%s", zoneIDs[zoneID], actID + 1, characterIDs[characterID]); 50 | } 51 | 52 | void RSDK::SKU::TrackActClear(uint8 zoneID, uint8 actID, uint8 characterID, int32 time, int32 rings, int32 score) 53 | { 54 | PrintLog(PRINT_NORMAL, "DUMMY TrackActClear(%d, %d, %d, %d, %d, %d)", zoneID, actID, characterID, time, rings, score); 55 | } 56 | void RSDK::SKU::TrackTAClear(uint8 zoneID, uint8 actID, uint8 characterID, int32 score) 57 | { 58 | char leaderboardName[0x404]; 59 | memset(leaderboardName, 0, 0x400); 60 | 61 | GetLeaderboardName(leaderboardName, zoneID, actID, characterID); 62 | 63 | PrintLog(PRINT_NORMAL, "DUMMY TrackTAClear(%d, %d, %d, %d) -> %s", zoneID, actID, characterID, score, leaderboardName); 64 | } 65 | void RSDK::SKU::TrackEnemyDefeat(uint8 zoneID, uint8 actID, uint8 characterID, int32 entityX, int32 entityY) 66 | { 67 | PrintLog(PRINT_NORMAL, "DUMMY TrackEnemyDefeat(%d, %d, %d, %d, %d)", zoneID, actID, characterID, entityX, entityY); 68 | } 69 | void RSDK::SKU::TrackGameProgress(float percent) { PrintLog(PRINT_NORMAL, "DUMMY TrackGameProgress() -> %f percent complete", percent * 100); } 70 | #endif -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Core/UserStats.hpp: -------------------------------------------------------------------------------- 1 | #ifndef USER_STATS_H 2 | #define USER_STATS_H 3 | 4 | #include 5 | 6 | namespace RSDK 7 | { 8 | namespace SKU 9 | { 10 | 11 | #if RETRO_REV02 12 | struct StatInfo { 13 | uint8 statID; 14 | const char *name; 15 | void *data[64]; 16 | }; 17 | 18 | // This is the base struct, it serves as the base for any API-specific stats 19 | // This struct should never be removed 20 | struct UserStats { 21 | virtual ~UserStats() = default; 22 | 23 | virtual void StageLoad() { enabled = true; } 24 | virtual void FrameInit() {} 25 | virtual void OnUnknownEvent() {} 26 | virtual void TryTrackStat(StatInfo *stat) {} 27 | 28 | bool32 enabled = true; 29 | }; 30 | 31 | extern UserStats *stats; 32 | 33 | // ==================== 34 | // API Cores 35 | // ==================== 36 | 37 | // Dummy API 38 | #if RETRO_USERCORE_DUMMY 39 | #include "RSDK/User/Dummy/DummyStats.hpp" 40 | #endif 41 | 42 | // Steam API 43 | #if RETRO_USERCORE_STEAM 44 | #include "RSDK/User/Steam/SteamStats.hpp" 45 | #endif 46 | 47 | // Epic Games API 48 | #if RETRO_USERCORE_EOS 49 | #include "RSDK/User/EOS/EOSStats.hpp" 50 | #endif 51 | 52 | // Switch API 53 | #if RETRO_USERCORE_NX 54 | #include "RSDK/User/NX/NXStats.hpp" 55 | #endif 56 | 57 | #endif 58 | 59 | // Rev01 ver of TrackStat stuff basically 60 | #if !RETRO_REV02 61 | void TrackActClear(uint8 zoneID, uint8 actID, uint8 characterID, int32 time, int32 rings, int32 score); 62 | void TrackTAClear(uint8 zoneID, uint8 actID, uint8 characterID, int32 time); 63 | void TrackEnemyDefeat(uint8 zoneID, uint8 actID, uint8 characterID, int32 entityX, int32 entityY); 64 | void TrackGameProgress(float percent); 65 | #else 66 | inline void TryTrackStat(StatInfo *stat) { stats->TryTrackStat(stat); } 67 | inline bool32 GetStatsEnabled() { return stats->enabled; } 68 | inline void SetStatsEnabled(bool32 enabled) { stats->enabled = enabled; } 69 | #endif 70 | 71 | } // namespace SKU 72 | } // namespace RSDK 73 | 74 | #endif // USER_STATS_H 75 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Dummy/DummyAchievements.cpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | void DummyAchievements::TryUnlockAchievement(AchievementID *id) 3 | { 4 | if (enabled) { 5 | PrintLog(PRINT_NORMAL, "DUMMY TryUnlockAchievement(%s)", id->identifier); 6 | 7 | int32 i = 0; 8 | for (; i < (int32)achievementList.size(); ++i) { 9 | if (achievementList[i].identifier == id->identifier) { 10 | if (!achievementList[i].achieved) { 11 | achievementStack.push_back(i); 12 | PrintLog(PRINT_NORMAL, "Unlocked Achievement: (%s, %d)", id->identifier, i); 13 | achievementList[i].achieved = true; 14 | SaveUserData(); 15 | } 16 | break; 17 | } 18 | } 19 | 20 | if (i == achievementList.size()) 21 | PrintLog(PRINT_NORMAL, "Failed to Unlock Achievement: (%s)", id->identifier); 22 | } 23 | else { 24 | std::string str = __FILE__; 25 | str += ": TryUnlockAchievement() # Tried to unlock achievement, but achievements are disabled. \r\n"; 26 | PrintLog(PRINT_NORMAL, str.c_str()); 27 | } 28 | } 29 | 30 | void DummyAchievements::SetAchievementNames(String **names, int32 count) 31 | { 32 | if (count <= 0) 33 | return; 34 | 35 | char nameBuffer[0x40]; 36 | GetCString(nameBuffer, names[0]); 37 | achievementText = nameBuffer; 38 | 39 | for (int32 i = 1; i < count && i < (int32)achievementList.size(); ++i) { 40 | GetCString(nameBuffer, names[i]); 41 | achievementList[i].name = nameBuffer; 42 | } 43 | } 44 | 45 | String *DummyAchievements::GetAchievementString(String *string) 46 | { 47 | InitString(string, "Achievement!", 0); 48 | return string; 49 | } 50 | String *DummyAchievements::GetAchievementName(String *name, uint32 id) 51 | { 52 | #if !RETRO_VER_EGS 53 | id--; 54 | #endif 55 | if (id <= achievementList.size()) 56 | InitString(name, achievementList[id].name.c_str(), 0); 57 | return name; 58 | } 59 | 60 | int32 DummyAchievements::GetNextAchievementID() 61 | { 62 | if (achievementStack.size() > 0) 63 | return achievementStack[0] + 1; 64 | else 65 | return 0; 66 | } 67 | 68 | void DummyAchievements::RemoveLastAchievementID() 69 | { 70 | if (achievementStack.size() > 0) 71 | achievementStack.erase(achievementStack.begin()); 72 | } 73 | #endif -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Dummy/DummyAchievements.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #if RETRO_REV02 5 | // This is the "dummy" struct, it serves as the base in the event a suitable API isn't loaded (such as in this decomp) 6 | // This struct should never be removed, other structs such as "SteamAchievements" would be added and "achievements" would be set to that instead 7 | struct DummyAchievements : UserAchievements { 8 | DummyAchievements() {} 9 | 10 | #if RETRO_VER_EGS || RETRO_USE_DUMMY_ACHIEVEMENTS 11 | inline bool32 CheckAchievementsEnabled() { return true; } 12 | void SetAchievementNames(String **names, int32 count); 13 | String *GetAchievementString(String *string); 14 | String *GetAchievementName(String *name, uint32 id); 15 | inline bool32 CheckAchievementPopupEnabled() { return true; } 16 | int32 GetNextAchievementID(); 17 | void RemoveLastAchievementID(); 18 | #endif 19 | void TryUnlockAchievement(AchievementID *id); 20 | }; 21 | #endif 22 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Dummy/DummyCore.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | // This is the "dummy" struct, it serves as the base in the event a suitable API isn't loaded (such as in this decomp) 4 | // This struct should never be removed, other structs such as "SteamUserCore" would be added and "userCore" would be set to that instead 5 | struct DummyCore : UserCore { 6 | DummyCore() 7 | { 8 | // are sonic mania plus features enabled? 9 | values[0] = false; 10 | valueCount = 1; 11 | 12 | #if !RSDK_AUTOBUILD 13 | // enable dlc 14 | for (int32 v = 0; v < valueCount; ++v) values[v] = true; 15 | #endif 16 | } 17 | 18 | void StageLoad(); 19 | bool32 CheckFocusLost(); 20 | int32 GetUserLanguage(); 21 | int32 GetUserRegion(); 22 | int32 GetUserPlatform(); 23 | bool32 GetConfirmButtonFlip(); 24 | void LaunchManual(); 25 | void ExitGame(); 26 | int32 GetDefaultGamepadType(); 27 | bool32 IsOverlayEnabled(uint32 overlay) { return false; } 28 | #if RETRO_VER_EGS 29 | bool32 CanShowExtensionOverlay(int32 overlay) 30 | { 31 | PrintLog(PRINT_POPUP, "Can Show Extension Overlay?: %d", overlay); 32 | return true; 33 | } 34 | bool32 ShowExtensionOverlay(int32 overlay) 35 | { 36 | PrintLog(PRINT_POPUP, "Show Extension Overlay: %d", overlay); 37 | return true; 38 | } 39 | bool32 CanShowAltExtensionOverlay(int32 overlay) 40 | { 41 | PrintLog(PRINT_POPUP, "Can Show Alternate Extension Overlay?: %d", overlay); 42 | return false; 43 | } 44 | bool32 ShowAltExtensionOverlay(int32 overlay) 45 | { 46 | PrintLog(PRINT_POPUP, "Show Alternate Extension Overlay: %d", overlay); 47 | return ShowExtensionOverlay(overlay); 48 | } 49 | int32 GetConnectingStringID() { return -1; } 50 | bool32 ShowLimitedVideoOptions(int32 id) 51 | { 52 | PrintLog(PRINT_POPUP, "Show Limited Video Options?"); 53 | return false; 54 | } 55 | void InitInputDevices() {} 56 | #else 57 | bool32 ShowExtensionOverlay(int32 overlay) 58 | { 59 | switch (overlay) { 60 | default: PrintLog(PRINT_POPUP, "Show Unknown Extension Overlay: %d", overlay); break; 61 | case 0: PrintLog(PRINT_POPUP, "Show Extension Overlay: %d (Plus Upsell Screen)", overlay); break; 62 | } 63 | 64 | return false; 65 | } 66 | #endif 67 | }; 68 | 69 | extern DummyCore *dummyCore; 70 | 71 | DummyCore *InitDummyCore(); 72 | 73 | #endif 74 | 75 | // these are rev02 only but keeping em helps organization 76 | uint32 GetAPIValueID(const char *identifier, int32 charIndex); 77 | int32 GetAPIValue(uint32 id); 78 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Dummy/DummyLeaderboards.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct DummyLeaderboardCallback { 4 | uint8 type; 5 | int32 loadTime; 6 | bool32 isUser; 7 | LeaderboardLoadInfo *info; 8 | int32 trackScore; 9 | int32 trackRank; 10 | void (*trackCB)(bool32 success, int32 rank); 11 | }; 12 | 13 | // This is the "dummy" struct, it serves as the base in the event a suitable API isn't loaded (such as in this decomp) 14 | // This struct should never be removed, other structs such as "SteamLeaderboards" would be added and "leaderboards" would be set to that instead 15 | struct DummyLeaderboards : UserLeaderboards { 16 | void FrameInit() 17 | { 18 | UserLeaderboards::FrameInit(); 19 | 20 | for (int32 i = callbackList.Count() - 1; i >= 0; --i) { 21 | DummyLeaderboardCallback *item = callbackList.At(i); 22 | 23 | if (item) { 24 | if (item->loadTime) { 25 | item->loadTime--; 26 | } 27 | else { 28 | switch (item->type) { 29 | case 0: FinishLeaderboardFetch(item); break; 30 | case 1: FinishLeaderboardLoad(item); break; 31 | case 2: 32 | if (item->trackCB) 33 | item->trackCB(true, item->trackRank); 34 | break; 35 | } 36 | 37 | callbackList.Remove(i); 38 | } 39 | } 40 | } 41 | } 42 | 43 | void FetchLeaderboard(LeaderboardID *leaderboard, bool32 isUser); 44 | void LoadLeaderboards(LeaderboardLoadInfo *info); 45 | void TrackScore(LeaderboardID *leaderboard, int32 score, void (*callback)(bool32 success, int32 rank)); 46 | 47 | void FillLeaderboardEntries(LeaderboardLoadInfo *info); 48 | void FinishLeaderboardFetch(DummyLeaderboardCallback *callback); 49 | void FinishLeaderboardLoad(DummyLeaderboardCallback *callback); 50 | 51 | List callbackList; 52 | }; 53 | #endif 54 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Dummy/DummyPresence.cpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | void DummyRichPresence::SetPresence(int32 id, String *message) 3 | { 4 | char buffer[0xFF]; 5 | GetCString(buffer, message); 6 | if (message->chars[message->length - 1] == '\r') 7 | buffer[message->length - 1] = 0; 8 | 9 | curID = id; 10 | 11 | std::string str = __FILE__; 12 | str += ": SetPresence() # Set Steam rich presence string to "; 13 | str += buffer; 14 | str += "\r\n"; 15 | PrintLog(PRINT_NORMAL, str.c_str()); 16 | } 17 | #endif 18 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Dummy/DummyPresence.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | // This is the "dummy" struct, it serves as the base in the event a suitable API isn't loaded (such as in this decomp) 4 | // This struct should never be removed, other structs such as "SteamRichPresence" would be added and "richPresence" would be set to that instead 5 | struct DummyRichPresence : UserRichPresence { 6 | void SetPresence(int32 id, String *message); 7 | }; 8 | #endif 9 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Dummy/DummyStats.cpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | #define VOID_TO_INT(x) (int32)(size_t)(x) 3 | #define voidToFloat(x) *(float *)&(x) 4 | 5 | void DummyStats::TryTrackStat(StatInfo *stat) 6 | { 7 | if (enabled) { 8 | std::string str = __FILE__; 9 | str += ": TrackStat() # TrackStat "; 10 | str += stat->name; 11 | str += " \r\n"; 12 | PrintLog(PRINT_NORMAL, str.c_str()); 13 | 14 | switch (stat->statID) { 15 | case 0: { 16 | char *zoneName = (char *)stat->data[0]; 17 | char *actName = (char *)stat->data[1]; 18 | char *playerName = (char *)stat->data[2]; 19 | // int32 unused = VOID_TO_INT(stat->data[3]); 20 | int32 time = VOID_TO_INT(stat->data[4]); 21 | int32 rings = VOID_TO_INT(stat->data[5]); 22 | int32 score = VOID_TO_INT(stat->data[6]); 23 | PrintLog(PRINT_NORMAL, "DUMMY TrackActClear(%s, %s, %s, %d, %d, %d)", zoneName, actName, playerName, score, rings, time); 24 | break; 25 | } 26 | 27 | case 1: { 28 | char *zoneName = (char *)stat->data[0]; 29 | char *actName = (char *)stat->data[1]; 30 | char *playerName = (char *)stat->data[2]; 31 | char *mode = (char *)stat->data[3]; 32 | int32 time = VOID_TO_INT(stat->data[4]); 33 | PrintLog(PRINT_NORMAL, "DUMMY TrackTAClear(%s, %s, %s, %s, %d)", zoneName, actName, playerName, mode, time); 34 | break; 35 | } 36 | 37 | case 2: { 38 | char *zoneName = (char *)stat->data[0]; 39 | char *actName = (char *)stat->data[1]; 40 | char *playerName = (char *)stat->data[2]; 41 | bool32 encore = VOID_TO_INT(stat->data[3]); 42 | int32 enemyX = VOID_TO_INT(stat->data[4]); 43 | int32 enemyY = VOID_TO_INT(stat->data[5]); 44 | PrintLog(PRINT_NORMAL, "DUMMY TrackEnemyDefeat(%s, %s, %s, %s, %d, %d)", zoneName, actName, playerName, encore ? "true" : "false", 45 | enemyX, enemyY); 46 | break; 47 | } 48 | case 3: PrintLog(PRINT_NORMAL, "DUMMY TrackGameProgress() -> %f percent complete", voidToFloat(stat->data[0]) * 100); break; 49 | } 50 | } 51 | else { 52 | std::string str = __FILE__; 53 | str += ": TryTrackStat() # Track stat SKIPPED. Stats are disabled. \r\n"; 54 | PrintLog(PRINT_NORMAL, str.c_str()); 55 | } 56 | } 57 | #endif 58 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Dummy/DummyStats.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // This is the "dummy" struct, it serves as the base in the event a suitable API isn't loaded (such as in this decomp) 4 | // This struct should never be removed, other structs such as "SteamStats" would be added and "stats" would be set to that instead 5 | struct DummyStats : UserStats { 6 | void TryTrackStat(StatInfo *stat); 7 | }; 8 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Dummy/DummyStorage.hpp: -------------------------------------------------------------------------------- 1 | 2 | #if RETRO_REV02 3 | 4 | struct DummyFileInfo { 5 | void (*callback)(int32 status); 6 | int32 type; 7 | char path[64]; 8 | void *fileBuffer; 9 | int32 fileSize; 10 | int32 storageTime; 11 | bool32 compressed; 12 | }; 13 | 14 | // This is the "dummy" struct, it serves as the base in the event a suitable API isn't loaded (such as in this decomp) 15 | // This struct should never be removed, other structs such as "SteamUserStorage" would be added and "userStorage" would be set to that instead 16 | struct DummyUserStorage : UserStorage { 17 | void FrameInit() 18 | { 19 | ProcessFileLoadTime(); 20 | 21 | if (authStatus == STATUS_CONTINUE) { 22 | if (authTime <= 0) { 23 | authStatus = GetAPIValue(GetAPIValueID("SYSTEM_USERSTORAGE_AUTH_STATUS", 0)); 24 | } 25 | else { 26 | authTime--; 27 | } 28 | } 29 | 30 | if (storageStatus == STATUS_CONTINUE) { 31 | if (storageInitTime <= 0) { 32 | storageStatus = GetAPIValue(GetAPIValueID("SYSTEM_USERSTORAGE_STORAGE_STATUS", 0)); 33 | } 34 | else { 35 | storageInitTime--; 36 | } 37 | } 38 | 39 | if (!saveStatus) { 40 | if (authStatus == STATUS_ERROR || storageStatus == STATUS_ERROR) 41 | saveStatus = STATUS_ERROR; 42 | else if (storageStatus == STATUS_OK) 43 | saveStatus = STATUS_OK; 44 | } 45 | } 46 | void StageLoad() { UserStorage::StageLoad(); } 47 | int32 TryAuth(); 48 | int32 TryInitStorage(); 49 | bool32 GetUsername(String *name); 50 | bool32 TryLoadUserFile(const char *filename, void *buffer, uint32 size, void (*callback)(int32 status)); 51 | bool32 TrySaveUserFile(const char *filename, void *buffer, uint32 size, void (*callback)(int32 status), bool32 compressed); 52 | bool32 TryDeleteUserFile(const char *filename, void (*callback)(int32 status)); 53 | void ClearPrerollErrors(); 54 | 55 | void ProcessFileLoadTime(); 56 | 57 | int32 authTime = 0; 58 | int32 storageInitTime = 0; 59 | List fileList; 60 | }; 61 | 62 | #endif -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/EOS/EOSAchievements.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/EOS/EOSAchievements.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/EOS/EOSAchievements.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct EOSAchievements : UserAchievements { 4 | bool32 CheckAchievementsEnabled() { return true; } 5 | void SetAchievementNames(String **names, int32 count) 6 | { 7 | // set achievement names 8 | } 9 | String *GetAchievementString(String *string) 10 | { 11 | // get achievement string 12 | return NULL; 13 | } 14 | String *GetAchievementName(String *name, uint32 id) 15 | { 16 | // get achievement name 17 | return NULL; 18 | } 19 | bool32 CheckAchievementPopupEnabled() { return true; } 20 | int32 GetNextAchievementID() 21 | { 22 | // get next achievement from the list 23 | return 0; 24 | } 25 | void RemoveLastAchievementID() 26 | { 27 | // remove achievement from the list 28 | } 29 | void TryUnlockAchievement(AchievementID *id) 30 | { 31 | // unload EGS achievement 32 | } 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/EOS/EOSCore.cpp: -------------------------------------------------------------------------------- 1 | 2 | #if RETRO_REV02 3 | EOSCore *InitEOSCore() 4 | { 5 | // Initalize API subsystems 6 | EOSCore *core = new EOSCore; 7 | 8 | if (achievements) 9 | delete achievements; 10 | achievements = new EOSAchievements; 11 | 12 | if (leaderboards) 13 | delete leaderboards; 14 | leaderboards = new EOSLeaderboards; 15 | 16 | if (richPresence) 17 | delete richPresence; 18 | richPresence = new EOSRichPresence; 19 | 20 | if (stats) 21 | delete stats; 22 | stats = new EOSStats; 23 | 24 | if (userStorage) 25 | delete userStorage; 26 | userStorage = new EOSUserStorage; 27 | 28 | return core; 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/EOS/EOSCore.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct EOSCore : UserCore { 4 | void Shutdown() 5 | { 6 | // closes EGS API 7 | } 8 | bool32 CheckAPIInitialized() 9 | { 10 | // check if EGS is running 11 | return true; 12 | } 13 | void FrameInit() 14 | { 15 | UserCore::StageLoad(); 16 | // runs EGS callbacks 17 | } 18 | int32 GetUserLanguage() 19 | { 20 | // gets the language from EGS 21 | return LANGUAGE_EN; 22 | } 23 | int32 GetUserRegion() { return REGION_US; } 24 | int32 GetUserPlatform() { return PLATFORM_PC; } 25 | bool32 GetConfirmButtonFlip() { return false; } 26 | void LaunchManual() {} 27 | void ExitGame() { RenderDevice::isRunning = false; } 28 | bool32 IsOverlayEnabled(uint32 overlay) { return false; } 29 | 30 | bool32 SetupExtensionOverlay() 31 | { 32 | // show a popup or something? 33 | return true; 34 | } 35 | virtual bool32 CanShowExtensionOverlay(int32 overlay) { return false; } 36 | virtual bool32 ShowExtensionOverlay(int32 overlay) 37 | { 38 | // do some EGS api stuff 39 | return true; 40 | } 41 | virtual bool32 CanShowAltExtensionOverlay(int32 overlay) { return true; } 42 | virtual bool32 ShowAltExtensionOverlay(int32 overlay) 43 | { 44 | // show the user: https://store.epicgames.com/en-US/p/sonic-mania--encore-dlc 45 | return true; 46 | } 47 | int32 GetConnectingStringID() 48 | { 49 | return 68; // STR_CONNECTEGS 50 | } 51 | virtual bool32 ShowLimitedVideoOptions(int32 id) { return false; } 52 | void InitInputDevices() { RSDK::InitInputDevices(); } 53 | }; 54 | 55 | EOSCore *InitEOSCore(); 56 | #endif 57 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/EOS/EOSLeaderboards.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/EOS/EOSLeaderboards.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/EOS/EOSLeaderboards.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct EOSLeaderboards : UserLeaderboards { 4 | }; 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/EOS/EOSPresence.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/EOS/EOSPresence.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/EOS/EOSPresence.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct EOSRichPresence : UserRichPresence { 4 | void SetPresence(int32 id, String *message) 5 | { 6 | // set EGS rich presence 7 | } 8 | }; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/EOS/EOSStats.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/EOS/EOSStats.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/EOS/EOSStats.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct EOSStats : UserStats { 4 | }; 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/EOS/EOSStorage.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/EOS/EOSStorage.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/EOS/EOSStorage.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | struct EOSUserStorage : UserStorage { 3 | int32 TryAuth() 4 | { 5 | // init EGS authorization 6 | authStatus = STATUS_OK; 7 | return authStatus; 8 | } 9 | int32 TryInitStorage() 10 | { 11 | // init EGS storage 12 | storageStatus = STATUS_OK; 13 | return storageStatus; 14 | } 15 | bool32 GetUsername(String *userName) 16 | { 17 | // get EGS username 18 | return false; 19 | } 20 | bool32 TryLoadUserFile(const char *filename, void *buffer, uint32 size, void (*callback)(int32 status)) 21 | { 22 | // load file from EGS cloud 23 | return false; 24 | } 25 | bool32 TrySaveUserFile(const char *filename, void *buffer, uint32 size, void (*callback)(int32 status), bool32 compressed) 26 | { 27 | // save file to EGS cloud 28 | return false; 29 | } 30 | bool32 TryDeleteUserFile(const char *filename, void (*callback)(int32 status)) 31 | { 32 | // delete file from EGS cloud 33 | return false; 34 | } 35 | void ClearPrerollErrors() {} 36 | }; 37 | 38 | #endif -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/NX/NXAchievements.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/NX/NXAchievements.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/NX/NXAchievements.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct NXAchievements : UserAchievements { 4 | // Switch doesn't support achievements 5 | }; 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/NX/NXCore.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct NXCore : UserCore { 4 | void FrameInit(); 5 | bool32 CheckAPIInitialized() { return true; } 6 | bool32 CheckFocusLost() { return focusState != AppletFocusState_InFocus; } 7 | bool32 CheckEnginePause() { return false; } 8 | int32 GetUserLanguage() 9 | { 10 | printf("desiredLanguage: %s\n", "en"); 11 | // get system language 12 | return LANGUAGE_EN; 13 | } 14 | int32 GetUserRegion() { return REGION_US; } 15 | int32 GetUserPlatform() { return PLATFORM_SWITCH; } 16 | bool32 GetConfirmButtonFlip() { return true; } 17 | void LaunchManual() 18 | { 19 | const char *manualURL = ""; 20 | switch (curSKU.language) { 21 | default: 22 | case LANGUAGE_EN: manualURL = "https://www.sonicthehedgehog.com/mania/manual/en/"; break; 23 | case LANGUAGE_FR: manualURL = "https://www.sonicthehedgehog.com/mania/manual/fr/"; break; 24 | case LANGUAGE_IT: manualURL = "https://www.sonicthehedgehog.com/mania/manual/it/"; break; 25 | case LANGUAGE_GE: manualURL = "https://www.sonicthehedgehog.com/mania/manual/de/"; break; 26 | case LANGUAGE_SP: manualURL = "https://www.sonicthehedgehog.com/mania/manual/es/"; break; 27 | case LANGUAGE_JP: manualURL = "https://manual.sega.jp/sonicmania/"; break; 28 | case LANGUAGE_KO: manualURL = "https://manual.sega.jp/sonicmania/kr/"; break; 29 | case LANGUAGE_SC: manualURL = "https://manual.sega.jp/sonicmania/ct/"; break; 30 | case LANGUAGE_TC: manualURL = "https://www.sonicthehedgehog.com/mania/manual/en/"; break; 31 | } 32 | 33 | // open manualURL 34 | } 35 | int32 GetDefaultGamepadType() { return (DEVICE_API_NONE << 16) | (DEVICE_TYPE_CONTROLLER << 8) | (DEVICE_SWITCH_PRO << 0); } 36 | bool32 IsOverlayEnabled(uint32 deviceID) { return false; } 37 | bool32 CheckDLC(uint8 id) 38 | { 39 | // check we have the DLC 40 | return false; 41 | } 42 | bool32 ShowExtensionOverlay(uint8 overlay) 43 | { 44 | // open plus DLC page 45 | return true; 46 | } 47 | }; 48 | 49 | NXCore *InitNXCore(); 50 | #endif 51 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/NX/NXLeaderboards.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/NX/NXLeaderboards.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/NX/NXLeaderboards.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct NXLeaderboards : UserLeaderboards { 4 | }; 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/NX/NXPresence.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/NX/NXPresence.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/NX/NXPresence.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct NXRichPresence : UserRichPresence { 4 | void SetPresence(int32 id, String *message) 5 | { 6 | // set switch rich presence 7 | } 8 | }; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/NX/NXStats.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/NX/NXStats.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/NX/NXStats.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | struct NXStats : UserStats { 3 | inline void TryTrackStat(StatInfo *stat) 4 | { 5 | // switch has no stats 6 | } 7 | }; 8 | #endif 9 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/NX/NXStorage.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/NX/NXStorage.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/NX/NXStorage.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | struct NXUserStorage : UserStorage { 3 | int32 TryAuth() 4 | { 5 | authStatus = STATUS_OK; 6 | return authStatus; 7 | } 8 | int32 TryInitStorage() 9 | { 10 | // init switch save dir 11 | return 0; 12 | } 13 | bool32 GetUsername(String *userName) 14 | { 15 | // get switch nickname 16 | return false; 17 | } 18 | bool32 TryLoadUserFile(const char *filename, void *buffer, uint32 size, void (*callback)(int32 status)) 19 | { 20 | // load from switch save dir 21 | return false; 22 | } 23 | bool32 TrySaveUserFile(const char *filename, void *buffer, uint32 size, void (*callback)(int32 status), bool32 compressed) 24 | { 25 | // save to switch save dir 26 | return false; 27 | } 28 | bool32 TryDeleteUserFile(const char *filename, void (*callback)(int32 status)) 29 | { 30 | // delete from switch save dir 31 | return false; 32 | } 33 | void ClearPrerollErrors() 34 | { 35 | if (storageStatus != STATUS_OK) 36 | storageStatus = STATUS_NONE; 37 | } 38 | }; 39 | 40 | #endif -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Steam/SteamAchievements.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/Steam/SteamAchievements.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Steam/SteamAchievements.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct SteamAchievements : UserAchievements { 4 | void TryUnlockAchievement(AchievementID *id) 5 | { 6 | if (id) { 7 | // try unlock a steam achievement 8 | } 9 | } 10 | }; 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Steam/SteamCore.cpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | SKU::SteamCore *InitSteamCore() 3 | { 4 | // Initalize API subsystems 5 | SteamCore *core = new SteamCore; 6 | 7 | if (achievements) 8 | delete achievements; 9 | achievements = new SteamAchievements; 10 | 11 | if (leaderboards) 12 | delete leaderboards; 13 | leaderboards = new SteamLeaderboards; 14 | 15 | if (richPresence) 16 | delete richPresence; 17 | richPresence = new SteamRichPresence; 18 | 19 | if (stats) 20 | delete stats; 21 | stats = new SteamStats; 22 | 23 | if (userStorage) 24 | delete userStorage; 25 | userStorage = new SteamUserStorage; 26 | 27 | core->initialized = true; 28 | 29 | return core; 30 | } 31 | #endif 32 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Steam/SteamCore.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct SteamCore : UserCore { 4 | void Shutdown() 5 | { 6 | // closes steam API 7 | } 8 | bool32 CheckAPIInitialized() 9 | { 10 | // check if steam is running 11 | return true; 12 | } 13 | bool32 CheckFocusLost() 14 | { 15 | // return field_38; 16 | return false; 17 | } 18 | void FrameInit() 19 | { 20 | UserCore::StageLoad(); 21 | // SteamAPI_RunCallbacks() 22 | } 23 | int32 GetUserLanguage() 24 | { 25 | // gets the language from steam 26 | return LANGUAGE_EN; 27 | } 28 | int32 GetUserRegion() { return REGION_US; } 29 | int32 GetUserPlatform() { return PLATFORM_PC; } 30 | bool32 GetConfirmButtonFlip() { return false; } 31 | void LaunchManual() {} 32 | void ExitGame() { RenderDevice::isRunning = false; } 33 | bool32 IsOverlayEnabled(uint32 overlay) 34 | { 35 | for (int32 i = 0; i < inputDeviceCount; ++i) { 36 | if (inputDeviceList[i] && inputDeviceList[i]->id == overlay) { 37 | if (((inputDeviceList[i]->gamepadType >> 16) & 0xFF) != DEVICE_API_STEAM) 38 | return false; 39 | 40 | return false; // not implemented, sorry! 41 | } 42 | } 43 | 44 | return false; 45 | } 46 | bool32 ShowExtensionOverlay(uint8 overlay) 47 | { 48 | // show steam overlay 49 | return true; 50 | } 51 | 52 | bool32 initialized = false; 53 | }; 54 | 55 | SteamCore *InitSteamCore(); 56 | #endif 57 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Steam/SteamLeaderboards.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/Steam/SteamLeaderboards.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Steam/SteamLeaderboards.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct SteamLeaderboards : UserLeaderboards { 4 | void FetchLeaderboard(LeaderboardID *leaderboard, bool32 isUser) 5 | { 6 | // fetch leaderboards from steam 7 | } 8 | void LoadLeaderboards() 9 | { 10 | // do a thing 11 | } 12 | void TrackScore(LeaderboardID *leaderboard, int32 score, void (*callback)(bool32 success, int32 rank)) 13 | { 14 | // set leaderboard on steam 15 | } 16 | int32 GetStatus() { return status; } 17 | }; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Steam/SteamPresence.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/Steam/SteamPresence.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Steam/SteamPresence.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct SteamRichPresence : UserRichPresence { 4 | void SetPresence(int32 id, String *message) 5 | { 6 | // set steam rich presence 7 | } 8 | }; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Steam/SteamStats.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/Steam/SteamStats.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Steam/SteamStats.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | 3 | struct SteamStats : UserStats { 4 | inline void TryTrackStat(StatInfo *stat) 5 | { 6 | // steam has no stats 7 | } 8 | }; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Steam/SteamStorage.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDK/User/Steam/SteamStorage.cpp -------------------------------------------------------------------------------- /RSDKv5/RSDK/User/Steam/SteamStorage.hpp: -------------------------------------------------------------------------------- 1 | #if RETRO_REV02 2 | struct SteamUserStorage : UserStorage { 3 | int32 TryAuth() 4 | { 5 | authStatus = STATUS_OK; 6 | return authStatus; 7 | } 8 | int32 TryInitStorage() 9 | { 10 | storageStatus = STATUS_OK; 11 | return storageStatus; 12 | } 13 | bool32 GetUsername(String *userName) { return false; } 14 | bool32 TryLoadUserFile(const char *filename, void *buffer, uint32 size, void (*callback)(int32 status)) 15 | { 16 | // load file from steam cloud 17 | return false; 18 | } 19 | bool32 TrySaveUserFile(const char *filename, void *buffer, uint32 size, void (*callback)(int32 status), bool32 compressed) 20 | { 21 | // save file to steam cloud 22 | return false; 23 | } 24 | bool32 TryDeleteUserFile(const char *filename, void (*callback)(int32 status)) 25 | { 26 | // delete file from steam cloud 27 | return false; 28 | } 29 | void ClearPrerollErrors() {} 30 | }; 31 | 32 | #endif -------------------------------------------------------------------------------- /RSDKv5/RSDKv5.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/RSDKv5.ico -------------------------------------------------------------------------------- /RSDKv5/Shaders/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !DX9 3 | !DX11 4 | !OGL 5 | !Vulkan -------------------------------------------------------------------------------- /RSDKv5/Shaders/DX11/Clean.hlsl: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | 5 | cbuffer RSDKBuffer : register(b0) 6 | { 7 | float2 pixelSize; // internal game resolution (usually 424x240 or smth) 8 | float2 textureSize; // size of the internal framebuffer texture 9 | float2 viewSize; // window viewport size 10 | 11 | #if defined(RETRO_REV02) // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 12 | float2 screenDim; // screen dimming percent 13 | #endif 14 | }; 15 | 16 | Texture2D texDiffuse : register(t0); // screen display texture 17 | SamplerState sampDiffuse : register(s0); // screen display sampler 18 | 19 | 20 | // ======================= 21 | // STRUCTS 22 | // ======================= 23 | 24 | struct VertexInput 25 | { 26 | float3 pos : SV_POSITION; 27 | float2 tex : TEXCOORD; 28 | }; 29 | 30 | struct VertexOutput 31 | { 32 | float4 pos : SV_POSITION; 33 | float4 tex : TEXCOORD; 34 | }; 35 | 36 | struct PixelInput 37 | { 38 | float4 pos : SV_POSITION; 39 | float2 tex : TEXCOORD; 40 | }; 41 | 42 | // ======================= 43 | // ENTRY POINTS 44 | // ======================= 45 | 46 | VertexOutput VSMain(VertexInput input) 47 | { 48 | VertexOutput output; 49 | 50 | output.pos = float4(input.pos.xyz, 1.0); 51 | output.tex = float4(input.tex.xy, 0.0, 0.0); 52 | 53 | return output; 54 | } 55 | 56 | float4 PSMain(PixelInput input) : SV_TARGET 57 | { 58 | // Adapted from https://github.com/rsn8887/Sharp-Bilinear-Shaders/releases, used in RetroArch 59 | 60 | float2 texel = input.tex.xy * float4(textureSize, 1.0 / textureSize).xy; 61 | 62 | float2 texelFloored = floor(texel); 63 | float2 s = frac(texel); 64 | float2 regionRange = 0.5 - 0.5 / 2.0; 65 | 66 | float2 centerDist = s - 0.5; 67 | float2 f = (centerDist - clamp(centerDist, -regionRange, regionRange)) * 2.0 + 0.5; 68 | 69 | float2 modTexel = texelFloored + f; 70 | 71 | float4 outColor = texDiffuse.Sample(sampDiffuse, modTexel / textureSize.xy); 72 | #if defined(RETRO_REV02) 73 | outColor *= screenDim.x; 74 | #endif 75 | return outColor; 76 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/DX11/RGB-Image.hlsl: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | 5 | cbuffer RSDKBuffer : register(b0) 6 | { 7 | float2 pixelSize; // internal game resolution (usually 424x240 or smth) 8 | float2 textureSize; // size of the internal framebuffer texture 9 | float2 viewSize; // window viewport size 10 | 11 | #if defined(RETRO_REV02) // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 12 | float2 screenDim; // screen dimming percent 13 | #endif 14 | }; 15 | 16 | Texture2D texDiffuse : register(t0); // screen display texture 17 | SamplerState sampDiffuse : register(s0); // screen display sampler 18 | 19 | 20 | // ======================= 21 | // STRUCTS 22 | // ======================= 23 | 24 | struct VertexInput 25 | { 26 | float3 pos : SV_POSITION; 27 | float2 tex : TEXCOORD; 28 | }; 29 | 30 | struct VertexOutput 31 | { 32 | float4 pos : SV_POSITION; 33 | float4 tex : TEXCOORD; 34 | }; 35 | 36 | struct PixelInput 37 | { 38 | float4 pos : SV_POSITION; 39 | float2 tex : TEXCOORD; 40 | }; 41 | 42 | // ======================= 43 | // ENTRY POINTS 44 | // ======================= 45 | 46 | VertexOutput VSMain(VertexInput input) 47 | { 48 | VertexOutput output; 49 | 50 | output.pos = float4(input.pos.xyz, 1.0); 51 | output.tex = float4(input.tex.xy, 0.0, 0.0); 52 | 53 | return output; 54 | } 55 | 56 | float4 PSMain(PixelInput input) : SV_TARGET 57 | { 58 | float4 outColor = texDiffuse.Sample(sampDiffuse, input.tex.xy); 59 | #if defined(RETRO_REV02) 60 | outColor *= screenDim.x; 61 | #endif 62 | return outColor; 63 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/DX11/YUV-420.hlsl: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | 5 | cbuffer RSDKBuffer : register(b0) 6 | { 7 | float2 pixelSize; // internal game resolution (usually 424x240 or smth) 8 | float2 textureSize; // size of the internal framebuffer texture 9 | float2 viewSize; // window viewport size 10 | 11 | #if defined(RETRO_REV02) // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 12 | float2 screenDim; // screen dimming percent 13 | #endif 14 | }; 15 | 16 | Texture2D texDiffuse : register(t0); // screen display texture 17 | SamplerState sampDiffuse : register(s0); // screen display sampler 18 | 19 | 20 | // ======================= 21 | // STRUCTS 22 | // ======================= 23 | 24 | struct VertexInput 25 | { 26 | float3 pos : SV_POSITION; 27 | float2 tex : TEXCOORD; 28 | }; 29 | 30 | struct VertexOutput 31 | { 32 | float4 pos : SV_POSITION; 33 | float4 tex : TEXCOORD; 34 | }; 35 | 36 | struct PixelInput 37 | { 38 | float4 pos : SV_POSITION; 39 | float2 tex : TEXCOORD; 40 | }; 41 | 42 | // ======================= 43 | // ENTRY POINTS 44 | // ======================= 45 | 46 | VertexOutput VSMain(VertexInput input) 47 | { 48 | VertexOutput output; 49 | 50 | output.pos = float4(input.pos.xyz, 1.0); 51 | output.tex = float4(input.tex.xy, 0.0, 0.0); 52 | 53 | return output; 54 | } 55 | 56 | float4 PSMain(PixelInput input) : SV_TARGET 57 | { 58 | float4 outColor; 59 | 60 | float3 yuv; 61 | yuv.r = texDiffuse.Sample(sampDiffuse, input.tex.xy).r; 62 | yuv.gb = texDiffuse.Sample(sampDiffuse, clamp(input.tex.xy / 2.0, 0, 0.499)).gb; 63 | yuv -= float3(16.0 / 256, 0.5, 0.5); 64 | 65 | outColor.r = 1.164 * yuv.r + 1.596 * yuv.b; 66 | outColor.g = 1.164 * yuv.r - 0.392 * yuv.g - 0.813 * yuv.b; 67 | outColor.b = 1.164 * yuv.r + 2.017 * yuv.g; 68 | outColor.a = 1.0; 69 | 70 | #if defined(RETRO_REV02) 71 | outColor *= screenDim.x; 72 | #endif 73 | return outColor; 74 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/DX11/YUV-422.hlsl: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | 5 | cbuffer RSDKBuffer : register(b0) 6 | { 7 | float2 pixelSize; // internal game resolution (usually 424x240 or smth) 8 | float2 textureSize; // size of the internal framebuffer texture 9 | float2 viewSize; // window viewport size 10 | 11 | #if defined(RETRO_REV02) // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 12 | float2 screenDim; // screen dimming percent 13 | #endif 14 | }; 15 | 16 | Texture2D texDiffuse : register(t0); // screen display texture 17 | SamplerState sampDiffuse : register(s0); // screen display sampler 18 | 19 | 20 | // ======================= 21 | // STRUCTS 22 | // ======================= 23 | 24 | struct VertexInput 25 | { 26 | float3 pos : SV_POSITION; 27 | float2 tex : TEXCOORD; 28 | }; 29 | 30 | struct VertexOutput 31 | { 32 | float4 pos : SV_POSITION; 33 | float4 tex : TEXCOORD; 34 | }; 35 | 36 | struct PixelInput 37 | { 38 | float4 pos : SV_POSITION; 39 | float2 tex : TEXCOORD; 40 | }; 41 | 42 | // ======================= 43 | // ENTRY POINTS 44 | // ======================= 45 | 46 | VertexOutput VSMain(VertexInput input) 47 | { 48 | VertexOutput output; 49 | 50 | output.pos = float4(input.pos.xyz, 1.0); 51 | output.tex = float4(input.tex.xy, 0.0, 0.0); 52 | 53 | return output; 54 | } 55 | 56 | float4 PSMain(PixelInput input) : SV_TARGET 57 | { 58 | float4 outColor; 59 | 60 | float3 yuv; 61 | yuv.r = texDiffuse.Sample(sampDiffuse, input.tex.xy).r; 62 | yuv.gb = texDiffuse.Sample(sampDiffuse, float2(clamp(input.tex.x / 2.0, 0, 0.499), input.tex.y)).gb; 63 | yuv -= float3(16.0 / 256, 0.5, 0.5); 64 | 65 | outColor.r = 1.164 * yuv.r + 1.596 * yuv.b; 66 | outColor.g = 1.164 * yuv.r - 0.392 * yuv.g - 0.813 * yuv.b; 67 | outColor.b = 1.164 * yuv.r + 2.017 * yuv.g; 68 | outColor.a = 1.0; 69 | 70 | #if defined(RETRO_REV02) 71 | outColor *= screenDim.x; 72 | #endif 73 | return outColor; 74 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/DX11/YUV-444.hlsl: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | 5 | cbuffer RSDKBuffer : register(b0) 6 | { 7 | float2 pixelSize; // internal game resolution (usually 424x240 or smth) 8 | float2 textureSize; // size of the internal framebuffer texture 9 | float2 viewSize; // window viewport size 10 | 11 | #if defined(RETRO_REV02) // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 12 | float2 screenDim; // screen dimming percent 13 | #endif 14 | }; 15 | 16 | Texture2D texDiffuse : register(t0); // screen display texture 17 | SamplerState sampDiffuse : register(s0); // screen display sampler 18 | 19 | 20 | // ======================= 21 | // STRUCTS 22 | // ======================= 23 | 24 | struct VertexInput 25 | { 26 | float3 pos : SV_POSITION; 27 | float2 tex : TEXCOORD; 28 | }; 29 | 30 | struct VertexOutput 31 | { 32 | float4 pos : SV_POSITION; 33 | float4 tex : TEXCOORD; 34 | }; 35 | 36 | struct PixelInput 37 | { 38 | float4 pos : SV_POSITION; 39 | float2 tex : TEXCOORD; 40 | }; 41 | 42 | // ======================= 43 | // ENTRY POINTS 44 | // ======================= 45 | 46 | VertexOutput VSMain(VertexInput input) 47 | { 48 | VertexOutput output; 49 | 50 | output.pos = float4(input.pos.xyz, 1.0); 51 | output.tex = float4(input.tex.xy, 0.0, 0.0); 52 | 53 | return output; 54 | } 55 | 56 | float4 PSMain(PixelInput input) : SV_TARGET 57 | { 58 | float3 yuv = texDiffuse.Sample(sampDiffuse, input.tex.xy).rgb - float3(16.0 / 256, 0.5, 0.5); 59 | 60 | float4 outColor; 61 | outColor.r = 1.164 * yuv.r + 1.596 * yuv.b; 62 | outColor.g = 1.164 * yuv.r - 0.392 * yuv.g - 0.813 * yuv.b; 63 | outColor.b = 1.164 * yuv.r + 2.017 * yuv.g; 64 | outColor.a = 1.0; 65 | 66 | #if defined(RETRO_REV02) 67 | outColor *= screenDim.x; 68 | #endif 69 | return outColor; 70 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/DX9/Clean.hlsl: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | 5 | SamplerState texDiffuse: register(s0); // screen display texture 6 | 7 | float2 pixelSize: register(c0); // internal game resolution (usually 424x240 or smth) 8 | float2 textureSize: register(c1); // size of the internal framebuffer texture 9 | float2 viewSize: register(c2); // window viewport size 10 | 11 | #if defined(RETRO_REV02) // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 12 | float2 screenDim: register(c3); // screen dimming percent 13 | #endif 14 | 15 | 16 | // ======================= 17 | // STRUCTS 18 | // ======================= 19 | 20 | struct VertexInput 21 | { 22 | float4 pos : SV_POSITION; 23 | float4 color : COLOR; 24 | float4 tex : TEXCOORD; 25 | }; 26 | 27 | struct VertexOutput 28 | { 29 | float4 pos : SV_POSITION; 30 | float4 color : COLOR; 31 | float4 tex : TEXCOORD; 32 | }; 33 | 34 | struct PixelInput 35 | { 36 | float2 tex : TEXCOORD; 37 | }; 38 | 39 | // ======================= 40 | // ENTRY POINTS 41 | // ======================= 42 | 43 | VertexOutput VSMain(VertexInput input) 44 | { 45 | VertexOutput output; 46 | 47 | output.pos = input.pos; 48 | output.color = input.color; 49 | output.tex = input.tex; 50 | 51 | return output; 52 | } 53 | 54 | float4 PSMain(PixelInput input) : SV_TARGET 55 | { 56 | // Adapted from https://github.com/rsn8887/Sharp-Bilinear-Shaders/releases, used in RetroArch 57 | 58 | float2 texel = input.tex.xy * float4(textureSize, 1.0 / textureSize).xy; 59 | 60 | float2 texelFloored = floor(texel); 61 | float2 s = frac(texel); 62 | float2 regionRange = 0.5 - 0.5 / 2.0; 63 | 64 | float2 centerDist = s - 0.5; 65 | float2 f = (centerDist - clamp(centerDist, -regionRange, regionRange)) * 2.0 + 0.5; 66 | 67 | float2 modTexel = texelFloored + f; 68 | 69 | float4 outColor = tex2D(texDiffuse, modTexel / textureSize.xy); 70 | #if defined(RETRO_REV02) 71 | outColor *= screenDim.x; 72 | #endif 73 | return outColor; 74 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/DX9/RGB-Image.hlsl: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | 5 | SamplerState texDiffuse: register(s0); // screen display texture 6 | 7 | float2 pixelSize: register(c0); // internal game resolution (usually 424x240 or smth) 8 | float2 textureSize: register(c1); // size of the internal framebuffer texture 9 | float2 viewSize: register(c2); // window viewport size 10 | 11 | #if defined(RETRO_REV02) // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 12 | float2 screenDim: register(c3); // screen dimming percent 13 | #endif 14 | 15 | 16 | // ======================= 17 | // STRUCTS 18 | // ======================= 19 | 20 | struct VertexInput 21 | { 22 | float4 pos : SV_POSITION; 23 | float4 color : COLOR; 24 | float4 tex : TEXCOORD; 25 | }; 26 | 27 | struct VertexOutput 28 | { 29 | float4 pos : SV_POSITION; 30 | float4 color : COLOR; 31 | float4 tex : TEXCOORD; 32 | }; 33 | 34 | struct PixelInput 35 | { 36 | float2 tex : TEXCOORD; 37 | }; 38 | 39 | // ======================= 40 | // ENTRY POINTS 41 | // ======================= 42 | 43 | VertexOutput VSMain(VertexInput input) 44 | { 45 | VertexOutput output; 46 | 47 | output.pos = input.pos; 48 | output.color = input.color; 49 | output.tex = input.tex; 50 | 51 | return output; 52 | } 53 | 54 | float4 PSMain(PixelInput input) : SV_TARGET 55 | { 56 | float4 outColor = tex2D(texDiffuse, input.tex.xy); 57 | #if defined(RETRO_REV02) 58 | outColor *= screenDim.x; 59 | #endif 60 | return outColor; 61 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/DX9/YUV-420.hlsl: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | 5 | SamplerState texDiffuse: register(s0); // screen display texture 6 | 7 | float2 pixelSize: register(c0); // internal game resolution (usually 424x240 or smth) 8 | float2 textureSize: register(c1); // size of the internal framebuffer texture 9 | float2 viewSize: register(c2); // window viewport size 10 | 11 | #if defined(RETRO_REV02) // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 12 | float2 screenDim: register(c3); // screen dimming percent 13 | #endif 14 | 15 | 16 | // ======================= 17 | // STRUCTS 18 | // ======================= 19 | 20 | struct VertexInput 21 | { 22 | float4 pos : SV_POSITION; 23 | float4 color : COLOR; 24 | float4 tex : TEXCOORD; 25 | }; 26 | 27 | struct VertexOutput 28 | { 29 | float4 pos : SV_POSITION; 30 | float4 color : COLOR; 31 | float4 tex : TEXCOORD; 32 | }; 33 | 34 | struct PixelInput 35 | { 36 | float2 tex : TEXCOORD; 37 | }; 38 | 39 | // ======================= 40 | // ENTRY POINTS 41 | // ======================= 42 | 43 | VertexOutput VSMain(VertexInput input) 44 | { 45 | VertexOutput output; 46 | 47 | output.pos = input.pos; 48 | output.color = input.color; 49 | output.tex = input.tex; 50 | 51 | return output; 52 | } 53 | 54 | float4 PSMain(PixelInput input) : SV_TARGET 55 | { 56 | float4 outColor; 57 | 58 | float3 yuv; 59 | yuv.r = tex2D(texDiffuse, input.tex.xy).r; 60 | yuv.gb = tex2D(texDiffuse, clamp(input.tex.xy / 2.0, 0, 0.499)).gb; 61 | yuv -= float3(16.0 / 256, 0.5, 0.5); 62 | 63 | outColor.r = 1.164 * yuv.r + 1.596 * yuv.b; 64 | outColor.g = 1.164 * yuv.r - 0.392 * yuv.g - 0.813 * yuv.b; 65 | outColor.b = 1.164 * yuv.r + 2.017 * yuv.g; 66 | outColor.a = 1.0; 67 | 68 | #if defined(RETRO_REV02) 69 | outColor *= screenDim.x; 70 | #endif 71 | return outColor; 72 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/DX9/YUV-422.hlsl: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | 5 | SamplerState texDiffuse: register(s0); // screen display texture 6 | 7 | float2 pixelSize: register(c0); // internal game resolution (usually 424x240 or smth) 8 | float2 textureSize: register(c1); // size of the internal framebuffer texture 9 | float2 viewSize: register(c2); // window viewport size 10 | 11 | #if defined(RETRO_REV02) // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 12 | float2 screenDim: register(c3); // screen dimming percent 13 | #endif 14 | 15 | 16 | // ======================= 17 | // STRUCTS 18 | // ======================= 19 | 20 | struct VertexInput 21 | { 22 | float4 pos : SV_POSITION; 23 | float4 color : COLOR; 24 | float4 tex : TEXCOORD; 25 | }; 26 | 27 | struct VertexOutput 28 | { 29 | float4 pos : SV_POSITION; 30 | float4 color : COLOR; 31 | float4 tex : TEXCOORD; 32 | }; 33 | 34 | struct PixelInput 35 | { 36 | float2 tex : TEXCOORD; 37 | }; 38 | 39 | // ======================= 40 | // ENTRY POINTS 41 | // ======================= 42 | 43 | VertexOutput VSMain(VertexInput input) 44 | { 45 | VertexOutput output; 46 | 47 | output.pos = input.pos; 48 | output.color = input.color; 49 | output.tex = input.tex; 50 | 51 | return output; 52 | } 53 | 54 | float4 PSMain(PixelInput input) : SV_TARGET 55 | { 56 | float4 outColor; 57 | 58 | float3 yuv; 59 | yuv.r = tex2D(texDiffuse, input.tex.xy).r; 60 | yuv.gb = tex2D(texDiffuse, float2(clamp(input.tex.x / 2.0, 0, 0.499), input.tex.y)).gb; 61 | yuv -= float3(16.0 / 256, 0.5, 0.5); 62 | 63 | outColor.r = 1.164 * yuv.r + 1.596 * yuv.b; 64 | outColor.g = 1.164 * yuv.r - 0.392 * yuv.g - 0.813 * yuv.b; 65 | outColor.b = 1.164 * yuv.r + 2.017 * yuv.g; 66 | outColor.a = 1.0; 67 | 68 | #if defined(RETRO_REV02) 69 | outColor *= screenDim.x; 70 | #endif 71 | return outColor; 72 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/DX9/YUV-444.hlsl: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | 5 | SamplerState texDiffuse: register(s0); // screen display texture 6 | 7 | float2 pixelSize: register(c0); // internal game resolution (usually 424x240 or smth) 8 | float2 textureSize: register(c1); // size of the internal framebuffer texture 9 | float2 viewSize: register(c2); // window viewport size 10 | 11 | #if defined(RETRO_REV02) // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 12 | float2 screenDim: register(c3); // screen dimming percent 13 | #endif 14 | 15 | 16 | // ======================= 17 | // STRUCTS 18 | // ======================= 19 | 20 | struct VertexInput 21 | { 22 | float4 pos : SV_POSITION; 23 | float4 color : COLOR; 24 | float4 tex : TEXCOORD; 25 | }; 26 | 27 | struct VertexOutput 28 | { 29 | float4 pos : SV_POSITION; 30 | float4 color : COLOR; 31 | float4 tex : TEXCOORD; 32 | }; 33 | 34 | struct PixelInput 35 | { 36 | float2 tex : TEXCOORD; 37 | }; 38 | 39 | // ======================= 40 | // ENTRY POINTS 41 | // ======================= 42 | 43 | VertexOutput VSMain(VertexInput input) 44 | { 45 | VertexOutput output; 46 | 47 | output.pos = input.pos; 48 | output.color = input.color; 49 | output.tex = input.tex; 50 | 51 | return output; 52 | } 53 | 54 | float4 PSMain(PixelInput input) : SV_TARGET 55 | { 56 | float3 yuv = tex2D(texDiffuse, input.tex.xy).rgb - float3(16.0 / 256, 0.5, 0.5); 57 | 58 | float4 outColor; 59 | outColor.r = 1.164 * yuv.r + 1.596 * yuv.b; 60 | outColor.g = 1.164 * yuv.r - 0.392 * yuv.g - 0.813 * yuv.b; 61 | outColor.b = 1.164 * yuv.r + 2.017 * yuv.g; 62 | outColor.a = 1.0; 63 | 64 | #if defined(RETRO_REV02) 65 | outColor *= screenDim.x; 66 | #endif 67 | return outColor; 68 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/OGL/CRT-Yeetron.fs: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | in_F vec2 ex_UV; 5 | in_F vec4 ex_color; 6 | 7 | uniform sampler2D texDiffuse; // screen display texture 8 | 9 | uniform vec2 pixelSize; // internal game resolution (usually 424x240 or smth) 10 | uniform vec2 textureSize; // size of the internal framebuffer texture 11 | uniform vec2 viewSize; // window viewport size 12 | #if RETRO_REV02 // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 13 | uniform float screenDim; // screen dimming percent 14 | #endif 15 | 16 | 17 | // ======================= 18 | // DEFINITIONS 19 | // ======================= 20 | #define RSDK_PI 3.14159 // PI 21 | #define viewSizeHD 720.0 // how tall viewSize.y has to be before it simulates the dimming effect 22 | #define intencity vec3(1.1, 0.9, 0.9) // how much to "dim" the screen when simulating a CRT effect 23 | 24 | void main() 25 | { 26 | vec2 viewPos = floor((textureSize.xy / pixelSize.xy) * ex_UV.xy * viewSize.xy) + vec2(0.5); 27 | float intencityPos = fract((viewPos.y * 3.0 + viewPos.x) * 0.166667); 28 | 29 | vec4 scanlineIntencity; 30 | if (intencityPos < 0.333) 31 | scanlineIntencity.rgb = intencity.xyz; 32 | else if (intencityPos < 0.666) 33 | scanlineIntencity.rgb = intencity.zxy; 34 | else 35 | scanlineIntencity.rgb = intencity.yzx; 36 | 37 | vec2 pixelPos = ex_UV.xy * textureSize.xy; 38 | vec2 roundedPixelPos = floor(pixelPos.xy); 39 | 40 | scanlineIntencity.a = clamp(abs(sin(pixelPos.y * RSDK_PI)) + 0.25, 0.5, 1.0); 41 | pixelPos.xy = fract(pixelPos.xy) + vec2(-0.5, -0.5); 42 | 43 | vec2 invTexPos = -ex_UV.xy * textureSize.xy + (roundedPixelPos + vec2(0.5, 0.5)); 44 | 45 | vec2 newTexPos; 46 | newTexPos.x = clamp(-abs(invTexPos.x * 0.5) + 1.5, 0.8, 1.25); 47 | newTexPos.y = clamp(-abs(invTexPos.y * 2.0) + 1.25, 0.5, 1.0); 48 | 49 | vec2 colorMod; 50 | colorMod.x = newTexPos.x * newTexPos.y; 51 | colorMod.y = newTexPos.x * ((scanlineIntencity.a + newTexPos.y) * 0.5); 52 | 53 | scanlineIntencity.a *= newTexPos.x; 54 | 55 | vec2 texPos = ((pixelPos.xy + -clamp(pixelPos.xy, vec2(-0.25, -0.25), vec2(0.25, 0.25))) * 2.0 + roundedPixelPos + 0.5) / textureSize.xy; 56 | vec4 texColor = texture2D(texDiffuse, texPos.xy); 57 | 58 | vec3 blendedColor; 59 | blendedColor.r = scanlineIntencity.a * texColor.r; 60 | blendedColor.gb = colorMod.xy * texColor.gb; 61 | 62 | gl_FragColor.rgb = viewSize.y >= viewSizeHD ? (scanlineIntencity.rgb * blendedColor.rgb) : blendedColor.rgb; 63 | 64 | #if RETRO_REV02 65 | gl_FragColor.rgb *= screenDim; 66 | #endif 67 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/OGL/Clean.fs: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | in_F vec2 ex_UV; 5 | in_F vec4 ex_color; 6 | 7 | uniform sampler2D texDiffuse; // screen display texture 8 | 9 | uniform vec2 pixelSize; // internal game resolution (usually 424x240 or smth) 10 | uniform vec2 textureSize; // size of the internal framebuffer texture 11 | uniform vec2 viewSize; // window viewport size 12 | #if RETRO_REV02 // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 13 | uniform float screenDim; // screen dimming percent 14 | #endif 15 | 16 | void main() 17 | { 18 | vec2 texel = ex_UV * vec4(textureSize, 1.0 / textureSize).xy; 19 | vec2 scale = vec2(2); 20 | 21 | vec2 texel_floored = floor(texel); 22 | vec2 s = fract(texel); 23 | vec2 region_range = 0.5 - 0.5 / scale; 24 | 25 | // Figure out where in the texel to sample to get correct pre-scaled bilinear. 26 | // Uses the hardware bilinear interpolator to avoid having to sample 4 times manually. 27 | 28 | vec2 center_dist = s - 0.5; 29 | vec2 f = (center_dist - clamp(center_dist, -region_range, region_range)) * scale + 0.5; 30 | 31 | vec2 mod_texel = texel_floored + f; 32 | 33 | gl_FragColor = texture2D(texDiffuse, (mod_texel / textureSize.xy)); 34 | #if RETRO_REV02 35 | gl_FragColor.rgb *= screenDim; 36 | #endif 37 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/OGL/None.vs: -------------------------------------------------------------------------------- 1 | in_V vec3 in_pos; 2 | // in_V vec4 in_color; 3 | in_V vec2 in_UV; 4 | out vec4 ex_color; 5 | out vec2 ex_UV; 6 | 7 | void main() 8 | { 9 | gl_Position = vec4(in_pos, 1.0); 10 | // ex_color = in_color; 11 | ex_color = vec4(1.0); 12 | ex_UV = in_UV; 13 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/OGL/RGB-Image.fs: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | in_F vec2 ex_UV; 5 | in_F vec4 ex_color; 6 | 7 | uniform sampler2D texDiffuse; // screen display texture 8 | 9 | uniform vec2 pixelSize; // internal game resolution (usually 424x240 or smth) 10 | uniform vec2 textureSize; // size of the internal framebuffer texture 11 | uniform vec2 viewSize; // window viewport size 12 | #if RETRO_REV02 // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 13 | uniform float screenDim; // screen dimming percent 14 | #endif 15 | 16 | 17 | void main() 18 | { 19 | gl_FragColor = texture2D(texDiffuse, ex_UV); 20 | #if RETRO_REV02 21 | gl_FragColor.rgb *= screenDim; 22 | #endif 23 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/OGL/YUV-420.fs: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | in_F vec2 ex_UV; 5 | in_F vec4 ex_color; 6 | 7 | uniform sampler2D texDiffuse; // screen display texture 8 | 9 | uniform vec2 pixelSize; // internal game resolution (usually 424x240 or smth) 10 | uniform vec2 textureSize; // size of the internal framebuffer texture 11 | uniform vec2 viewSize; // window viewport size 12 | #if RETRO_REV02 // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 13 | uniform float screenDim; // screen dimming percent 14 | #endif 15 | 16 | 17 | void main() 18 | { 19 | vec3 yuv; 20 | yuv.r = texture2D(texDiffuse, ex_UV).r; 21 | yuv.gb = texture2D(texDiffuse, clamp(ex_UV / vec2(2.0), 0.0, 0.499)).gb; 22 | yuv -= vec3(16.0 / 256.0, .5, .5); 23 | 24 | gl_FragColor.r = 1.164 * yuv.r + 1.596 * yuv.b; 25 | gl_FragColor.g = 1.164 * yuv.r - 0.392 * yuv.g - 0.813 * yuv.b; 26 | gl_FragColor.b = 1.164 * yuv.r + 2.017 * yuv.g; 27 | #if RETRO_REV02 28 | gl_FragColor.rgb *= screenDim; 29 | #endif 30 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/OGL/YUV-422.fs: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | in_F vec2 ex_UV; 5 | in_F vec4 ex_color; 6 | 7 | uniform sampler2D texDiffuse; // screen display texture 8 | 9 | uniform vec2 pixelSize; // internal game resolution (usually 424x240 or smth) 10 | uniform vec2 textureSize; // size of the internal framebuffer texture 11 | uniform vec2 viewSize; // window viewport size 12 | #if RETRO_REV02 // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 13 | uniform float screenDim; // screen dimming percent 14 | #endif 15 | 16 | 17 | void main() 18 | { 19 | vec3 yuv; 20 | yuv.r = texture2D(texDiffuse, ex_UV).r; 21 | yuv.gb = texture2D(texDiffuse, vec2(clamp(ex_UV.x / 2.0, 0.0, 0.499), ex_UV.y)).gb; 22 | yuv -= vec3(16.0 / 256.0, .5, .5); 23 | 24 | gl_FragColor.r = 1.164 * yuv.r + 1.596 * yuv.b; 25 | gl_FragColor.g = 1.164 * yuv.r - 0.392 * yuv.g - 0.813 * yuv.b; 26 | gl_FragColor.b = 1.164 * yuv.r + 2.017 * yuv.g; 27 | #if RETRO_REV02 28 | gl_FragColor.rgb *= screenDim; 29 | #endif 30 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/OGL/YUV-444.fs: -------------------------------------------------------------------------------- 1 | // ======================= 2 | // VARIABLES 3 | // ======================= 4 | in_F vec2 ex_UV; 5 | in_F vec4 ex_color; 6 | 7 | uniform sampler2D texDiffuse; // screen display texture 8 | 9 | uniform vec2 pixelSize; // internal game resolution (usually 424x240 or smth) 10 | uniform vec2 textureSize; // size of the internal framebuffer texture 11 | uniform vec2 viewSize; // window viewport size 12 | #if RETRO_REV02 // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 13 | uniform float screenDim; // screen dimming percent 14 | #endif 15 | 16 | void main() 17 | { 18 | vec3 yuv = texture2D(texDiffuse, ex_UV).rgb - vec3(16.0 / 256.0, .5, .5); 19 | 20 | gl_FragColor.r = 1.164 * yuv.r + 1.596 * yuv.b; 21 | gl_FragColor.g = 1.164 * yuv.r - 0.392 * yuv.g - 0.813 * yuv.b; 22 | gl_FragColor.b = 1.164 * yuv.r + 2.017 * yuv.g; 23 | #if RETRO_REV02 24 | gl_FragColor.rgb *= screenDim; 25 | #endif 26 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/README.md: -------------------------------------------------------------------------------- 1 | # RSDKv5 Shaders 2 | 3 | These shaders have been decompiled back from compiled bytecode objects into their HLSL equivalents. Both pre-plus (RSDKv5 Rev01) and post-plus (RSDKv5 Rev02, which added screen dimming) have been decompiled. 4 | 5 | ## Compiling from HLSL 6 | * The decompilation will automatically compile loaded shader source files that are in `Data/Shaders/[folder name]/` during runtime. 7 | * the DirectX shader compiler can be used to compile HLSL shader source code into compiled bytecode objects. Information on the DirectX shader compiler can be found [here](https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-part1). 8 | * An example command for the DirectX shader compiler would be: 9 | `fxc.exe /D RETRO_REV02=1 /T ps_3_0 /Fe log.txt /Zi /E PSMain /Fo example.fso example.hlsl`. This compiles the file `example.hlsl` as an HLSL model 3.0 pixel shader with an entry point of `PSMain` with post-plus (RSDKv5 Rev02) features enabled. More information on how to use the DirectX shader compiler from the command line can be found [here](https://docs.microsoft.com/en-us/windows/win32/direct3dtools/dx-graphics-tools-fxc-syntax). 10 | 11 | ## Notice 12 | Please note that the **only** official shaders are of DX9 and DX11. All other directories are ported from HLSL as to match the added render devices. 13 | 14 | If you want to use the shaders of different render devices other than the Data.rsdk you own (ex. the OpenGL3 backend must have them to work,) it is recommended to make a mod with the files in `Data/Shaders/[folder name]`. The decompilation may compile and use them for you depending on if the render device supports it. 15 | -------------------------------------------------------------------------------- /RSDKv5/Shaders/Vulkan/CRT-Yeetron.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | // ======================= 4 | // VARIABLES 5 | // ======================= 6 | layout (location = 0) in vec2 ex_UV; 7 | layout (location = 1) in vec4 ex_color; 8 | 9 | layout (location = 0) out vec4 out_frag; 10 | 11 | layout (binding = 0) uniform sampler2D texDiffuse; // screen display texture 12 | layout (binding = 1) uniform RSDKBuffer { 13 | vec2 pixelSize; // internal game resolution (usually 424x240 or smth) 14 | vec2 textureSize; // size of the internal framebuffer texture 15 | vec2 viewSize; // window viewport size 16 | #if RETRO_REV02 // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 17 | float screenDim; // screen dimming percent 18 | #endif 19 | }; 20 | 21 | // ======================= 22 | // DEFINITIONS 23 | // ======================= 24 | #define RSDK_PI 3.14159 // PI 25 | #define viewSizeHD 720.0 // how tall viewSize.y has to be before it simulates the dimming effect 26 | #define intencity vec3(1.1, 0.9, 0.9) // how much to "dim" the screen when simulating a CRT effect 27 | 28 | void main() 29 | { 30 | vec2 viewPos = floor((textureSize.xy / pixelSize.xy) * ex_UV.xy * viewSize.xy) + vec2(0.5); 31 | float intencityPos = fract((viewPos.y * 3.0 + viewPos.x) * 0.166667); 32 | 33 | vec4 scanlineIntencity; 34 | if (intencityPos < 0.333) 35 | scanlineIntencity.rgb = intencity.xyz; 36 | else if (intencityPos < 0.666) 37 | scanlineIntencity.rgb = intencity.zxy; 38 | else 39 | scanlineIntencity.rgb = intencity.yzx; 40 | 41 | vec2 pixelPos = ex_UV.xy * textureSize.xy; 42 | vec2 roundedPixelPos = floor(pixelPos.xy); 43 | 44 | scanlineIntencity.a = clamp(abs(sin(pixelPos.y * RSDK_PI)) + 0.25, 0.5, 1.0); 45 | pixelPos.xy = fract(pixelPos.xy) + vec2(-0.5, -0.5); 46 | 47 | vec2 invTexPos = -ex_UV.xy * textureSize.xy + (roundedPixelPos + vec2(0.5, 0.5)); 48 | 49 | vec2 newTexPos; 50 | newTexPos.x = clamp(-abs(invTexPos.x * 0.5) + 1.5, 0.8, 1.25); 51 | newTexPos.y = clamp(-abs(invTexPos.y * 2.0) + 1.25, 0.5, 1.0); 52 | 53 | vec2 colorMod; 54 | colorMod.x = newTexPos.x * newTexPos.y; 55 | colorMod.y = newTexPos.x * ((scanlineIntencity.a + newTexPos.y) * 0.5); 56 | 57 | scanlineIntencity.a *= newTexPos.x; 58 | 59 | vec2 texPos = ((pixelPos.xy + -clamp(pixelPos.xy, vec2(-0.25, -0.25), vec2(0.25, 0.25))) * 2.0 + roundedPixelPos + 0.5) / textureSize.xy; 60 | vec4 texColor = texture(texDiffuse, texPos.xy); 61 | 62 | vec3 blendedColor; 63 | blendedColor.r = scanlineIntencity.a * texColor.r; 64 | blendedColor.gb = colorMod.xy * texColor.gb; 65 | 66 | out_frag.rgb = viewSize.y >= viewSizeHD ? (scanlineIntencity.rgb * blendedColor.rgb) : blendedColor.rgb; 67 | 68 | #if RETRO_REV02 69 | out_frag.rgb *= screenDim; 70 | #endif 71 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/Vulkan/Clean.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | // ======================= 3 | // VARIABLES 4 | // ======================= 5 | layout (location = 0) in vec2 ex_UV; 6 | layout (location = 1) in vec4 ex_color; 7 | 8 | layout (location = 0) out vec4 out_frag; 9 | 10 | layout (binding = 0) uniform sampler2D texDiffuse; // screen display texture 11 | layout (binding = 1) uniform RSDKBuffer { 12 | vec2 pixelSize; // internal game resolution (usually 424x240 or smth) 13 | vec2 textureSize; // size of the internal framebuffer texture 14 | vec2 viewSize; // window viewport size 15 | #if RETRO_REV02 // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 16 | float screenDim; // screen dimming percent 17 | #endif 18 | }; 19 | 20 | void main() 21 | { 22 | vec2 texel = ex_UV * vec4(textureSize, 1.0 / textureSize).xy; 23 | vec2 scale = vec2(2); 24 | 25 | vec2 texel_floored = floor(texel); 26 | vec2 s = fract(texel); 27 | vec2 region_range = 0.5 - 0.5 / scale; 28 | 29 | // Figure out where in the texel to sample to get correct pre-scaled bilinear. 30 | // Uses the hardware bilinear interpolator to avoid having to sample 4 times manually. 31 | 32 | vec2 center_dist = s - 0.5; 33 | vec2 f = (center_dist - clamp(center_dist, -region_range, region_range)) * scale + 0.5; 34 | 35 | vec2 mod_texel = texel_floored + f; 36 | 37 | out_frag = texture(texDiffuse, (mod_texel / textureSize.xy)); 38 | #if RETRO_REV02 39 | out_frag.rgb *= screenDim; 40 | #endif 41 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/Vulkan/None.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | // ======================= 4 | // VARIABLES 5 | // ======================= 6 | layout (location = 0) in vec2 ex_UV; 7 | layout (location = 1) in vec4 ex_color; 8 | 9 | layout (location = 0) out vec4 out_frag; 10 | 11 | layout (binding = 0) uniform sampler2D texDiffuse; // screen display texture 12 | layout (binding = 1) uniform RSDKBuffer { 13 | vec2 pixelSize; // internal game resolution (usually 424x240 or smth) 14 | vec2 textureSize; // size of the internal framebuffer texture 15 | vec2 viewSize; // window viewport size 16 | #if RETRO_REV02 // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 17 | float screenDim; // screen dimming percent 18 | #endif 19 | }; 20 | 21 | void main() 22 | { 23 | //out_frag = vec4(ex_UV, 0, 1); 24 | //return; 25 | vec2 viewScale; 26 | viewScale.x = fract(viewSize.x / pixelSize.x) - 0.01; 27 | viewScale.y = fract(viewSize.y / pixelSize.y) - 0.01; 28 | 29 | // if viewSize is an integer scale of pixelSize (within a small margin of error) 30 | 31 | if (viewScale.x < 0.0 && viewScale.y < 0.0) { 32 | // just get the pixel at this fragment with no filtering 33 | #if RETRO_REV02 34 | out_frag = texture(texDiffuse, ex_UV) * screenDim; 35 | #else 36 | out_frag = texture(texDiffuse, ex_UV); 37 | #endif 38 | return; 39 | } 40 | 41 | // otherwise, it's not pixel perfect... do a bit of pixel filtering 42 | // we have to do it manually here since the engine samples this shader using the "point" filter, rather than "linear" 43 | 44 | vec2 adjacent; 45 | adjacent.x = abs(dFdx(ex_UV.x)); 46 | adjacent.y = abs(dFdy(ex_UV.y)); 47 | 48 | vec4 texPos; 49 | texPos.zw = adjacent.yx * vec2(0.500501) + ex_UV.yx; 50 | texPos.xy = -adjacent.xy * vec2(0.500501) + ex_UV.xy; 51 | 52 | vec2 texSize = vec2(1.0) / textureSize.yx; 53 | vec2 texCoord = clamp(texSize.xy * round(ex_UV.yx / texSize.xy), texPos.yx, texPos.zw); 54 | 55 | vec4 blendFactor; 56 | blendFactor.xy = -texPos.xy + texCoord.yx; 57 | blendFactor.zw = texPos.zw + -texCoord.xy; 58 | 59 | float strength = adjacent.x * adjacent.y * 0.500501 * 2.002; 60 | 61 | vec4 blend; 62 | blend.x = (blendFactor.x * blendFactor.y) / strength; 63 | blend.y = (blendFactor.z * blendFactor.w) / strength; 64 | blend.z = (blendFactor.z * blendFactor.x) / strength; 65 | blend.w = (blendFactor.w * blendFactor.y) / strength; 66 | 67 | out_frag = 68 | texture(texDiffuse, texPos.xy) * blend.x + 69 | texture(texDiffuse, texPos.wz) * blend.y + 70 | texture(texDiffuse, texPos.xz) * blend.z + 71 | texture(texDiffuse, texPos.wy) * blend.w; 72 | 73 | #if RETRO_REV02 74 | out_frag.rgb *= screenDim; 75 | #endif 76 | } 77 | -------------------------------------------------------------------------------- /RSDKv5/Shaders/Vulkan/None.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout (location = 0) in vec3 in_pos; 4 | layout (location = 1) in vec4 in_color; 5 | layout (location = 2) in vec2 in_UV; 6 | 7 | layout (location = 0) out vec2 ex_UV; 8 | layout (location = 1) out vec4 ex_color; 9 | 10 | void main() 11 | { 12 | gl_Position = vec4(in_pos, 1.0); 13 | ex_color = in_color; 14 | ex_UV = in_UV; 15 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/Vulkan/RGB-Image.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | // ======================= 3 | // VARIABLES 4 | // ======================= 5 | layout (location = 0) in vec2 ex_UV; 6 | layout (location = 1) in vec4 ex_color; 7 | 8 | layout (location = 0) out vec4 out_frag; 9 | 10 | layout (binding = 0) uniform sampler2D texDiffuse; // screen display texture 11 | layout (binding = 1) uniform RSDKBuffer { 12 | vec2 pixelSize; // internal game resolution (usually 424x240 or smth) 13 | vec2 textureSize; // size of the internal framebuffer texture 14 | vec2 viewSize; // window viewport size 15 | #if RETRO_REV02 // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 16 | float screenDim; // screen dimming percent 17 | #endif 18 | }; 19 | 20 | 21 | void main() 22 | { 23 | out_frag = texture(texDiffuse, ex_UV); 24 | #if RETRO_REV02 25 | out_frag.rgb *= screenDim; 26 | #endif 27 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/Vulkan/YUV-420.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | // ======================= 3 | // VARIABLES 4 | // ======================= 5 | layout (location = 0) in vec2 ex_UV; 6 | layout (location = 1) in vec4 ex_color; 7 | 8 | layout (location = 0) out vec4 out_frag; 9 | 10 | layout (binding = 0) uniform sampler2D texDiffuse; // screen display texture 11 | layout (binding = 1) uniform RSDKBuffer { 12 | vec2 pixelSize; // internal game resolution (usually 424x240 or smth) 13 | vec2 textureSize; // size of the internal framebuffer texture 14 | vec2 viewSize; // window viewport size 15 | #if RETRO_REV02 // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 16 | float screenDim; // screen dimming percent 17 | #endif 18 | }; 19 | 20 | 21 | void main() 22 | { 23 | vec3 yuv; 24 | yuv.r = texture(texDiffuse, ex_UV).r; 25 | yuv.gb = texture(texDiffuse, clamp(ex_UV / vec2(2.0), 0.0, 0.499)).gb; 26 | yuv -= vec3(16.0 / 256.0, .5, .5); 27 | 28 | out_frag.r = 1.164 * yuv.r + 1.596 * yuv.b; 29 | out_frag.g = 1.164 * yuv.r - 0.392 * yuv.g - 0.813 * yuv.b; 30 | out_frag.b = 1.164 * yuv.r + 2.017 * yuv.g; 31 | #if RETRO_REV02 32 | out_frag.rgb *= screenDim; 33 | #endif 34 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/Vulkan/YUV-422.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | // ======================= 3 | // VARIABLES 4 | // ======================= 5 | layout (location = 0) in vec2 ex_UV; 6 | layout (location = 1) in vec4 ex_color; 7 | 8 | layout (location = 0) out vec4 out_frag; 9 | 10 | layout (binding = 0) uniform sampler2D texDiffuse; // screen display texture 11 | layout (binding = 1) uniform RSDKBuffer { 12 | vec2 pixelSize; // internal game resolution (usually 424x240 or smth) 13 | vec2 textureSize; // size of the internal framebuffer texture 14 | vec2 viewSize; // window viewport size 15 | #if RETRO_REV02 // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 16 | float screenDim; // screen dimming percent 17 | #endif 18 | }; 19 | 20 | 21 | void main() 22 | { 23 | vec3 yuv; 24 | yuv.r = texture(texDiffuse, ex_UV).r; 25 | yuv.gb = texture(texDiffuse, vec2(clamp(ex_UV.x / 2.0, 0.0, 0.499), ex_UV.y)).gb; 26 | yuv -= vec3(16.0 / 256.0, .5, .5); 27 | 28 | out_frag.r = 1.164 * yuv.r + 1.596 * yuv.b; 29 | out_frag.g = 1.164 * yuv.r - 0.392 * yuv.g - 0.813 * yuv.b; 30 | out_frag.b = 1.164 * yuv.r + 2.017 * yuv.g; 31 | #if RETRO_REV02 32 | out_frag.rgb *= screenDim; 33 | #endif 34 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/Vulkan/YUV-444.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | // ======================= 3 | // VARIABLES 4 | // ======================= 5 | layout (location = 0) in vec2 ex_UV; 6 | layout (location = 1) in vec4 ex_color; 7 | 8 | layout (location = 0) out vec4 out_frag; 9 | 10 | layout (binding = 0) uniform sampler2D texDiffuse; // screen display texture 11 | layout (binding = 1) uniform RSDKBuffer { 12 | vec2 pixelSize; // internal game resolution (usually 424x240 or smth) 13 | vec2 textureSize; // size of the internal framebuffer texture 14 | vec2 viewSize; // window viewport size 15 | #if RETRO_REV02 // if RETRO_REV02 is defined it assumes the engine is plus/rev02 RSDKv5, else it assumes pre-plus/Rev01 RSDKv5 16 | float screenDim; // screen dimming percent 17 | #endif 18 | }; 19 | 20 | void main() 21 | { 22 | vec3 yuv = texture(texDiffuse, ex_UV).rgb - vec3(16.0 / 256.0, .5, .5); 23 | 24 | out_frag.r = 1.164 * yuv.r + 1.596 * yuv.b; 25 | out_frag.g = 1.164 * yuv.r - 0.392 * yuv.g - 0.813 * yuv.b; 26 | out_frag.b = 1.164 * yuv.r + 2.017 * yuv.g; 27 | #if RETRO_REV02 28 | out_frag.rgb *= screenDim; 29 | #endif 30 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/Vulkan/backup.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | // ======================= 3 | // VARIABLES 4 | // ======================= 5 | layout(location = 0) in vec2 ex_UV; 6 | layout(location = 1) in vec4 ex_color; 7 | 8 | layout(location = 0) out vec4 out_frag; 9 | 10 | layout(binding = 0) uniform sampler2D texDiffuse; // screen display texture 11 | 12 | void main() { out_frag = texture(texDiffuse, ex_UV); } -------------------------------------------------------------------------------- /RSDKv5/Shaders/Vulkan/backup.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout (location = 0) in vec3 in_pos; 4 | layout (location = 1) in vec4 in_color; 5 | layout (location = 2) in vec2 in_UV; 6 | 7 | layout (location = 0) out vec2 ex_UV; 8 | layout (location = 1) out vec4 ex_color; 9 | 10 | void main() 11 | { 12 | gl_Position = vec4(in_pos, 1.0); 13 | ex_color = in_color; 14 | ex_UV = in_UV; 15 | } -------------------------------------------------------------------------------- /RSDKv5/Shaders/Vulkan/compile.py: -------------------------------------------------------------------------------- 1 | import os, subprocess, platform 2 | 3 | if platform.system() == "Windows": 4 | PATH_TO_VK_SDK = os.environ['VK_SDK_PATH'] 5 | GLSLC = PATH_TO_VK_SDK + "/bin/glslc.exe" 6 | elif platform.system() == "Linux": 7 | GLSLC = "glslc" 8 | else: 9 | print(f"Unsupported OS: {platform.system()}") 10 | exit(1) 11 | 12 | 13 | subprocess.call([GLSLC, "",]) 14 | 15 | try: 16 | os.mkdir("../CSO-Vulkan") 17 | except: pass 18 | 19 | for p in os.scandir("."): 20 | if not p.name.endswith("py"): 21 | try: 22 | subprocess.check_call([GLSLC, p.name, '-DRETRO_REV02=1', '-o', f"../CSO-Vulkan/{p.name}"]) 23 | except subprocess.CalledProcessError as e: 24 | print("!!! error compiling", p.name) 25 | # print(e.stderr) 26 | else: 27 | print("+++ compiled", p.name) 28 | 29 | -------------------------------------------------------------------------------- /RSDKv5/main.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_H 2 | #define MAIN_H 3 | 4 | #if !RETRO_STANDALONE 5 | #ifdef _MSC_VER 6 | #define DLLExport __declspec(dllexport) 7 | #else 8 | #define DLLExport 9 | #endif 10 | 11 | extern "C" { 12 | DLLExport int32 RSDK_main(int32 argc, char **argv, void *linkLogicPtr); 13 | } 14 | #else 15 | int32 RSDK_main(int32 argc, char **argv, void *linkLogicPtr); 16 | #endif 17 | 18 | #endif // !ifdef MAIN_H -------------------------------------------------------------------------------- /RSDKv5/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by RSDKv5U.rc 4 | // 5 | #define IDI_ICON1 101 6 | -------------------------------------------------------------------------------- /RSDKv5/switch-icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5/switch-icon.jpg -------------------------------------------------------------------------------- /RSDKv5U.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RSDKv5U.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /RSDKv5U.xcodeproj/project.xcworkspace/xcuserdata/rubberduckycooly.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseAppPreferences 7 | CustomBuildIntermediatesPath 8 | Build/mac/Intermediates.noindex 9 | CustomBuildLocationType 10 | RelativeToDerivedData 11 | CustomBuildProductsPath 12 | Build/mac/Products 13 | DerivedDataCustomLocation 14 | build/mac/v5U 15 | DerivedDataLocationStyle 16 | WorkspaceRelativePath 17 | IssueFilterStyle 18 | ShowActiveSchemeOnly 19 | LiveSourceIssuesEnabled 20 | 21 | ShowSharedSchemesAutomaticallyEnabled 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /RSDKv5U/RSDKv5U.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5U/RSDKv5U.ico -------------------------------------------------------------------------------- /RSDKv5U/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by RSDKv5U.rc 4 | // 5 | #define IDI_ICON1 101 6 | -------------------------------------------------------------------------------- /RSDKv5U/switch-icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/RSDKv5U/switch-icon.jpg -------------------------------------------------------------------------------- /android/app/.gitignore: -------------------------------------------------------------------------------- 1 | .cxx/ 2 | build/ 3 | release/ -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | def autobuildFlag = false 4 | def retroRevision = 3 5 | 6 | android { 7 | ndkVersion "24.0.8215888" 8 | compileSdkVersion 33 9 | buildFeatures { 10 | prefab true 11 | } 12 | defaultConfig { 13 | applicationId "org.rems.rsdkv5" 14 | minSdkVersion 21 15 | targetSdkVersion 33 16 | versionCode 100 17 | versionName "1.1.0" 18 | if(project.hasProperty("RETRO_DISABLE_PLUS")) 19 | autobuildFlag = true 20 | if(project.hasProperty("RETRO_REVISION")) 21 | retroRevision = project.property("RETRO_REVISION") 22 | externalNativeBuild { 23 | cmake { 24 | arguments = ["-DANDROID_STL=c++_shared", "-DPLATFORM=Android", "-DRETRO_DISABLE_PLUS=$autobuildFlag", "-DRETRO_REVISION=$retroRevision"] 25 | } 26 | } 27 | ndk { 28 | abiFilters = [] 29 | abiFilters.addAll(ABIFILTERS.split(';').collect{it as String}) 30 | } 31 | } 32 | signingConfigs { 33 | release { 34 | storeFile file("../release-key.jks") 35 | storePassword "retroengine" 36 | keyAlias "key0" 37 | keyPassword "retroengine" 38 | } 39 | } 40 | 41 | buildTypes { 42 | release { 43 | minifyEnabled false 44 | proguardFiles getDefaultProguardFile('proguard-android.txt') 45 | signingConfig signingConfigs.release 46 | } 47 | } 48 | namespace 'org.rems.rsdkv5' 49 | lint { 50 | abortOnError false 51 | } 52 | if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) { 53 | sourceSets.main { 54 | jniLibs.srcDir 'libs' 55 | } 56 | externalNativeBuild { 57 | cmake { 58 | path 'jni/CMakeLists.txt' 59 | } 60 | } 61 | 62 | } 63 | } 64 | 65 | dependencies { 66 | implementation fileTree(include: ['*.jar'], dir: 'libs') 67 | implementation 'androidx.core:core:1.9.0' 68 | implementation 'androidx.appcompat:appcompat:1.5.1' 69 | implementation "androidx.games:games-activity:1.2.1" 70 | implementation "androidx.games:games-controller:1.1.0" 71 | implementation "androidx.games:games-frame-pacing:1.10.1" 72 | implementation "androidx.documentfile:documentfile:1.0.1" 73 | implementation "com.google.oboe:oboe:1.6.1" 74 | implementation 'com.github.bumptech.glide:glide:4.14.2' 75 | annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2' 76 | } -------------------------------------------------------------------------------- /android/app/jni/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !CMakeLists.txt -------------------------------------------------------------------------------- /android/app/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_STL := c++_static -------------------------------------------------------------------------------- /android/app/jni/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.7) 2 | project(RSDKv5) 3 | 4 | set(curdir ${CMAKE_CURRENT_LIST_DIR}) 5 | set(android 1) 6 | 7 | # message(FATAL_ERROR ${curdir}) 8 | file(GLOB children ${curdir}/*) 9 | 10 | foreach(child ${children}) 11 | if(EXISTS ${child}/CMakeLists.txt) 12 | add_subdirectory(${child}) 13 | endif() 14 | endforeach() 15 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 30 | 31 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-hdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-mdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png -------------------------------------------------------------------------------- /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 | RSDKv5 3 | 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /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:8.2.1' 10 | 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | jcenter() 20 | google() 21 | } 22 | } 23 | 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | ## For more details on how to configure your build environment visit 2 | # http://www.gradle.org/docs/current/userguide/build_environment.html 3 | # 4 | # Specifies the JVM arguments used for the daemon process. 5 | # The setting is particularly useful for tweaking memory settings. 6 | # Default value: -Xmx1024m -XX:MaxPermSize=256m 7 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 8 | # 9 | # When configured, Gradle will run in incubating parallel mode. 10 | # This option should only be used with decoupled projects. More details, visit 11 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 12 | # org.gradle.parallel=true 13 | #Fri Nov 18 19:42:29 CST 2022 14 | org.gradle.jvmargs=-Xmx1024M -Dkotlin.daemon.jvm.options\="-Xmx1024M" 15 | android.useAndroidX=true 16 | ABIFILTERS=armeabi-v7a;arm64-v8a;x86;x86_64 17 | android.nonTransitiveRClass=false 18 | android.nonFinalResIds=false 19 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Nov 20 16:53:10 CST 2022 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /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/release-key.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/android/release-key.jks -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /clang-format-commands.txt: -------------------------------------------------------------------------------- 1 | [in the root dir] find ./RSDKv5 -iname *.hpp -o -iname *.cpp | xargs clang-format -i -verbose -style=file -------------------------------------------------------------------------------- /dependencies/all/iniparser/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2000-2011 by Nicolas Devillard. 2 | MIT License 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a 5 | copy of this software and associated documentation files (the "Software"), 6 | to deal in the Software without restriction, including without limitation 7 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | and/or sell copies of the Software, and to permit persons to whom the 9 | Software is 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 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /dependencies/all/iniparser/README.md: -------------------------------------------------------------------------------- 1 | # iniparser 2 | 3 | * This is a version of the [iniparser](https://github.com/ndevilla/iniparser) library that has been slightly modified to suit the needs of this project. -------------------------------------------------------------------------------- /dependencies/all/iniparser/dictionary.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------------------*/ 2 | /** 3 | @file dictionary.h 4 | @author N. Devillard 5 | @brief Implements a dictionary for string variables. 6 | 7 | This module implements a simple dictionary object, i.e. a list 8 | of string/string associations. This object is useful to store e.g. 9 | informations retrieved from a configuration file (ini files). 10 | */ 11 | /*--------------------------------------------------------------------------*/ 12 | 13 | #ifndef _DICTIONARY_H_ 14 | #define _DICTIONARY_H_ 15 | 16 | /*--------------------------------------------------------------------------- 17 | Includes 18 | ---------------------------------------------------------------------------*/ 19 | 20 | #include 21 | #include 22 | #include 23 | #if !_WIN32 24 | #include 25 | #endif 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /*--------------------------------------------------------------------------- 32 | New types 33 | ---------------------------------------------------------------------------*/ 34 | 35 | 36 | /*-------------------------------------------------------------------------*/ 37 | /** 38 | @brief Dictionary object 39 | 40 | This object contains a list of string/string associations. Each 41 | association is identified by a unique string key. Looking up values 42 | in the dictionary is speeded up by the use of a (hopefully collision-free) 43 | hash function. 44 | */ 45 | /*-------------------------------------------------------------------------*/ 46 | typedef struct _dictionary_ { 47 | int n ; /** Number of entries in dictionary */ 48 | size_t size ; /** Storage size */ 49 | char ** val ; /** List of string values */ 50 | char ** key ; /** List of string keys */ 51 | unsigned * hash ; /** List of hash values for keys */ 52 | } dictionary ; 53 | 54 | 55 | /*--------------------------------------------------------------------------- 56 | Function prototypes 57 | ---------------------------------------------------------------------------*/ 58 | 59 | 60 | unsigned dictionary_hash(const char * key); 61 | 62 | 63 | dictionary * dictionary_new(size_t size); 64 | 65 | 66 | void dictionary_del(dictionary * vd); 67 | 68 | 69 | const char * dictionary_get(const dictionary * d, const char * key, const char * def); 70 | 71 | 72 | 73 | int dictionary_set(dictionary * vd, const char * key, const char * val); 74 | 75 | 76 | void dictionary_unset(dictionary * d, const char * key); 77 | 78 | 79 | void dictionary_dump(const dictionary * d, FILE * out); 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | 85 | #endif -------------------------------------------------------------------------------- /dependencies/all/miniz/LICENSE.md: -------------------------------------------------------------------------------- 1 | This is copied from the [miniz repository.](https://github.com/richgel999/miniz/) 2 | 3 | # Miniz License 4 | ``` 5 | Copyright 2013-2014 RAD Game Tools and Valve Software 6 | Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC 7 | 8 | All Rights Reserved. 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | THE SOFTWARE. 27 | ``` -------------------------------------------------------------------------------- /dependencies/android/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !README.md 4 | !libogg/include/ogg/config_types.h 5 | !androidHelpers* -------------------------------------------------------------------------------- /dependencies/android/README.md: -------------------------------------------------------------------------------- 1 | # Android 2 | 3 | ## Install dependencies 4 | 5 | * libogg: [Download](https://xiph.org/downloads/) and unzip it in `dependencies/android/libogg`. 6 | 7 | * libtheora: [Download](https://xiph.org/downloads/) and unzip it in `dependencies/android/libtheora`. 8 | 9 | ## Set up symlinks 10 | 11 | * Ensure the symbolic links in `[root]/android/app/jni` are correct: 12 | * `Game` -> root of the Mania repository (or any other game that you may be compiling) 13 | * Extra symbolic links can be added for things like mods, **as mods do not use the local files for logic.** Just ensure that there are `CMakeLists.txt` files at the root of them. 14 | 15 | To add symbolic links, do the following: 16 | * Windows: `mklink /d "[name-of-symlink]" "[path]"` 17 | * Linux: `ln -s "[path]" "[name-of-symlink]"` 18 | * Open `[root]/android/` in Android Studio, install the NDK and everything else that it asks for, and build. 19 | 20 | **Please note that GL shaders are required, or you may get a black screen or crash.** Read [the Shaders question in the FAQ](../../FAQ.md#q-why-arent-videosfilters-working-while-using-gl) for a guide on how to install them. 21 | 22 | 23 | ## Common build issues (Windows) 24 | ### `make: *** INTERNAL: readdir: No such file or directory` 25 | Delete `android/app/build` and try again. This occurs when the path is short enough to build, but too long for a rebuild. 26 | ### `make: Interrupt/exception caught (code = 0xc0000005)` 27 | Your paths are too long. Try renaming the symbolic links to something shorter, or make a symbolic link to RSDKv5 closer to the root of the drive and open the project through there (e.x. C:/RSDKv5/android). *I haven't had either issue since I did this.* 28 | -------------------------------------------------------------------------------- /dependencies/android/androidHelpers.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ANDROIDHELPERS_H 2 | #define ANDROIDHELPERS_H 3 | // god i need to sort these out soon 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | struct JNISetup { 17 | jclass clazz; // activity class 18 | jobject thiz; // activity object 19 | JNIEnv *env; // jni env 20 | }; 21 | struct JNISetup *GetJNISetup(); 22 | 23 | typedef struct android_app android_app; 24 | extern android_app *app; 25 | extern jmethodID getFD; 26 | extern jmethodID writeLog; 27 | 28 | extern jmethodID showLoading; 29 | extern jmethodID hideLoading; 30 | extern jmethodID setLoading; 31 | extern jmethodID setPixSize; 32 | 33 | class GameActivity; 34 | class GameActivityKeyEvent; 35 | 36 | #define jniname(name, class) Java_org_rems_rsdkv5_##class##_##name 37 | #define jnifunc(name, class, ...) jniname(name, class)(JNIEnv *env, jclass cls, __VA_ARGS__) 38 | #define jnifuncN(name, class) jniname(name, class)(JNIEnv *env, jclass cls) 39 | 40 | extern "C" JNIEXPORT void JNICALL jnifunc(nativeOnTouch, RSDK, jint finger, jint action, jfloat x, jfloat y); 41 | extern "C" JNIEXPORT jbyteArray JNICALL jnifunc(nativeLoadFile, RSDK, jstring file); 42 | 43 | void AndroidCommandCallback(android_app *app, int32 cmd); 44 | bool AndroidKeyDownCallback(GameActivity *activity, const GameActivityKeyEvent *event); 45 | bool AndroidKeyUpCallback(GameActivity *activity, const GameActivityKeyEvent *event); 46 | 47 | void ShowLoadingIcon(); 48 | void HideLoadingIcon(); 49 | void SetLoadingIcon(); 50 | 51 | #endif // ANDROID_ANDROIDHELPERS_H 52 | -------------------------------------------------------------------------------- /dependencies/android/libogg/include/ogg/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 -------------------------------------------------------------------------------- /dependencies/ios/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !README.md 4 | ![Ii]nfo.plist 5 | !Default.png -------------------------------------------------------------------------------- /dependencies/ios/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/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/README.md: -------------------------------------------------------------------------------- 1 | # IOS SETUP 2 | 3 | * todo: this -------------------------------------------------------------------------------- /dependencies/mac/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !README.md 4 | ![Ii]nfo.plist 5 | !cocoaHelpers.* -------------------------------------------------------------------------------- /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 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSMainStoryboardFile 26 | Main 27 | NSPrincipalClass 28 | NSApplication 29 | 30 | 31 | -------------------------------------------------------------------------------- /dependencies/mac/README.md: -------------------------------------------------------------------------------- 1 | # Mac 2 | 3 | ## Dependencies: 4 | SDL2: https://www.libsdl.org/download-2.0.php 5 | just download the appropriate development library for your compiler and place it in "./SDL2/" 6 | 7 | libogg: https://xiph.org/downloads/ (libogg) 8 | download the libogg .zip file and unzip it in "./libogg/", 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 libtheora .zip file and unzip it in "./libtheora/", then build the library as a framework, and include it in the xcode proj 12 | 13 | ## Compiling 14 | 15 | Open the Xcode project and build it from there. -------------------------------------------------------------------------------- /dependencies/mac/cocoaHelpers.hpp: -------------------------------------------------------------------------------- 1 | #ifndef COCOA_HELPERS_H 2 | #define COCOA_HELPERS_H 3 | 4 | const char* getResourcesPath(void); 5 | 6 | #endif -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /dependencies/ogl/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !README.md -------------------------------------------------------------------------------- /dependencies/ogl/README.md: -------------------------------------------------------------------------------- 1 | # Linux/Switch 2 | 3 | **This document was intended for a now outdated method of building this decompilation and is only left in this repository for reference purposes. It's highly recommended to follow the [CMake guide](./../../README.md#how-to-build) instead.** 4 | 5 | ## Installing GL3 dependencies 6 | 7 | The OpenGL3 backend is mainly used on Linux and Switch, but it does support Windows too. 8 | 9 | For Windows, these need to be downloaded and extracted in their respective subdirectories 10 | - **GLEW:** Download from [SourceForge](http://glew.sourceforge.net/), extract it in `dependencies/ogl/glew` 11 | - **GLFW:** Download from [the official site](https://www.glfw.org/download.html), extract it in `dependencies/ogl/glfw` 12 | There are also 32-bit binaries available if you need them, but make sure the RSDKv5(U) is built for 32-bit too! 13 | 14 | For Switch you'll need [devkitPro](https://devkitpro.org/) and GLAD, as GLEW and GLFW are not available. Install GLAD with `sudo dkp-pacman -S switch-glad` 15 | 16 | For Linux you can install the dependencies using your distro package manager: 17 | - **Arch Linux:** `sudo pacman -S base-devel glew glfw libtheora zlib sdl2` 18 | - **Ubuntu (20.04+) or Debian (11+):** `sudo apt install build-essential libglew-dev libglfw3-dev libtheora-dev zlib1g-dev libsdl2-dev` 19 | - **Fedora:** `sudo dnf install make gcc glew-devel glfw-devel libtheora-devel zlib-devel SDL2-devel` 20 | 21 | ## Compiling 22 | 23 | To compile you can just use `make`. To customize the build you can set the following options 24 | - `PLATFORM=Switch`: Build for Nintendo Switch. 25 | - `RSDK_REVISION=2`: Compile regular RSDKv5 instead of RSDKv5U. 26 | - `RSDK_ONLY=1`: Only build the engine (no Game.so) 27 | - `AUTOBUILD=1`: Disable the Plus DLC, which you should do if you plan on distributing the binary. 28 | 29 | ## Shaders 30 | 31 | Once completed, it is **heavily recommended** that you grab the Shaders folder in RSDKv5 and turn it into a mod. Otherwise, movies will not display properly and the filters from video settings won't work. 32 | 33 | To do this, create the following directory structure inside your mods directory: 34 | ``` 35 | GLShaders/ 36 | | Data/ 37 | | | ... 38 | | mod.ini 39 | ``` 40 | 41 | Inside `mods/GLShaders/Data/` copy the `RSDKv5/Shaders` directory, and inside the mod.ini, paste this: 42 | ``` 43 | Name=GLShaders 44 | Description=GL3 shaders to enable filters and stuff 45 | Author=Ducky 46 | Version=1.0.0 47 | TargetVersion=5 48 | ``` -------------------------------------------------------------------------------- /dependencies/switch/libnx-dyn/README.md: -------------------------------------------------------------------------------- 1 | # libnx modular application 2 | 3 | port of a port of a port of a port (thanks XorTroll) 4 | 5 | [original repo](https://github.com/XorTroll/libnx-dyn/tree/master), original readme below 6 | 7 | ## Modules 8 | 9 | - Every module must be in its subdir (suggestion: copy the sample `module`) 10 | 11 | - The root Makefile has a `MODULES` list to auto-build them, place them in the application's romfs and then build the application. 12 | 13 | ## Dynamic code 14 | 15 | Dynamic code (`dyn.h` and `dyn.c`) is a port of a port of a port (libtransistor in C -> Biosphere in C++ -> libnx in C++ -> libnx in C) which uses ldr:ro + ELF relocation to load a NRO, dlfcn-ish. 16 | 17 | ## Credits 18 | 19 | - libtransistor and its devs for the original dynamic loading code, amazing work -------------------------------------------------------------------------------- /dependencies/switch/libnx-dyn/address_space.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * @brief Initialize address space manager 5 | * 6 | * This should be called early in crt0 and should not be called by 7 | * any applications or utility functions before using address space 8 | * management functions. 9 | */ 10 | Result as_init(); 11 | 12 | /** 13 | * @brief Finalize address space manager 14 | * 15 | * Called by crt0 and should not be called by applications or 16 | * utility functions. 17 | */ 18 | void as_finalize(); 19 | 20 | /** 21 | * @brief Finds and reserves an unmapped region of address space 22 | * 23 | * @param len The length of address space to reserve 24 | */ 25 | void *as_reserve(size_t len); 26 | 27 | /** 28 | * @brief Frees a region of address space reserved by \ref as_reserve 29 | * 30 | * The address and size must exactly match an entire memory region 31 | * reserved by \ref as_reserve. 32 | * 33 | * @param addr Base of the reserved address space 34 | * @param len Length of the reserved address space 35 | */ 36 | void as_release(void *addr, size_t len); 37 | -------------------------------------------------------------------------------- /dependencies/switch/libnx-dyn/dynamic_wrap.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | void *__nx_aslr_base; 6 | 7 | extern void __real___nx_dynamic(uintptr_t base, const Elf64_Dyn* dyn); 8 | 9 | void __wrap___nx_dynamic(uintptr_t base, const Elf64_Dyn* dyn) { 10 | 11 | // Custom way to get base address to be used from modules later. 12 | __nx_aslr_base = (void*)base; 13 | 14 | // Normal __nx_dynamic 15 | __real___nx_dynamic(base, dyn); 16 | } -------------------------------------------------------------------------------- /dependencies/windows/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !README.md -------------------------------------------------------------------------------- /dependencies/windows/README.md: -------------------------------------------------------------------------------- 1 | # Windows 2 | 3 | **This document was intended for a now outdated method of building this decompilation and is only left in this repository for reference purposes. It's highly recommended to follow the [CMake guide](./../../README.md#how-to-build) instead.** 4 | 5 | ## Installing dependencies 6 | 7 | * libogg: https://xiph.org/downloads/ (libogg) 8 | * Download libogg and unzip it in "./libogg/", then build the static library 9 | 10 | * libtheora: https://www.theora.org/downloads/ 11 | * Download **the 1.2.0 alpha release** and unzip it in "./libtheora/", then build the VS2010 static library (win32/VS2010/libtheora_static.sln) 12 | 13 | * SDL2 (Required for SDL2 backends): https://www.libsdl.org/download-2.0.php 14 | * Download the appropriate development library for your compiler and unzip it in "./SDL2/" 15 | 16 | * For the OGL backends, visit the OGL README [here.](../ogl/README.md) 17 | 18 | ## Compiling 19 | 20 | * Build via the Visual Studio solution (or grab a prebuilt executable from the releases section.) 21 | -------------------------------------------------------------------------------- /filters/DX11.slnf: -------------------------------------------------------------------------------- 1 | { 2 | "solution": { 3 | "path": "..\\SonicMania.sln", 4 | "projects": [ 5 | "RSDKv5\\RSDKv5_dx11.vcxproj", 6 | "Sonic Mania\\Sonic Mania.vcxproj" 7 | ] 8 | } 9 | } -------------------------------------------------------------------------------- /filters/DX9.slnf: -------------------------------------------------------------------------------- 1 | { 2 | "solution": { 3 | "path": "..\\SonicMania.sln", 4 | "projects": [ 5 | "RSDKv5\\RSDKv5_dx9.vcxproj", 6 | "Sonic Mania\\Sonic Mania.vcxproj" 7 | ] 8 | } 9 | } -------------------------------------------------------------------------------- /filters/GL3.slnf: -------------------------------------------------------------------------------- 1 | { 2 | "solution": { 3 | "path": "..\\SonicMania.sln", 4 | "projects": [ 5 | "RSDKv5\\RSDKv5_ogl.vcxproj", 6 | "Sonic Mania\\Sonic Mania.vcxproj" 7 | ] 8 | } 9 | } -------------------------------------------------------------------------------- /filters/SDL2.slnf: -------------------------------------------------------------------------------- 1 | { 2 | "solution": { 3 | "path": "..\\SonicMania.sln", 4 | "projects": [ 5 | "RSDKv5\\RSDKv5_sdl2.vcxproj", 6 | "Sonic Mania\\Sonic Mania.vcxproj" 7 | ] 8 | } 9 | } -------------------------------------------------------------------------------- /filters/all/DX11.slnf: -------------------------------------------------------------------------------- 1 | { 2 | "solution": { 3 | "path": "..\\..\\SonicMania.sln", 4 | "projects": [ 5 | "RSDKv5\\RSDKv5_dx11.vcxproj", 6 | "Sonic Mania\\Sonic Mania_All.vcxproj" 7 | ] 8 | } 9 | } -------------------------------------------------------------------------------- /filters/all/DX9.slnf: -------------------------------------------------------------------------------- 1 | { 2 | "solution": { 3 | "path": "..\\..\\SonicMania.sln", 4 | "projects": [ 5 | "RSDKv5\\RSDKv5_dx9.vcxproj", 6 | "Sonic Mania\\Sonic Mania_All.vcxproj" 7 | ] 8 | } 9 | } -------------------------------------------------------------------------------- /filters/all/GL3.slnf: -------------------------------------------------------------------------------- 1 | { 2 | "solution": { 3 | "path": "..\\..\\SonicMania.sln", 4 | "projects": [ 5 | "RSDKv5\\RSDKv5_ogl.vcxproj", 6 | "Sonic Mania\\Sonic Mania_All.vcxproj" 7 | ] 8 | } 9 | } -------------------------------------------------------------------------------- /filters/all/SDL2.slnf: -------------------------------------------------------------------------------- 1 | { 2 | "solution": { 3 | "path": "..\\..\\SonicMania.sln", 4 | "projects": [ 5 | "RSDKv5\\RSDKv5_sdl2.vcxproj", 6 | "Sonic Mania\\Sonic Mania_All.vcxproj" 7 | ] 8 | } 9 | } -------------------------------------------------------------------------------- /header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSDKModding/RSDKv5-Decompilation/81b21f92cb040b48f9944f000e3069fa7cc4c25c/header.png -------------------------------------------------------------------------------- /makefiles/Linux.cfg: -------------------------------------------------------------------------------- 1 | STATIC = 0 2 | RSDK_LIBS += -pthread 3 | 4 | SUBSYSTEM ?= OGL 5 | 6 | ifeq ($(SUBSYSTEM),OGL) 7 | # VIDEO: GLFW 8 | # INPUTS: Keyboard and GLFW 9 | # AUDIO: SDL2 10 | RSDK_LIBS += -lglfw 11 | 12 | RSDK_CFLAGS += `$(PKGCONFIG) --cflags --static sdl2 glew` 13 | RSDK_LIBS += `$(PKGCONFIG) --libs --static sdl2 glew` 14 | endif 15 | 16 | ifeq ($(SUBSYSTEM),VK) 17 | # VIDEO: GLFW w/ VulkanRenderDevice 18 | # INPUTS: Keyboard and GLFW 19 | # AUDIO: SDL2 20 | RSDK_LIBS += -lglfw 21 | DEFINES += -DVULKAN_USE_GLFW 22 | 23 | RSDK_CFLAGS += `$(PKGCONFIG) --cflags --static sdl2` 24 | RSDK_LIBS += `$(PKGCONFIG) --libs --static sdl2 vulkan` 25 | endif 26 | 27 | ifeq ($(SUBSYSTEM),SDL2) 28 | # EVERYTHING: SDL2 29 | RSDK_CFLAGS += `$(PKGCONFIG) --cflags --static sdl2` 30 | RSDK_LIBS += `$(PKGCONFIG) --libs --static sdl2` 31 | endif 32 | 33 | RSDK_CFLAGS += `$(PKGCONFIG) --cflags --static theora theoradec zlib portaudio` 34 | RSDK_LIBS += `$(PKGCONFIG) --libs --static theora theoradec zlib portaudio` 35 | 36 | -------------------------------------------------------------------------------- /makefiles/Switch.cfg: -------------------------------------------------------------------------------- 1 | STATIC = 1 2 | STATICGAME = 1 3 | 4 | ifeq ($(RSDK_ONLY),1) 5 | $(error RSDK_ONLY must not be defined for Switch builds) 6 | endif 7 | 8 | include $(DEVKITPRO)/libnx/switch_rules 9 | PKGCONFIG = $(DEVKITPRO)/portlibs/switch/bin/aarch64-none-elf-pkg-config 10 | STRIP = $(DEVKITPRO)/devkitA64/bin/aarch64-none-elf-strip 11 | NACPTOOL=$(DEVKITPRO)/tools/bin/nacptool 12 | 13 | CXXFLAGS += -DARM -march=armv8-a -mtune=cortex-a57 -mtp=soft \ 14 | -fPIE -Wl,--allow-multiple-definition -specs=$(DEVKITPRO)/libnx/switch.specs -mlittle-endian 15 | DEFINES += -D__SWITCH__ -w 16 | 17 | LDFLAGS += -L$(LIBNX)/lib 18 | RSDK_LIBS += -lnxd -pthread 19 | RSDK_INCLUDES += -I$(LIBNX)/include -I$(PORTLIBS)/include 20 | 21 | GAME_FLAGS += -DGAME_MAIN=main 22 | 23 | ifdef NXLINK 24 | DEFINES += -DENABLE_NXLINK 25 | endif 26 | 27 | RSDK_SUFFIX = .elf 28 | PKG_SUFFIX = .nro 29 | 30 | SUBSYSTEM ?= OGL 31 | 32 | ifeq ($(SUBSYSTEM),OGL) 33 | # VIDEO: OGL/EGL 34 | # INPUTS: Switch 35 | # AUDIO: SDL2 36 | RSDK_CFLAGS += `$(PKGCONFIG) --cflags --static sdl2` 37 | RSDK_LIBS += `$(PKGCONFIG) --libs --static sdl2` -lglad 38 | endif 39 | 40 | ifeq ($(SUBSYSTEM),SDL2) 41 | # EVERYTHING: SDL2 42 | RSDK_CFLAGS += `$(PKGCONFIG) --cflags --static sdl2` 43 | RSDK_LIBS += `$(PKGCONFIG) --libs --static sdl2` 44 | endif 45 | 46 | RSDK_CFLAGS += `$(PKGCONFIG) --cflags --static theora theoradec` 47 | RSDK_LIBS += `$(PKGCONFIG) --libs --static theora theoradec` 48 | 49 | RSDK_PRELINK := nacpgen 50 | 51 | nacpgen: 52 | @echo creating NACP... 53 | @$(NACPTOOL) --create "$(RSDK_NAME)" "SEGA, Rubberduckycooly, RMGRich" "1.1.0" $(OUTDIR)/details.nacp 54 | 55 | #$(OUTDIR)/$(PKG_NAME)$(PKG_SUFFIX): $(OUTDIR)/$(RSDK_NAME)$(RSDK_SUFFIX) 56 | # @echo -n "building nro... " 57 | # $(NACPTOOL) --create "$(RSDK_NAME)" "SEGA, Rubberduckycooly, RMGRich" "1.1.0" $(OUTDIR)/details.nacp 58 | # elf2nro $(RSDK_PATH) $(PKG_PATH) --icon=./$(RSDK_NAME)/switch-icon.jpg --nacp=$(OUTDIR)/details.nacp 59 | # @echo "done" 60 | 61 | #APP_TITLE := $(RSDK_NAME) 62 | #APP_AUTHOR := SEGA, Rubberduckycooly, chuliRMG 63 | #APP_VERSION := 1.1.0 64 | #APP_ICON := $(OUTDIR) 65 | 66 | NROFLAGS = --icon=./$(RSDK_NAME)/switch-icon.jpg --nacp=$(OUTDIR)/details.nacp 67 | -------------------------------------------------------------------------------- /makefiles/Windows.cfg: -------------------------------------------------------------------------------- 1 | # this is gonna assume MINGW 2 | STATIC = 0 3 | RSDK_SUFFIX = .exe 4 | GAME_SUFFIX = .dll 5 | 6 | RSDK_CFLAGS += -mwindows -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive 7 | RSDK_LDFLAGS += -static -static-libgcc -static-libstdc++ 8 | 9 | SUBSYSTEM ?= DX9 10 | 11 | ifeq ($(SUBSYSTEM),OGL) 12 | # VIDEO: OGL 13 | # INPUTS: Keyboard and GLFW 14 | # AUDIO: XAudio 15 | RSDK_SOURCES += dependencies/ogl/glad/src/glad 16 | RSDK_LIBS += -lglfw 17 | RSDK_INCLUDES += -I./dependencies/ogl/glad/include 18 | 19 | RSDK_CFLAGS += `$(PKGCONFIG) --cflags --static sdl2 ogg theora` 20 | RSDK_LIBS += `$(PKGCONFIG) --libs --static sdl2 ogg theora` -lxaudio2_8 21 | endif 22 | 23 | ifeq ($(SUBSYSTEM),DX9) 24 | # actually do we need to do anything here???? 25 | # VIDEO: DX9 26 | # INPUTS: Keyboard, XInput, RawInput 27 | # AUDIO: XAudio 28 | RSDK_CFLAGS += `$(PKGCONFIG) --cflags --static ogg theora` 29 | RSDK_LIBS += `$(PKGCONFIG) --libs --static ogg theora` -ld3d9 -lxinput -lcomctl32 -lgdi32 -lWinmm -lole32 -lxaudio2_8 -ld3dcompiler -lksuser 30 | endif 31 | 32 | ifeq ($(SUBSYSTEM),SDL2) 33 | # EVERYTHING: SDL2 34 | RSDK_CFLAGS += `$(PKGCONFIG) --cflags --static sdl2 ogg theora` 35 | RSDK_LIBS += `$(PKGCONFIG) --libs --static sdl2 ogg theora` 36 | endif 37 | 38 | 39 | RSDK_PRELINK := win-res 40 | 41 | ifeq ($(RSDK_REVISION),3) 42 | RSDK_LIBS += RSDKv5U/RSDKv5U.res 43 | win-res: 44 | @windres -i RSDKv5U/RSDKv5U.rc -o RSDKv5U/RSDKv5U.res -O coff 45 | else 46 | RSDK_LIBS += RSDKv5/RSDKv5.res 47 | win-res: 48 | @windres -i RSDKv5/RSDKv5.rc -o RSDKv5/RSDKv5.res -O coff 49 | endif 50 | -------------------------------------------------------------------------------- /mingw64-make.sh: -------------------------------------------------------------------------------- 1 | make PLATFORM=Windows CC=/usr/bin/x86_64-w64-mingw32-gcc CXX=/usr/bin/x86_64-w64-mingw32-g++ $* 2 | -------------------------------------------------------------------------------- /platforms/Android.cmake: -------------------------------------------------------------------------------- 1 | add_library(RetroEngine SHARED ${RETRO_FILES} dependencies/android/androidHelpers.cpp) 2 | 3 | set(DEP_PATH android) 4 | set(RETRO_SUBSYSTEM "OGL") 5 | set(RETRO_OUTPUT_NAME "RetroEngine") 6 | 7 | set(COMPILE_OGG TRUE) 8 | set(COMPILE_THEORA TRUE) 9 | set(OGG_FLAGS -ffast-math -fsigned-char -O2 -fPIC -DPIC -DBYTE_ORDER=LITTLE_ENDIAN -D_ARM_ASSEM_ -w) 10 | set(THEORA_FLAGS -ffast-math -fsigned-char -O2 -fPIC -DPIC -DBYTE_ORDER=LITTLE_ENDIAN -D_ARM_ASSEM_ -w) 11 | 12 | find_package(games-controller REQUIRED CONFIG) 13 | find_package(game-activity REQUIRED CONFIG) 14 | find_package(games-frame-pacing REQUIRED CONFIG) 15 | find_package(oboe REQUIRED CONFIG) 16 | 17 | target_link_libraries(RetroEngine 18 | android 19 | EGL 20 | GLESv3 21 | log 22 | z 23 | jnigraphics 24 | games-controller::paddleboat_static 25 | game-activity::game-activity 26 | games-frame-pacing::swappy_static 27 | oboe::oboe 28 | OpenSLES 29 | ) 30 | 31 | target_link_options(RetroEngine PRIVATE -u GameActivity_onCreate) -------------------------------------------------------------------------------- /platforms/NintendoSwitch.cmake: -------------------------------------------------------------------------------- 1 | find_package(PkgConfig REQUIRED) 2 | 3 | add_executable(RetroEngine ${RETRO_FILES} 4 | dependencies/switch/libnx-dyn/dyn.c 5 | dependencies/switch/libnx-dyn/dynamic_wrap.c 6 | dependencies/switch/libnx-dyn/address_space.c 7 | ) 8 | 9 | target_include_directories(RetroEngine PRIVATE 10 | dependencies/switch/libnx-dyn 11 | ) 12 | 13 | set(RETRO_SUBSYSTEM "OGL" CACHE STRING "The subsystem to use") 14 | 15 | pkg_check_modules(OGG ogg) 16 | 17 | if(NOT OGG_FOUND) 18 | set(COMPILE_OGG TRUE) 19 | message(NOTICE "libogg not found, attempting to build from source") 20 | else() 21 | message("found libogg") 22 | target_link_libraries(RetroEngine ${OGG_STATIC_LIBRARIES}) 23 | target_link_options(RetroEngine PRIVATE ${OGG_STATIC_LDLIBS_OTHER}) 24 | target_compile_options(RetroEngine PRIVATE ${OGG_STATIC_CFLAGS}) 25 | endif() 26 | 27 | pkg_check_modules(THEORA theora theoradec) 28 | 29 | if(NOT THEORA_FOUND) 30 | message("could not find libtheora, attempting to build manually") 31 | set(COMPILE_THEORA TRUE) 32 | else() 33 | message("found libtheora") 34 | target_link_libraries(RetroEngine ${THEORA_STATIC_LIBRARIES}) 35 | target_link_options(RetroEngine PRIVATE ${THEORA_STATIC_LDLIBS_OTHER}) 36 | target_compile_options(RetroEngine PRIVATE ${THEORA_STATIC_CFLAGS}) 37 | endif() 38 | 39 | 40 | if(RETRO_SUBSYSTEM STREQUAL "OGL") 41 | pkg_check_modules(GLAD libglad REQUIRED) 42 | target_link_libraries(RetroEngine ${GLAD_STATIC_LIBRARIES}) 43 | target_link_options(RetroEngine PRIVATE ${GLAD_STATIC_LDLIBS_OTHER}) 44 | target_compile_options(RetroEngine PRIVATE ${GLAD_STATIC_CFLAGS}) 45 | 46 | pkg_check_modules(SDL2 sdl2 REQUIRED) 47 | target_link_libraries(RetroEngine ${SDL2_STATIC_LIBRARIES}) 48 | target_link_options(RetroEngine PRIVATE ${SDL2_STATIC_LDLIBS_OTHER}) 49 | target_compile_options(RetroEngine PRIVATE ${SDL2_STATIC_CFLAGS}) 50 | elseif(RETRO_SUBSYSTEM STREQUAL "SDL2") 51 | pkg_check_modules(SDL2 sdl2 REQUIRED) 52 | target_link_libraries(RetroEngine ${SDL2_STATIC_LIBRARIES}) 53 | target_link_options(RetroEngine PRIVATE ${SDL2_STATIC_LDLIBS_OTHER}) 54 | target_compile_options(RetroEngine PRIVATE ${SDL2_STATIC_CFLAGS}) 55 | endif() 56 | 57 | add_custom_command(TARGET RetroEngine POST_BUILD 58 | COMMAND ${NX_NACPTOOL_EXE} 59 | --create "${RETRO_NAME}" "SEGA, ES, Rubberduckycooly, stxtic" "${DECOMP_VERSION}" 60 | $/details.nacp 61 | COMMAND ${NX_ELF2NRO_EXE} 62 | $ 63 | $$.nro 64 | --icon=${CMAKE_CURRENT_SOURCE_DIR}/${RETRO_NAME}/switch-icon.jpg 65 | --nacp=$/details.nacp 66 | ) 67 | 68 | set(PLATFORM Switch) -------------------------------------------------------------------------------- /props/winactions.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | C:/vcpkg/installed/x86-windows/lib/;C:/vcpkg/installed/x86-windows/lib/manual-link/;C:/vcpkg/installed/x86-windows-static/lib/ 6 | SDL2.lib;SDL2main.lib;ogg.lib;vorbis.lib;vorbisfile.lib;theora.lib;Shell32.lib;Advapi32.lib 7 | 8 | 9 | USING_VCPKG;%(PreprocessorDefinitions) 10 | 11 | 12 | 13 | Y 14 | 15 | 16 | -------------------------------------------------------------------------------- /props/winactions_x64.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | C:/vcpkg/installed/x64-windows/lib/;C:/vcpkg/installed/x64-windows/lib/manual-link/;C:/vcpkg/installed/x64-windows-static/lib/ 6 | SDL2.lib;SDL2main.lib;ogg.lib;vorbis.lib;vorbisfile.lib;theora.lib;Shell32.lib;Advapi32.lib 7 | 8 | 9 | USING_VCPKG;%(PreprocessorDefinitions) 10 | 11 | 12 | 13 | Y 14 | 15 | 16 | --------------------------------------------------------------------------------