Path: blob/master/RSDKv5/RSDK/Core/Link.cpp
1163 views
#include "RSDK/Core/RetroEngine.hpp"1#include "Link.hpp"23using namespace RSDK;45void *RSDK::RSDKFunctionTable[FunctionTable_Count];67#if RETRO_REV028void *RSDK::APIFunctionTable[APITable_Count];910RSDK::SKU::SKUInfo RSDK::SKU::curSKU;11RSDK::SKU::UnknownInfo RSDK::SKU::unknownInfo;12#else13RSDK::APITableEntry RSDK::APIFunctionTable[APITABLE_COUNT];14int32 RSDK::APIFunctionTableCount;15#endif1617RSDK::GameVersionInfo RSDK::gameVerInfo;1819void NullFunc() {}2021#define ADD_RSDK_FUNCTION(id, func) RSDKFunctionTable[id] = (void *)func;22#if RETRO_REV0223#define ADD_API_FUNCTION(id, func) APIFunctionTable[id] = (void *)func;24#else25#define ADD_API_FUNCTION(name, func) SetAPIFunction(name, (void *)func);2627void SetAPIFunction(const char *name, void *ptr)28{29if (APIFunctionTableCount < APITABLE_COUNT) {30RETRO_HASH_MD5(hash);31GEN_HASH_MD5(name, hash);3233for (int32 f = 0; f < APIFunctionTableCount; ++f) {34if (HASH_MATCH_MD5(hash, APIFunctionTable[f].hash))35return; // already exists, ignore this call36}3738HASH_COPY_MD5(APIFunctionTable[APIFunctionTableCount].hash, hash);39APIFunctionTable[APIFunctionTableCount].ptr = ptr;40APIFunctionTableCount++;41}42}4344void *GetAPIFunction(const char *name)45{46if (!name)47return NULL;4849RETRO_HASH_MD5(hash);50GEN_HASH_MD5(name, hash);5152for (int32 f = 0; f < APIFunctionTableCount; ++f) {53if (HASH_MATCH_MD5(hash, APIFunctionTable[f].hash))54return APIFunctionTable[f].ptr;55}5657if (engine.consoleEnabled)58PrintLog(PRINT_POPUP, "API Function not found: %s", name);5960return NULL;61}62#endif6364void RSDK::SetupFunctionTables()65{66using namespace RSDK;67using namespace RSDK::SKU;6869#if RETRO_USE_MOD_LOADER70if (RSDKFunctionTable[0]) {71InitModAPI();72return;73}74#endif7576CalculateTrigAngles();77GenerateBlendLookupTable();78InitSystemSurfaces();7980memset(RSDKFunctionTable, 0, sizeof(RSDKFunctionTable));81#if RETRO_REV0282memset(APIFunctionTable, 0, sizeof(APIFunctionTable));83#endif8485#if RETRO_REV028687// ============================88// API Function Table (Rev02)89// ============================9091// API Core92ADD_API_FUNCTION(APITable_GetUserLanguage, GetUserLanguage);93ADD_API_FUNCTION(APITable_GetConfirmButtonFlip, GetConfirmButtonFlip);94ADD_API_FUNCTION(APITable_ExitGame, ExitGame);95ADD_API_FUNCTION(APITable_LaunchManual, LaunchManual);96#if RETRO_REV0U97ADD_API_FUNCTION(APITable_GetDefaultGamepadType, GetDefaultGamepadType);98#endif99ADD_API_FUNCTION(APITable_IsOverlayEnabled, IsOverlayEnabled);100ADD_API_FUNCTION(APITable_CheckDLC, CheckDLC);101#if RETRO_VER_EGS102ADD_API_FUNCTION(APITable_SetupExtensionOverlay, SetupExtensionOverlay);103ADD_API_FUNCTION(APITable_CanShowExtensionOverlay, CanShowExtensionOverlay);104#endif105ADD_API_FUNCTION(APITable_ShowExtensionOverlay, ShowExtensionOverlay);106#if RETRO_VER_EGS107ADD_API_FUNCTION(APITable_CanShowAltExtensionOverlay, CanShowAltExtensionOverlay);108ADD_API_FUNCTION(APITable_ShowAltExtensionOverlay, ShowAltExtensionOverlay);109ADD_API_FUNCTION(APITable_GetConnectingStringID, GetConnectingStringID);110ADD_API_FUNCTION(APITable_ShowLimitedVideoOptions, ShowLimitedVideoOptions);111#endif112113// Achievements114ADD_API_FUNCTION(APITable_UnlockAchievement, TryUnlockAchievement);115ADD_API_FUNCTION(APITable_GetAchievementsEnabled, GetAchievementsEnabled);116ADD_API_FUNCTION(APITable_SetAchievementsEnabled, SetAchievementsEnabled);117#if RETRO_VER_EGS118ADD_API_FUNCTION(APITable_CheckAchievementsEnabled, CheckAchievementsEnabled);119ADD_API_FUNCTION(APITable_SetAchievementNames, SetAchievementNames);120#endif121122// Leaderboards123ADD_API_FUNCTION(APITable_InitLeaderboards, InitLeaderboards);124#if RETRO_VER_EGS125ADD_API_FUNCTION(APITable_CheckLeaderboardsEnabled, CheckLeaderboardsEnabled);126#endif127ADD_API_FUNCTION(APITable_FetchLeaderboard, FetchLeaderboard);128ADD_API_FUNCTION(APITable_TrackScore, TrackScore);129ADD_API_FUNCTION(APITable_GetLeaderboardsStatus, GetLeaderboardsStatus);130ADD_API_FUNCTION(APITable_LeaderboardEntryViewSize, LeaderboardEntryViewSize);131ADD_API_FUNCTION(APITable_LeaderboardEntryLoadSize, LeaderboardEntryLoadSize);132ADD_API_FUNCTION(APITable_LoadLeaderboardEntries, LoadLeaderboardEntries);133ADD_API_FUNCTION(APITable_ResetLeaderboardInfo, ResetLeaderboardInfo);134ADD_API_FUNCTION(APITable_ReadLeaderboardEntry, ReadLeaderboardEntry);135136// Rich Presence137ADD_API_FUNCTION(APITable_SetPresence, SetPresence);138139// Stats140ADD_API_FUNCTION(APITable_TryTrackStat, TryTrackStat);141ADD_API_FUNCTION(APITable_GetStatsEnabled, GetStatsEnabled);142ADD_API_FUNCTION(APITable_SetStatsEnabled, SetStatsEnabled);143144// Authorization & Storage145ADD_API_FUNCTION(APITable_ClearPrerollErrors, ClearPrerollErrors);146ADD_API_FUNCTION(APITable_TryAuth, TryAuth);147ADD_API_FUNCTION(APITable_GetUserAuthStatus, GetUserAuthStatus);148ADD_API_FUNCTION(APITable_GetUsername, GetUsername);149ADD_API_FUNCTION(APITable_TryInitStorage, TryInitStorage);150ADD_API_FUNCTION(APITable_GetUserStorageStatus, GetUserStorageStatus);151152// Saving153ADD_API_FUNCTION(APITable_GetSaveStatus, GetSaveStatus);154ADD_API_FUNCTION(APITable_ClearSaveStatus, ClearSaveStatus);155ADD_API_FUNCTION(APITable_SetSaveStatusContinue, SetSaveStatusContinue);156ADD_API_FUNCTION(APITable_SetSaveStatusOK, SetSaveStatusOK);157ADD_API_FUNCTION(APITable_SetSaveStatusForbidden, SetSaveStatusForbidden);158ADD_API_FUNCTION(APITable_SetSaveStatusError, SetSaveStatusError);159ADD_API_FUNCTION(APITable_SetUserStorageNoSave, SetUserStorageNoSave);160ADD_API_FUNCTION(APITable_GetUserStorageNoSave, GetUserStorageNoSave);161162// User File Management163ADD_API_FUNCTION(APITable_LoadUserFile, TryLoadUserFile); // load user file from game dir164ADD_API_FUNCTION(APITable_SaveUserFile, TrySaveUserFile); // save user file to game dir165ADD_API_FUNCTION(APITable_DeleteUserFile, TryDeleteUserFile); // delete user file from game dir166167// User DBs168ADD_API_FUNCTION(APITable_InitUserDB, InitUserDB);169ADD_API_FUNCTION(APITable_OpenUserDB, LoadUserDB);170ADD_API_FUNCTION(APITable_SaveUserDB, SaveUserDB);171ADD_API_FUNCTION(APITable_ClearUserDB, ClearUserDB);172ADD_API_FUNCTION(APITable_ClearAllUserDBs, ClearAllUserDBs);173ADD_API_FUNCTION(APITable_SetupUserDBRowSorting, SetupUserDBRowSorting);174ADD_API_FUNCTION(APITable_GetUserDBRowsChanged, GetUserDBRowsChanged);175ADD_API_FUNCTION(APITable_AddUserDBRowSortFilter, AddUserDBRowSortFilter);176ADD_API_FUNCTION(APITable_SortUserDBRows, SortUserDBRows);177ADD_API_FUNCTION(APITable_GetSortedUserDBRowCount, GetSortedUserDBRowCount);178ADD_API_FUNCTION(APITable_GetSortedUserDBRowID, GetSortedUserDBRowID);179ADD_API_FUNCTION(APITable_AddUserDBRow, AddUserDBRow);180ADD_API_FUNCTION(APITable_SetUserDBValue, SetUserDBValue);181ADD_API_FUNCTION(APITable_GetUserDBValue, GetUserDBValue);182ADD_API_FUNCTION(APITable_GetRowUUID, GetDBRowUUID);183ADD_API_FUNCTION(APITable_GetUserDBRowByID, GetUserDBRowByID);184ADD_API_FUNCTION(APITable_GetUserDBRowCreationTime, GetUserDBRowCreationTime);185ADD_API_FUNCTION(APITable_RemoveDBRow, RemoveDBRow);186ADD_API_FUNCTION(APITable_RemoveAllDBRows, RemoveAllDBRows);187#else188// ============================189// API Functions (Rev01)190// ============================191192// API Core193ADD_API_FUNCTION("GetConfirmButtonFlip", GetConfirmButtonFlip);194// APICallback uses the sku one anyways if this isn't set, this is only needed if it needs to interact with the backend APIs195// ADD_API_FUNCTION("GetUserLanguage", GetUserLanguage);196ADD_API_FUNCTION("GetXYButtonFlip", GetXYButtonFlip);197ADD_API_FUNCTION("LaunchManual", LaunchManual);198ADD_API_FUNCTION("ExitGame", ExitGame);199200// Achievements201ADD_API_FUNCTION("ClearAchievements", ClearAchievements);202ADD_API_FUNCTION("UnlockAchievement", TryUnlockAchievement);203204// Leaderboards205// ADD_API_FUNCTION("FetchLeaderboard", FetchLeaderboard);206// ADD_API_FUNCTION("LeaderboardStatus", GetLeaderboardStatus);207// ADD_API_FUNCTION("LeaderboardEntryCount", LeaderboardEntryCount);208// ADD_API_FUNCTION("LeaderboardReadEntry", LeaderboardReadEntry);209210// Rich Presence211// ADD_API_FUNCTION("SetRichPresence", SetPresence);212213// Stats214ADD_API_FUNCTION("TrackActClear", TrackActClear);215ADD_API_FUNCTION("TrackTAClear", TrackTAClear);216ADD_API_FUNCTION("TrackEnemyDefeat", TrackEnemyDefeat);217ADD_API_FUNCTION("TrackGameProgress", TrackGameProgress);218219// Authorization & Storage220// ADD_API_FUNCTION("ClearPrerollErrors", ClearPrerollErrors); // Dummy behaviour is managed by APICallback221// ADD_API_FUNCTION("TryAuth", TryAuth); // Dummy behaviour is managed by APICallback222// ADD_API_FUNCTION("GetUserAuthStatus", GetUserAuthStatus); // Dummy behaviour is managed by APICallback223// ADD_API_FUNCTION("TryInitStorage", TryInitStorage); // Dummy behaviour is managed by APICallback224// ADD_API_FUNCTION("GetStorageStatus", GetUserStorageStatus); // Dummy behaviour is managed by APICallback225// ADD_API_FUNCTION("GetUsername", GetUsername); // APICallback sets the dummy one anyways if this isn't set226227// User File Management228ADD_API_FUNCTION("LoadUserFile", TryLoadUserFile);229ADD_API_FUNCTION("SaveUserFile", TrySaveUserFile);230ADD_API_FUNCTION("SaveSettingsINI", SaveSettingsINI);231232// Input233ADD_API_FUNCTION("ControllerIDForInputID", GetInputDeviceID);234ADD_API_FUNCTION("MostRecentActiveControllerID", GetFilteredInputDeviceID);235ADD_API_FUNCTION("AssignControllerID", AssignInputSlotToDevice);236ADD_API_FUNCTION("ResetControllerAssignments", ResetInputSlotAssignments);237ADD_API_FUNCTION("InputIDIsDisconnected", InputIDIsDisconnected);238ADD_API_FUNCTION("GetControllerType", GetInputDeviceType);239ADD_API_FUNCTION("ShowSteamControllerOverlay", ShowExtensionOverlay);240ADD_API_FUNCTION("SetInputLEDColor", SetInputLEDColor);241#endif242243// ============================244// RSDK Function Table245// ============================246247// Registration248ADD_RSDK_FUNCTION(FunctionTable_RegisterGlobalVariables, RegisterGlobalVariables);249ADD_RSDK_FUNCTION(FunctionTable_RegisterObject, RegisterObject);250#if RETRO_REV02251ADD_RSDK_FUNCTION(FunctionTable_RegisterStaticVariables, RegisterStaticVariables);252#endif253254// Entities & Objects255ADD_RSDK_FUNCTION(FunctionTable_GetActiveEntities, GetActiveEntities);256ADD_RSDK_FUNCTION(FunctionTable_GetAllEntities, GetAllEntities);257ADD_RSDK_FUNCTION(FunctionTable_BreakForeachLoop, BreakForeachLoop);258ADD_RSDK_FUNCTION(FunctionTable_SetEditableVar, SetEditableVar);259ADD_RSDK_FUNCTION(FunctionTable_GetEntity, GetEntity);260ADD_RSDK_FUNCTION(FunctionTable_GetEntitySlot, GetEntitySlot);261ADD_RSDK_FUNCTION(FunctionTable_GetEntityCount, GetEntityCount);262ADD_RSDK_FUNCTION(FunctionTable_GetDrawListRefSlot, GetDrawListRefSlot);263ADD_RSDK_FUNCTION(FunctionTable_GetDrawListRef, GetDrawListRef);264ADD_RSDK_FUNCTION(FunctionTable_ResetEntity, ResetEntity);265ADD_RSDK_FUNCTION(FunctionTable_ResetEntitySlot, ResetEntitySlot);266ADD_RSDK_FUNCTION(FunctionTable_CreateEntity, CreateEntity);267ADD_RSDK_FUNCTION(FunctionTable_CopyEntity, CopyEntity);268ADD_RSDK_FUNCTION(FunctionTable_CheckOnScreen, CheckOnScreen);269ADD_RSDK_FUNCTION(FunctionTable_CheckPosOnScreen, CheckPosOnScreen);270ADD_RSDK_FUNCTION(FunctionTable_AddDrawListRef, AddDrawListRef);271ADD_RSDK_FUNCTION(FunctionTable_SwapDrawListEntries, SwapDrawListEntries);272ADD_RSDK_FUNCTION(FunctionTable_SetDrawGroupProperties, SetDrawGroupProperties);273274// Scene Management275ADD_RSDK_FUNCTION(FunctionTable_SetScene, SetScene);276ADD_RSDK_FUNCTION(FunctionTable_SetEngineState, SetEngineState);277#if RETRO_REV02278ADD_RSDK_FUNCTION(FunctionTable_ForceHardReset, ForceHardReset);279#endif280ADD_RSDK_FUNCTION(FunctionTable_CheckValidScene, CheckValidScene);281ADD_RSDK_FUNCTION(FunctionTable_CheckSceneFolder, CheckSceneFolder);282ADD_RSDK_FUNCTION(FunctionTable_LoadScene, LoadScene);283ADD_RSDK_FUNCTION(FunctionTable_FindObject, FindObject);284285// Cameras286ADD_RSDK_FUNCTION(FunctionTable_ClearCameras, ClearCameras);287ADD_RSDK_FUNCTION(FunctionTable_AddCamera, AddCamera);288289// API (Rev01 only)290#if !RETRO_REV02291ADD_RSDK_FUNCTION(FunctionTable_GetAPIFunction, GetAPIFunction);292#endif293294// Window/Video Settings295ADD_RSDK_FUNCTION(FunctionTable_GetVideoSetting, GetVideoSetting);296ADD_RSDK_FUNCTION(FunctionTable_SetVideoSetting, SetVideoSetting);297ADD_RSDK_FUNCTION(FunctionTable_UpdateWindow, UpdateGameWindow)298299// Math300ADD_RSDK_FUNCTION(FunctionTable_Sin1024, Sin1024);301ADD_RSDK_FUNCTION(FunctionTable_Cos1024, Cos1024);302ADD_RSDK_FUNCTION(FunctionTable_ATan1024, Tan1024);303ADD_RSDK_FUNCTION(FunctionTable_ASin1024, ASin1024);304ADD_RSDK_FUNCTION(FunctionTable_ACos1024, ACos1024);305ADD_RSDK_FUNCTION(FunctionTable_Sin512, Sin512);306ADD_RSDK_FUNCTION(FunctionTable_Cos512, Cos512);307ADD_RSDK_FUNCTION(FunctionTable_ATan512, Tan512);308ADD_RSDK_FUNCTION(FunctionTable_ASin512, ASin512);309ADD_RSDK_FUNCTION(FunctionTable_ACos512, ACos512);310ADD_RSDK_FUNCTION(FunctionTable_Sin256, Sin256);311ADD_RSDK_FUNCTION(FunctionTable_Cos256, Cos256);312ADD_RSDK_FUNCTION(FunctionTable_ATan256, Tan256);313ADD_RSDK_FUNCTION(FunctionTable_ASin256, ASin256);314ADD_RSDK_FUNCTION(FunctionTable_ACos256, ACos256);315ADD_RSDK_FUNCTION(FunctionTable_Rand, Rand);316ADD_RSDK_FUNCTION(FunctionTable_RandSeeded, RandSeeded);317ADD_RSDK_FUNCTION(FunctionTable_SetRandSeed, SetRandSeed);318ADD_RSDK_FUNCTION(FunctionTable_ATan2, ArcTanLookup);319320// Matrices321ADD_RSDK_FUNCTION(FunctionTable_SetIdentityMatrix, SetIdentityMatrix);322ADD_RSDK_FUNCTION(FunctionTable_MatrixMultiply, MatrixMultiply);323ADD_RSDK_FUNCTION(FunctionTable_MatrixTranslateXYZ, MatrixTranslateXYZ);324ADD_RSDK_FUNCTION(FunctionTable_MatrixScaleXYZ, MatrixScaleXYZ);325ADD_RSDK_FUNCTION(FunctionTable_MatrixRotateX, MatrixRotateX);326ADD_RSDK_FUNCTION(FunctionTable_MatrixRotateY, MatrixRotateY);327ADD_RSDK_FUNCTION(FunctionTable_MatrixRotateZ, MatrixRotateZ);328ADD_RSDK_FUNCTION(FunctionTable_MatrixRotateXYZ, MatrixRotateXYZ);329ADD_RSDK_FUNCTION(FunctionTable_MatrixInverse, MatrixInverse);330ADD_RSDK_FUNCTION(FunctionTable_MatrixCopy, MatrixCopy);331332// Strings333ADD_RSDK_FUNCTION(FunctionTable_InitString, InitString);334ADD_RSDK_FUNCTION(FunctionTable_CopyString, CopyString);335ADD_RSDK_FUNCTION(FunctionTable_SetString, SetString);336ADD_RSDK_FUNCTION(FunctionTable_AppendString, AppendString);337ADD_RSDK_FUNCTION(FunctionTable_AppendText, AppendText);338ADD_RSDK_FUNCTION(FunctionTable_LoadStringList, LoadStringList);339ADD_RSDK_FUNCTION(FunctionTable_SplitStringList, SplitStringList);340ADD_RSDK_FUNCTION(FunctionTable_GetCString, GetCString);341ADD_RSDK_FUNCTION(FunctionTable_CompareStrings, CompareStrings);342343// Screens & Displays344ADD_RSDK_FUNCTION(FunctionTable_GetDisplayInfo, GetDisplayInfo);345ADD_RSDK_FUNCTION(FunctionTable_GetWindowSize, GetWindowSize);346ADD_RSDK_FUNCTION(FunctionTable_SetScreenSize, SetScreenSize);347ADD_RSDK_FUNCTION(FunctionTable_SetClipBounds, SetClipBounds);348#if RETRO_REV02349ADD_RSDK_FUNCTION(FunctionTable_SetScreenVertices, SetScreenVertices);350#endif351352// Spritesheets353ADD_RSDK_FUNCTION(FunctionTable_LoadSpriteSheet, LoadSpriteSheet);354355// Palettes & Colors356#if RETRO_REV02357ADD_RSDK_FUNCTION(FunctionTable_SetTintLookupTable, SetTintLookupTable);358#else359// cant be bothered to change the enum name lol360ADD_RSDK_FUNCTION(FunctionTable_SetTintLookupTable, GetTintLookupTable);361#endif362ADD_RSDK_FUNCTION(FunctionTable_SetPaletteMask, SetPaletteMask);363ADD_RSDK_FUNCTION(FunctionTable_SetPaletteEntry, SetPaletteEntry);364ADD_RSDK_FUNCTION(FunctionTable_GetPaletteEntry, GetPaletteEntry);365ADD_RSDK_FUNCTION(FunctionTable_SetActivePalette, SetActivePalette);366ADD_RSDK_FUNCTION(FunctionTable_CopyPalette, CopyPalette);367#if RETRO_REV02368ADD_RSDK_FUNCTION(FunctionTable_LoadPalette, LoadPalette);369#endif370ADD_RSDK_FUNCTION(FunctionTable_RotatePalette, RotatePalette);371ADD_RSDK_FUNCTION(FunctionTable_SetLimitedFade, SetPaletteFade);372#if RETRO_REV02373ADD_RSDK_FUNCTION(FunctionTable_BlendColors, BlendColors);374#endif375376// Drawing377ADD_RSDK_FUNCTION(FunctionTable_DrawRect, DrawRectangle);378ADD_RSDK_FUNCTION(FunctionTable_DrawLine, DrawLine);379ADD_RSDK_FUNCTION(FunctionTable_DrawCircle, DrawCircle);380ADD_RSDK_FUNCTION(FunctionTable_DrawCircleOutline, DrawCircleOutline);381ADD_RSDK_FUNCTION(FunctionTable_DrawFace, DrawFace);382ADD_RSDK_FUNCTION(FunctionTable_DrawBlendedFace, DrawBlendedFace);383ADD_RSDK_FUNCTION(FunctionTable_DrawSprite, DrawSprite);384ADD_RSDK_FUNCTION(FunctionTable_DrawDeformedSprite, DrawDeformedSprite);385ADD_RSDK_FUNCTION(FunctionTable_DrawString, DrawString);386ADD_RSDK_FUNCTION(FunctionTable_DrawTile, DrawTile);387ADD_RSDK_FUNCTION(FunctionTable_CopyTile, CopyTile);388ADD_RSDK_FUNCTION(FunctionTable_DrawAniTile, DrawAniTile);389#if RETRO_REV0U390ADD_RSDK_FUNCTION(FunctionTable_DrawDynamicAniTile, DrawDynamicAniTile);391#endif392ADD_RSDK_FUNCTION(FunctionTable_FillScreen, FillScreen);393394// Meshes & 3D Scenes395ADD_RSDK_FUNCTION(FunctionTable_LoadMesh, LoadMesh);396ADD_RSDK_FUNCTION(FunctionTable_Create3DScene, Create3DScene);397ADD_RSDK_FUNCTION(FunctionTable_Prepare3DScene, Prepare3DScene);398ADD_RSDK_FUNCTION(FunctionTable_SetDiffuseColor, SetDiffuseColor);399ADD_RSDK_FUNCTION(FunctionTable_SetDiffuseIntensity, SetDiffuseIntensity);400ADD_RSDK_FUNCTION(FunctionTable_SetSpecularIntensity, SetSpecularIntensity);401ADD_RSDK_FUNCTION(FunctionTable_AddModelToScene, AddModelToScene);402ADD_RSDK_FUNCTION(FunctionTable_SetModelAnimation, SetMeshAnimation);403ADD_RSDK_FUNCTION(FunctionTable_AddMeshFrameToScene, AddMeshFrameToScene);404ADD_RSDK_FUNCTION(FunctionTable_Draw3DScene, Draw3DScene);405406// Sprite Animations & Frames407ADD_RSDK_FUNCTION(FunctionTable_LoadSpriteAnimation, LoadSpriteAnimation);408ADD_RSDK_FUNCTION(FunctionTable_CreateSpriteAnimation, CreateSpriteAnimation);409ADD_RSDK_FUNCTION(FunctionTable_SetSpriteAnimation, SetSpriteAnimation);410ADD_RSDK_FUNCTION(FunctionTable_EditSpriteAnimation, EditSpriteAnimation);411ADD_RSDK_FUNCTION(FunctionTable_SetSpriteString, SetSpriteString);412ADD_RSDK_FUNCTION(FunctionTable_FindSpriteAnimation, FindSpriteAnimation);413ADD_RSDK_FUNCTION(FunctionTable_GetFrame, GetFrame);414ADD_RSDK_FUNCTION(FunctionTable_GetHitbox, GetHitbox);415ADD_RSDK_FUNCTION(FunctionTable_GetFrameID, GetFrameID);416ADD_RSDK_FUNCTION(FunctionTable_GetStringWidth, GetStringWidth);417ADD_RSDK_FUNCTION(FunctionTable_ProcessAnimation, ProcessAnimation);418419// Tile Layers420ADD_RSDK_FUNCTION(FunctionTable_GetTileLayerID, GetTileLayerID);421ADD_RSDK_FUNCTION(FunctionTable_GetTileLayer, GetTileLayer);422ADD_RSDK_FUNCTION(FunctionTable_GetLayerSize, GetLayerSize);423ADD_RSDK_FUNCTION(FunctionTable_GetTile, GetTile);424ADD_RSDK_FUNCTION(FunctionTable_SetTile, SetTile);425ADD_RSDK_FUNCTION(FunctionTable_CopyTileLayer, CopyTileLayer);426ADD_RSDK_FUNCTION(FunctionTable_ProcessParallax, ProcessParallax);427ADD_RSDK_FUNCTION(FunctionTable_GetScanlines, GetScanlines);428429// Object & Tile Collisions430ADD_RSDK_FUNCTION(FunctionTable_CheckObjectCollisionTouch, CheckObjectCollisionTouch);431ADD_RSDK_FUNCTION(FunctionTable_CheckObjectCollisionCircle, CheckObjectCollisionCircle);432ADD_RSDK_FUNCTION(FunctionTable_CheckObjectCollisionBox, CheckObjectCollisionBox);433ADD_RSDK_FUNCTION(FunctionTable_CheckObjectCollisionPlatform, CheckObjectCollisionPlatform);434ADD_RSDK_FUNCTION(FunctionTable_ObjectTileCollision, ObjectTileCollision);435ADD_RSDK_FUNCTION(FunctionTable_ObjectTileGrip, ObjectTileGrip);436ADD_RSDK_FUNCTION(FunctionTable_ProcessObjectMovement, ProcessObjectMovement);437#if RETRO_REV0U438ADD_RSDK_FUNCTION(FunctionTable_SetupCollisionConfig, SetupCollisionConfig);439ADD_RSDK_FUNCTION(FunctionTable_SetPathGripSensors, SetPathGripSensors);440ADD_RSDK_FUNCTION(FunctionTable_FloorCollision, FloorCollision);441ADD_RSDK_FUNCTION(FunctionTable_LWallCollision, LWallCollision);442ADD_RSDK_FUNCTION(FunctionTable_RoofCollision, RoofCollision);443ADD_RSDK_FUNCTION(FunctionTable_RWallCollision, RWallCollision);444ADD_RSDK_FUNCTION(FunctionTable_FindFloorPosition, FindFloorPosition);445ADD_RSDK_FUNCTION(FunctionTable_FindLWallPosition, FindLWallPosition);446ADD_RSDK_FUNCTION(FunctionTable_FindRoofPosition, FindRoofPosition);447ADD_RSDK_FUNCTION(FunctionTable_FindRWallPosition, FindRWallPosition);448#endif449ADD_RSDK_FUNCTION(FunctionTable_GetTileAngle, GetTileAngle);450ADD_RSDK_FUNCTION(FunctionTable_SetTileAngle, SetTileAngle);451ADD_RSDK_FUNCTION(FunctionTable_GetTileFlags, GetTileFlags);452ADD_RSDK_FUNCTION(FunctionTable_SetTileFlags, SetTileFlags);453#if RETRO_REV0U454ADD_RSDK_FUNCTION(FunctionTable_CopyCollisionMask, CopyCollisionMask);455ADD_RSDK_FUNCTION(FunctionTable_GetCollisionInfo, GetCollisionInfo);456#endif457458// Audio459ADD_RSDK_FUNCTION(FunctionTable_GetSfx, GetSfx);460ADD_RSDK_FUNCTION(FunctionTable_PlaySfx, PlaySfx);461ADD_RSDK_FUNCTION(FunctionTable_StopSfx, StopSfx);462ADD_RSDK_FUNCTION(FunctionTable_PlayMusic, PlayStream);463ADD_RSDK_FUNCTION(FunctionTable_SetChannelAttributes, SetChannelAttributes);464ADD_RSDK_FUNCTION(FunctionTable_StopChannel, StopChannel);465ADD_RSDK_FUNCTION(FunctionTable_PauseChannel, PauseChannel);466ADD_RSDK_FUNCTION(FunctionTable_ResumeChannel, ResumeChannel);467ADD_RSDK_FUNCTION(FunctionTable_SfxPlaying, SfxPlaying);468ADD_RSDK_FUNCTION(FunctionTable_ChannelActive, ChannelActive);469ADD_RSDK_FUNCTION(FunctionTable_GetChannelPos, GetChannelPos);470471// Videos & "HD Images"472ADD_RSDK_FUNCTION(FunctionTable_LoadVideo, LoadVideo);473ADD_RSDK_FUNCTION(FunctionTable_LoadImage, LoadImage);474475// Input476#if RETRO_REV02477ADD_RSDK_FUNCTION(FunctionTable_GetInputDeviceID, GetInputDeviceID);478ADD_RSDK_FUNCTION(FunctionTable_GetFilteredInputDeviceID, GetFilteredInputDeviceID);479ADD_RSDK_FUNCTION(FunctionTable_GetInputDeviceType, GetInputDeviceType);480ADD_RSDK_FUNCTION(FunctionTable_IsInputDeviceAssigned, IsInputDeviceAssigned);481ADD_RSDK_FUNCTION(FunctionTable_GetInputDeviceUnknown, GetInputDeviceUnknown);482ADD_RSDK_FUNCTION(FunctionTable_InputDeviceUnknown1, InputDeviceUnknown1);483ADD_RSDK_FUNCTION(FunctionTable_InputDeviceUnknown2, InputDeviceUnknown2);484ADD_RSDK_FUNCTION(FunctionTable_GetInputSlotUnknown, GetInputSlotUnknown);485ADD_RSDK_FUNCTION(FunctionTable_InputSlotUnknown1, InputSlotUnknown1);486ADD_RSDK_FUNCTION(FunctionTable_InputSlotUnknown2, InputSlotUnknown2);487ADD_RSDK_FUNCTION(FunctionTable_AssignInputSlotToDevice, AssignInputSlotToDevice);488ADD_RSDK_FUNCTION(FunctionTable_IsInputSlotAssigned, IsInputSlotAssigned);489ADD_RSDK_FUNCTION(FunctionTable_ResetInputSlotAssignments, ResetInputSlotAssignments);490#endif491#if !RETRO_REV02492ADD_RSDK_FUNCTION(FunctionTable_GetUnknownInputValue, GetUnknownInputValue);493#endif494495// User File Management496ADD_RSDK_FUNCTION(FunctionTable_LoadUserFile, LoadUserFile); // load user file from exe dir497ADD_RSDK_FUNCTION(FunctionTable_SaveUserFile, SaveUserFile); // save use file to exe dir498499// Printing (Rev02)500#if RETRO_REV02501ADD_RSDK_FUNCTION(FunctionTable_PrintLog, PrintLog);502ADD_RSDK_FUNCTION(FunctionTable_PrintText, PrintText);503ADD_RSDK_FUNCTION(FunctionTable_PrintString, PrintString);504ADD_RSDK_FUNCTION(FunctionTable_PrintUInt32, PrintUInt32);505ADD_RSDK_FUNCTION(FunctionTable_PrintInt32, PrintInt32);506ADD_RSDK_FUNCTION(FunctionTable_PrintFloat, PrintFloat);507ADD_RSDK_FUNCTION(FunctionTable_PrintVector2, PrintVector2);508ADD_RSDK_FUNCTION(FunctionTable_PrintHitbox, PrintHitbox);509#endif510511// Editor512ADD_RSDK_FUNCTION(FunctionTable_SetActiveVariable, SetActiveVariable);513ADD_RSDK_FUNCTION(FunctionTable_AddEnumVariable, AddEnumVariable);514515// Printing (Rev01)516#if !RETRO_REV02517ADD_RSDK_FUNCTION(FunctionTable_PrintMessage, PrintMessage);518#endif519520// Debugging521#if RETRO_REV02522ADD_RSDK_FUNCTION(FunctionTable_ClearDebugValues, ClearViewableVariables);523ADD_RSDK_FUNCTION(FunctionTable_SetDebugValue, AddViewableVariable);524#endif525526// v5U Extras527#if RETRO_REV0U528ADD_RSDK_FUNCTION(FunctionTable_NotifyCallback, NULL);529ADD_RSDK_FUNCTION(FunctionTable_SetGameFinished, SetGameFinished);530ADD_RSDK_FUNCTION(FunctionTable_StopAllSfx, StopAllSfx);531#endif532533#if RETRO_USE_MOD_LOADER534InitModAPI();535#endif536}537538#if RETRO_REV02539void RSDK::LinkGameLogic(void *info) { PrintLog(PRINT_POPUP, "Internal LinkGameLogic() function called, no logic will be linked"); }540#else541void RSDK::LinkGameLogic(EngineInfo info) { PrintLog(PRINT_POPUP, "Internal LinkGameLogic() function called, no logic will be linked"); }542#endif543544#if RETRO_PLATFORM == RETRO_SWITCH545546Result RSDK::Link::err = 0;547548RSDK::Link::Handle RSDK::Link::dlopen(const char *path, int _flags)549{550auto mod = new DynModule();551552err = dynLoadNroModule(mod, path, false);553if (R_FAILED(err)) {554return nullptr;555}556557return mod;558}559560void *RSDK::Link::dlsym(RSDK::Link::Handle mod, const char *name)561{562void *sym = NULL;563err = dynModuleLookupSymbol(mod, name, &sym);564if (R_FAILED(err)) {565return nullptr;566}567568return sym;569}570571int RSDK::Link::dlclose(RSDK::Link::Handle mod) { dynModuleUnload(mod); return 0; }572573char *RSDK::Link::dlerror() { return nullptr; }574575#endif576577578