mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-02-02 16:23:57 +03:00
Fixed all remaining compilation issues
This commit is contained in:
parent
4c37fa4369
commit
69cfe9b2c4
@ -34,7 +34,7 @@ set(VCPKG_TARGET_TRIPLET x64-mingw-static)
|
||||
endif()
|
||||
|
||||
vcpkg_bootstrap()
|
||||
vcpkg_install_packages(fontconfig sdl2 zlib bzip2 libzip libpng getopt dirent libusb pthread glew glfw3)
|
||||
vcpkg_install_packages(fontconfig sdl2 zlib bzip2 libzip libpng getopt dirent libusb pthread glew glfw3 nlohmann-json tinyxml2 spdlog)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
@ -111,7 +111,7 @@ file(GLOB_RECURSE ALL_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
# Exclude specific files from the ALL_FILES list
|
||||
list(FILTER ALL_FILES EXCLUDE REGEX ".*.inc.c")
|
||||
|
||||
list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_A4290_colheaders.c")
|
||||
list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_colheaders.c")
|
||||
list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_edata_info.c")
|
||||
list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_rcp_setup.c")
|
||||
list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_load_inits.c")
|
||||
|
@ -34,7 +34,7 @@
|
||||
G_TX_RENDERTILE, 0, cmt, maskt, shiftt, cms, masks, shifts); \
|
||||
gDPSetTileSize(pkt, G_TX_RENDERTILE, dw, dh, \
|
||||
((width)-1) << G_TEXTURE_IMAGE_FRAC, \
|
||||
((height)-1) << G_TEXTURE_IMAGE_FRAC) \
|
||||
((height)-1) << G_TEXTURE_IMAGE_FRAC); \
|
||||
}
|
||||
|
||||
#define gsDPSetupTile(fmt, siz, width, height, dw, dh, \
|
||||
@ -83,10 +83,6 @@ typedef enum WipeMode {
|
||||
WIPE_VERTICAL,
|
||||
} WipeMode;
|
||||
|
||||
typedef struct {
|
||||
u8 r, g, b;
|
||||
} Color_RGB8; // size = 0x3
|
||||
|
||||
typedef struct Color_RGBA32 {
|
||||
u8 r, g, b, a;
|
||||
} Color_RGBA32; // size = 0x4
|
||||
|
@ -23,6 +23,7 @@ typedef enum OverlayCalls {
|
||||
/* 110 */ OVLCALL_UNKMAP_DRAW,
|
||||
} OverlayCalls;
|
||||
|
||||
#include "sf64context.h"
|
||||
#include "sf64audio_external.h"
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
* state. Two presets (map and main menu) are provided.
|
||||
* For the full list of game states, see sf64thread.h.
|
||||
*/
|
||||
// #define MODS_BOOT_STATE 3 // main menu
|
||||
#define MODS_BOOT_STATE 3 // main menu
|
||||
// #define MODS_BOOT_STATE 4 // map
|
||||
|
||||
/**
|
||||
@ -25,8 +25,8 @@
|
||||
* Use the D-Pad to select a level. Press L to start in
|
||||
* an advanced level phase (warp zone or Andross fight).
|
||||
* Useful for debugging and speedrunning training.
|
||||
*/
|
||||
#define MODS_LEVEL_SELECT 0
|
||||
*/
|
||||
#define MODS_LEVEL_SELECT 1
|
||||
|
||||
/**
|
||||
* Sound Effects Jukebox:
|
||||
@ -45,13 +45,13 @@
|
||||
|
||||
/**
|
||||
* FPS Counter:
|
||||
* Hold Z + R and press L to toggle FPS Display
|
||||
*/
|
||||
#define MODS_FPS_COUNTER 0
|
||||
* Press L to toggle FPS Display
|
||||
*/
|
||||
#define MODS_FPS_COUNTER 1
|
||||
|
||||
/**
|
||||
* RAM modifier:
|
||||
* Hold Z + R and press C> to cycle modes
|
||||
* Press C> while paused to cycle modes
|
||||
*
|
||||
* Cheats:
|
||||
* Use D-Pad up and down to select a cheat
|
||||
|
@ -703,7 +703,7 @@ typedef struct {
|
||||
/* 0x02 */ s8 sampleBankId;
|
||||
/* 0x03 */ char unk_03[0x5];
|
||||
/* 0x08 */ u8* allocatedAddr;
|
||||
/* 0x0C */ uintptr_t sampleAddr;
|
||||
/* 0x0C */ void* sampleAddr;
|
||||
/* 0x10 */ u32 size;
|
||||
} SampleCacheEntry; // size = 0x14
|
||||
|
||||
@ -844,7 +844,7 @@ typedef struct {
|
||||
|
||||
typedef struct SampleDma {
|
||||
/* 0x00 */ u8* ramAddr;
|
||||
/* 0x04 */ uintptr_t devAddr;
|
||||
/* 0x04 */ u32 devAddr;
|
||||
/* 0x08 */ u16 sizeUnused;
|
||||
/* 0x0A */ u16 size;
|
||||
/* 0x0C */ u8 unused;
|
||||
@ -1040,8 +1040,8 @@ uintptr_t AudioHeap_SearchCaches(s32 tableType, s32 cache, s32 id);
|
||||
s32 AudioHeap_ResetStep(void);
|
||||
void* AudioHeap_SearchPermanentCache(s32 tableType, s32 id);
|
||||
u8* AudioHeap_AllocPermanent(s32 tableType, s32 id, u32 size);
|
||||
void* AudioHeap_AllocTemporarySampleCache(s32 size, s32 fontId, uintptr_t sampleAddr, s8 medium);
|
||||
void* AudioHeap_AllocPersistentSampleCache(s32 size, s32 fontId, uintptr_t sampleAddr, s8 medium);
|
||||
void* AudioHeap_AllocTemporarySampleCache(s32 size, s32 fontId, s32 sampleAddr, s8 medium);
|
||||
void* AudioHeap_AllocPersistentSampleCache(s32 size, s32 fontId, s32 sampleAddr, s8 medium);
|
||||
|
||||
// audio_load
|
||||
void AudioLoad_DecreaseSampleDmaTtls(void);
|
||||
|
@ -724,7 +724,7 @@ s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, u32 devAddr, void
|
||||
handle = osCartRomInit();
|
||||
break;
|
||||
case MEDIUM_DISK_DRIVE:
|
||||
handle = osDriveRomInit();
|
||||
// handle = osDriveRomInit();
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
|
@ -44,7 +44,7 @@ s32 Message_GetCharCount(u16* msgPtr) {
|
||||
s32 count = 0;
|
||||
u16* msgChar = LOAD_ASSET(msgPtr);
|
||||
|
||||
if (CVarGetInteger("gLevelSelector", 0) && gCurrentPlanet == 6) {
|
||||
if (CVarGetInteger("gLevelSelector", 0) && gCurrentLevel == 6) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ Vtx D_Vtx_800DAC80[] = {
|
||||
Gfx D_Gfx_800DACA0[] = {
|
||||
// unused
|
||||
gsSPVertex(D_Vtx_800DAC80, 2, 0),
|
||||
gsSPLine3D(0, 1, 0),
|
||||
// gsSPLine3D(0, 1, 0),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
static OSTime gLastOSTime = 0;
|
||||
static float gFrameTime = 0.0f;
|
||||
static u16 gFrames = 0;
|
||||
static u16 gFPS = 0;
|
||||
u16 gFPS = 0;
|
||||
static u8 gRenderFPS = false;
|
||||
|
||||
static void CalculateFrameTimeFromOSTime(OSTime diff) {
|
||||
@ -29,20 +29,20 @@ static void Play_RenderFps(void) {
|
||||
gRenderFPS ^= 1;
|
||||
}
|
||||
if (gRenderFPS) {
|
||||
OSTime newTime = osGetTime();
|
||||
CalculateFrameTimeFromOSTime(newTime - gLastOSTime);
|
||||
// If frame time is longer or equal to a second, update FPS counter.
|
||||
if (gFrameTime >= 1.0f) {
|
||||
gFPS = gFrames;
|
||||
gFrames = 0;
|
||||
gFrameTime -= 1.0f;
|
||||
}
|
||||
// OSTime newTime = osGetTime();
|
||||
// CalculateFrameTimeFromOSTime(newTime - gLastOSTime);
|
||||
// // If frame time is longer or equal to a second, update FPS counter.
|
||||
// if (gFrameTime >= 1.0f) {
|
||||
// gFPS = gFrames;
|
||||
// gFrames = 0;
|
||||
// gFrameTime -= 1.0f;
|
||||
// }
|
||||
|
||||
/* Draw */
|
||||
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
|
||||
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255);
|
||||
Graphics_DisplaySmallText(FPS_COUNTER_X_POS, FPS_COUNTER_Y_POS, 1.0f, 1.0f, "FPS:");
|
||||
Graphics_DisplaySmallNumber(FPS_COUNTER_X_POS + 35, FPS_COUNTER_Y_POS, gFPS);
|
||||
gLastOSTime = newTime;
|
||||
// gLastOSTime = newTime;
|
||||
}
|
||||
}
|
||||
|
@ -2838,7 +2838,11 @@ void Title_StarfoxLogo_Draw(void) {
|
||||
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
|
||||
|
||||
// LTodo: Validate this
|
||||
<<<<<<< HEAD
|
||||
Lib_TextureRect_RGBA16(&gMasterDisp, aTitleStarfoxLogoTex, 236, 60, sTitleStarfoxLogoXpos, sTitleStarfoxLogoYpos, 1.0f, 1.0f);
|
||||
=======
|
||||
TextureRect_RGBA16(&gMasterDisp, gTitleStarfoxLogo, 236, 60, D_menu_801B9054, D_menu_801B9058, 1.0f, 1.0f);
|
||||
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
|
||||
}
|
||||
|
||||
void Title_64Logo_Draw(void) {
|
||||
@ -2884,21 +2888,36 @@ void Title_PressStart_Draw(void) {
|
||||
RCP_SetupDL(&gMasterDisp, SETUPDL_85);
|
||||
gDPSetPrimColor(gMasterDisp++, 0, 0, 60, 60, 255, 200);
|
||||
|
||||
<<<<<<< HEAD
|
||||
Lib_TextureRect_CI8(&gMasterDisp, aNoControllerBgTex, aNoControllerBgTLUT, 32, 32, sNoControllerBgXpos,
|
||||
sNoControllerBgYpos, sNoControllerBgXscale, sNoControllerBgYscale);
|
||||
|
||||
// No Controller
|
||||
=======
|
||||
TextureRect_CI8(&gMasterDisp, D_TITLE_601D750, D_TITLE_601DB50, 32, 32, D_menu_801AE464, D_menu_801AE468,
|
||||
D_menu_801AE46C, D_menu_801AE470);
|
||||
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
|
||||
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
|
||||
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, (s32) sTitleTextPrimCol, (s32) sTitleTextPrimCol, 255);
|
||||
|
||||
<<<<<<< HEAD
|
||||
Lib_TextureRect_IA8(&gMasterDisp, aTitleNoControllerTex, 176, 24, D_menu_801AE474,
|
||||
D_menu_801AE478, 1.0f, 1.0f);
|
||||
=======
|
||||
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, (s32) D_menu_801B7BC8, (s32) D_menu_801B7BC8, 255);
|
||||
|
||||
TextureRect_IA8(&gMasterDisp, gTitleNoController, 176, 24, D_menu_801AE474, D_menu_801AE478, 1.0f, 1.0f);
|
||||
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
|
||||
} else {
|
||||
// Press Start
|
||||
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
|
||||
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, (s32) sTitleTextPrimCol, (s32) sTitleTextPrimCol, 255);
|
||||
|
||||
<<<<<<< HEAD
|
||||
Lib_TextureRect_IA8(&gMasterDisp, aTitlePressStartTex, 120, 13, 101.0f, yPos, 1.0f, 1.0f);
|
||||
=======
|
||||
TextureRect_IA8(&gMasterDisp, gTitlePressStart, 120, 13, 101.0f, temp2, 1.0f, 1.0f);
|
||||
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2909,7 +2928,11 @@ void Title_Copyright_Draw(void) {
|
||||
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
|
||||
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
|
||||
|
||||
<<<<<<< HEAD
|
||||
Lib_TextureRect_IA8(&gMasterDisp, a1997NintendoTex, 120, 12, 102.0f, 209.0f, 1.0f, 1.0f);
|
||||
=======
|
||||
TextureRect_IA8(&gMasterDisp, gTitleNintendoCopyright, 120, 12, 102.0f, 209.0f, 1.0f, 1.0f);
|
||||
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
|
||||
}
|
||||
|
||||
void Title_TeamName_Draw(void) {
|
||||
@ -2938,11 +2961,19 @@ void Title_TeamName_Draw(void) {
|
||||
break;
|
||||
|
||||
case 2:
|
||||
<<<<<<< HEAD
|
||||
Lib_TextureRect_IA8(&gMasterDisp, gTitleFalcoCard, 176, 13, temp_fs2, temp, 1.0f, 1.0f);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Lib_TextureRect_IA8(&gMasterDisp, gTitleFoxCard, 176, 13, temp_fs2, temp, 1.0f, 1.0f);
|
||||
=======
|
||||
TextureRect_IA8(&gMasterDisp, gTitleFalcoCard, 176, 13, temp_fs2, temp, 1.0f, 1.0f);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
TextureRect_IA8(&gMasterDisp, gTitleFoxCard, 176, 13, temp_fs2, temp, 1.0f, 1.0f);
|
||||
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2984,7 +3015,11 @@ void Title_SunGlare_Draw(void) {
|
||||
gDPSetColorDither(gMasterDisp++, G_CD_NOISE);
|
||||
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, D_menu_801B7BD0);
|
||||
|
||||
<<<<<<< HEAD
|
||||
Lib_TextureRect_RGBA16(&gMasterDisp, aTitleSunGlareTex, 32, 32, D_menu_801B9080, D_menu_801B9084, D_menu_801B7BB0,
|
||||
=======
|
||||
TextureRect_RGBA16(&gMasterDisp, gTitleSunBeam, 32, 32, D_menu_801B9080, D_menu_801B9084, D_menu_801B7BB0,
|
||||
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
|
||||
D_menu_801B7BB4);
|
||||
D_menu_801B9080 += 1.66f;
|
||||
}
|
||||
@ -3107,11 +3142,19 @@ void Title_Logos_Draw(void) {
|
||||
Lib_TextureRect_CI4(&gMasterDisp, aIntroInTex, aIntroInTLUT, 32, 13, 150.0f, 110.0f, 1.0f, 1.0f);
|
||||
break;
|
||||
|
||||
<<<<<<< HEAD
|
||||
case TITLE_LOGO_NINTENDO_64:
|
||||
RCP_SetupDL(&gMasterDisp, 0x53);
|
||||
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, (s32) sStarfoxLogoAlpha);
|
||||
TextureRect_16bRGBA(&gMasterDisp, aTitleN64LogoTex, 128, 88, D_menu_801B9070,
|
||||
D_menu_801B9074, D_menu_801B9078, D_menu_801B907C);
|
||||
=======
|
||||
case 1:
|
||||
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
|
||||
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, (s32) D_menu_801B7BDC);
|
||||
TextureRect_RGBA16(&gMasterDisp, gTitleNintendo64Logo, 128, 88, D_menu_801B9070, D_menu_801B9074,
|
||||
D_menu_801B9078, D_menu_801B907C);
|
||||
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
|
||||
|
||||
case TITLE_LOGO_NONE:
|
||||
break;
|
||||
@ -3181,8 +3224,12 @@ void Title_TitleCard_Draw(void) {
|
||||
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
|
||||
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
|
||||
|
||||
<<<<<<< HEAD
|
||||
Lib_TextureRect_IA8(&gMasterDisp, aTitleArwingCardTex, 112, 26, sTitleArwingCardXpos,
|
||||
sTitleArwingCardYpos, 1.0f, 1.0f);
|
||||
=======
|
||||
TextureRect_IA8(&gMasterDisp, gTitleArwingCard, 112, 26, D_menu_801AE564, D_menu_801AE568, 1.0f, 1.0f);
|
||||
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "Engine.h"
|
||||
#include "ui/ImguiUI.h"
|
||||
#include "ZAPDUtils/Utils/StringHelper.h"
|
||||
#include "StringHelper.h"
|
||||
#include "libultraship/src/Context.h"
|
||||
#include "resource/type/ResourceType.h"
|
||||
#include "resource/importers/AnimFactory.h"
|
||||
@ -17,6 +17,13 @@
|
||||
#include "resource/importers/SkeletonFactory.h"
|
||||
#include "resource/importers/Vec3fFactory.h"
|
||||
#include "resource/importers/Vec3sFactory.h"
|
||||
#include <Fast3D/Fast3dWindow.h>
|
||||
#include <DisplayListFactory.h>
|
||||
#include <TextureFactory.h>
|
||||
#include <MatrixFactory.h>
|
||||
#include <ArrayFactory.h>
|
||||
#include <BlobFactory.h>
|
||||
#include <VertexFactory.h>
|
||||
|
||||
#include <Fast3D/gfx_pc.h>
|
||||
#include <Fast3D/gfx_rendering_api.h>
|
||||
@ -25,6 +32,7 @@
|
||||
#include <utility>
|
||||
|
||||
extern "C" {
|
||||
extern uint16_t gFPS;
|
||||
float gInterpolationStep = 0.0f;
|
||||
#include <sf64thread.h>
|
||||
#include <macros.h>
|
||||
@ -34,13 +42,13 @@ GameEngine* GameEngine::Instance;
|
||||
|
||||
GameEngine::GameEngine() {
|
||||
std::vector<std::string> OTRFiles;
|
||||
if (const std::string cube_path = LUS::Context::GetPathRelativeToAppDirectory("sp.otr"); std::filesystem::exists(cube_path)) {
|
||||
if (const std::string cube_path = Ship::Context::GetPathRelativeToAppDirectory("starship.otr"); std::filesystem::exists(cube_path)) {
|
||||
OTRFiles.push_back(cube_path);
|
||||
}
|
||||
if (const std::string sm64_otr_path = LUS::Context::GetPathRelativeToAppBundle("sm64.otr"); std::filesystem::exists(sm64_otr_path)) {
|
||||
if (const std::string sm64_otr_path = Ship::Context::GetPathRelativeToAppBundle("sm64.otr"); std::filesystem::exists(sm64_otr_path)) {
|
||||
OTRFiles.push_back(sm64_otr_path);
|
||||
}
|
||||
if (const std::string patches_path = LUS::Context::GetPathRelativeToAppDirectory("mods"); !patches_path.empty() && std::filesystem::exists(patches_path)) {
|
||||
if (const std::string patches_path = Ship::Context::GetPathRelativeToAppDirectory("mods"); !patches_path.empty() && std::filesystem::exists(patches_path)) {
|
||||
if (std::filesystem::is_directory(patches_path)) {
|
||||
for (const auto&p: std::filesystem::recursive_directory_iterator(patches_path)) {
|
||||
if (StringHelper::IEquals(p.path().extension().string(), ".otr")) {
|
||||
@ -50,7 +58,7 @@ GameEngine::GameEngine() {
|
||||
}
|
||||
}
|
||||
|
||||
this->context = LUS::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3);
|
||||
this->context = Ship::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3);
|
||||
|
||||
auto loader = context->GetResourceManager()->GetResourceLoader();
|
||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryAnimV0>(), RESOURCE_FORMAT_BINARY, "Animation", static_cast<uint32_t>(SF64::ResourceType::AnimData), 0);
|
||||
@ -58,7 +66,7 @@ GameEngine::GameEngine() {
|
||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryLimbV0>(), RESOURCE_FORMAT_BINARY, "Limb", static_cast<uint32_t>(SF64::ResourceType::Limb), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryMessageV0>(), RESOURCE_FORMAT_BINARY, "Message", static_cast<uint32_t>(SF64::ResourceType::Message), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryMessageLookupV0>(), RESOURCE_FORMAT_BINARY, "MessageTable", static_cast<uint32_t>(SF64::ResourceType::MessageTable), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryEnvSettingsV0>(), RESOURCE_FORMAT_BINARY, "EnvSettings", static_cast<uint32_t>(SF64::ResourceType::EnvSettings), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryEnvSettingsV0>(), RESOURCE_FORMAT_BINARY, "EnvSettings", static_cast<uint32_t>(SF64::ResourceType::Environment), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryObjectInitV0>(), RESOURCE_FORMAT_BINARY, "ObjectInit", static_cast<uint32_t>(SF64::ResourceType::ObjectInit), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryHitboxV0>(), RESOURCE_FORMAT_BINARY, "Hitbox", static_cast<uint32_t>(SF64::ResourceType::Hitbox), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryScriptV0>(), RESOURCE_FORMAT_BINARY, "Script", static_cast<uint32_t>(SF64::ResourceType::Script), 0);
|
||||
@ -67,6 +75,13 @@ GameEngine::GameEngine() {
|
||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryVec3fV0>(), RESOURCE_FORMAT_BINARY, "Vec3f", static_cast<uint32_t>(SF64::ResourceType::Vec3f), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryVec3sV0>(), RESOURCE_FORMAT_BINARY, "Vec3s", static_cast<uint32_t>(SF64::ResourceType::Vec3s), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryGenericArrayV0>(), RESOURCE_FORMAT_BINARY, "GenericArray", static_cast<uint32_t>(SF64::ResourceType::GenericArray), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryTextureV0>(), RESOURCE_FORMAT_BINARY, "Texture", static_cast<uint32_t>(LUS::ResourceType::Texture), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryTextureV1>(), RESOURCE_FORMAT_BINARY, "Texture", static_cast<uint32_t>(LUS::ResourceType::Texture), 1);
|
||||
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryVertexV0>(), RESOURCE_FORMAT_BINARY, "Vertex", static_cast<uint32_t>(LUS::ResourceType::Vertex), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryDisplayListV0>(), RESOURCE_FORMAT_BINARY, "DisplayList", static_cast<uint32_t>(LUS::ResourceType::DisplayList), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryMatrixV0>(), RESOURCE_FORMAT_BINARY, "Matrix", static_cast<uint32_t>(LUS::ResourceType::Matrix), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryArrayV0>(), RESOURCE_FORMAT_BINARY, "Array", static_cast<uint32_t>(LUS::ResourceType::Array), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryBlobV0>(), RESOURCE_FORMAT_BINARY, "Blob", static_cast<uint32_t>(LUS::ResourceType::Blob), 0);
|
||||
}
|
||||
|
||||
void GameEngine::Create(){
|
||||
@ -84,7 +99,7 @@ void GameEngine::Destroy(){
|
||||
bool ShouldClearTextureCacheAtEndOfFrame = false;
|
||||
|
||||
void GameEngine::StartFrame() const{
|
||||
using LUS::KbScancode;
|
||||
using Ship::KbScancode;
|
||||
const int32_t dwScancode = this->context->GetWindow()->GetLastScancode();
|
||||
this->context->GetWindow()->SetLastScancode(-1);
|
||||
|
||||
@ -100,10 +115,6 @@ void GameEngine::StartFrame() const{
|
||||
this->context->GetWindow()->StartFrame();
|
||||
}
|
||||
|
||||
void GameEngine::ProcessFrame(void (*run_one_game_iter)()) const {
|
||||
this->context->GetWindow()->MainLoop(run_one_game_iter);
|
||||
}
|
||||
|
||||
void GameEngine::RunCommands(Gfx* Commands) {
|
||||
gfx_run(Commands, {});
|
||||
gfx_end_frame();
|
||||
@ -115,13 +126,22 @@ void GameEngine::RunCommands(Gfx* Commands) {
|
||||
}
|
||||
|
||||
void GameEngine::ProcessGfxCommands(Gfx* commands) {
|
||||
auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
|
||||
|
||||
if (wnd == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
gFPS = 30;
|
||||
wnd->SetRendererUCode(UcodeHandlers::ucode_f3dex);
|
||||
wnd->SetTargetFps(30);
|
||||
wnd->SetMaximumFrameLatency(1);
|
||||
|
||||
RunCommands(commands);
|
||||
Instance->context->GetWindow()->SetTargetFps(30);
|
||||
Instance->context->GetWindow()->SetMaximumFrameLatency(1);
|
||||
}
|
||||
|
||||
extern "C" uint32_t GameEngine_GetSampleRate() {
|
||||
auto player = LUS::Context::GetInstance()->GetAudio()->GetAudioPlayer();
|
||||
auto player = Ship::Context::GetInstance()->GetAudio()->GetAudioPlayer();
|
||||
if (player == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class GameEngine {
|
||||
public:
|
||||
static GameEngine* Instance;
|
||||
|
||||
std::shared_ptr<LUS::Context> context;
|
||||
std::shared_ptr<Ship::Context> context;
|
||||
|
||||
GameEngine();
|
||||
static void Create();
|
||||
|
@ -10,12 +10,12 @@ extern "C" void gSPDisplayList(Gfx* pkt, Gfx* dl) {
|
||||
char* imgData = (char*)dl;
|
||||
|
||||
if (GameEngine_OTRSigCheck(imgData) == 1) {
|
||||
auto resource = LUS::Context::GetInstance()->GetResourceManager()->LoadResource(imgData);
|
||||
auto resource = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(imgData);
|
||||
auto res = std::static_pointer_cast<LUS::DisplayList>(resource);
|
||||
dl = &res->Instructions[0];
|
||||
dl->words.trace.file = imgData;
|
||||
dl->words.trace.idx = 0;
|
||||
dl->words.trace.valid = true;
|
||||
// dl->words.trace.file = imgData;
|
||||
// dl->words.trace.idx = 0;
|
||||
// dl->words.trace.valid = true;
|
||||
}
|
||||
|
||||
__gSPDisplayList(pkt, dl);
|
||||
@ -34,7 +34,7 @@ extern "C" void gSPInvalidateTexCache(Gfx* pkt, uintptr_t texAddr) {
|
||||
auto data = reinterpret_cast<char*>(texAddr);
|
||||
|
||||
if (texAddr != 0 && GameEngine_OTRSigCheck(data)) {
|
||||
const auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResource(data);
|
||||
const auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(data);
|
||||
const auto type = static_cast<LUS::ResourceType>(res->GetInitData()->Type);
|
||||
|
||||
switch(type) {
|
||||
|
@ -41,7 +41,9 @@ int main(int argc, char *argv[]) {
|
||||
Lib_FillScreen(1);
|
||||
Main_Initialize();
|
||||
Main_ThreadEntry(NULL);
|
||||
GameEngine::Instance->ProcessFrame(push_frame);
|
||||
while (WindowIsRunning()) {
|
||||
push_frame();
|
||||
}
|
||||
GameEngine::Instance->Destroy();
|
||||
return 0;
|
||||
}
|
@ -3,13 +3,13 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace SF64 {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAnimV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryAnimV0::ReadResource(std::shared_ptr<Ship::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto anim = std::make_shared<Animation>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
||||
|
||||
int16_t frameCount = reader->ReadInt16();
|
||||
int16_t limbCount = reader->ReadInt16();
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SF64 {
|
||||
class ResourceFactoryBinaryAnimV0 : public LUS::ResourceFactoryBinary {
|
||||
class ResourceFactoryBinaryAnimV0 : public Ship::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -3,13 +3,13 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace SF64 {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryColPolyV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryColPolyV0::ReadResource(std::shared_ptr<Ship::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto colPoly = std::make_shared<ColPoly>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
||||
|
||||
auto colPolysCount = reader->ReadUInt32();
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SF64 {
|
||||
class ResourceFactoryBinaryColPolyV0 : public LUS::ResourceFactoryBinary {
|
||||
class ResourceFactoryBinaryColPolyV0 : public Ship::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -6,13 +6,13 @@
|
||||
|
||||
namespace SF64 {
|
||||
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryEnvSettingsV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryEnvSettingsV0::ReadResource(std::shared_ptr<Ship::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto env = std::make_shared<EnvSettings>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
||||
|
||||
env->mSettings.type = reader->ReadInt32();
|
||||
env->mSettings.unk_04 = reader->ReadInt32();
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SF64 {
|
||||
class ResourceFactoryBinaryEnvSettingsV0 : public LUS::ResourceFactoryBinary {
|
||||
class ResourceFactoryBinaryEnvSettingsV0 : public Ship::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -3,13 +3,13 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace SF64 {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryGenericArrayV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryGenericArrayV0::ReadResource(std::shared_ptr<Ship::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto arr = std::make_shared<GenericArray>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
||||
|
||||
auto type = reader->ReadUInt32();
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SF64 {
|
||||
class ResourceFactoryBinaryGenericArrayV0 : public LUS::ResourceFactoryBinary {
|
||||
class ResourceFactoryBinaryGenericArrayV0 : public Ship::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -3,13 +3,13 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace SF64 {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryHitboxV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryHitboxV0::ReadResource(std::shared_ptr<Ship::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto hitbox = std::make_shared<Hitbox>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
||||
|
||||
auto count = reader->ReadUInt32();
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SF64 {
|
||||
class ResourceFactoryBinaryHitboxV0 : public LUS::ResourceFactoryBinary {
|
||||
class ResourceFactoryBinaryHitboxV0 : public Ship::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -7,15 +7,16 @@
|
||||
|
||||
namespace SF64 {
|
||||
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryLimbV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryLimbV0::ReadResource(std::shared_ptr<Ship::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto limb = std::make_shared<Limb>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
||||
|
||||
limb->mData.dList = LoadChild<Gfx*>(reader->ReadUInt64());
|
||||
uint64_t dlist = reader->ReadUInt64();
|
||||
limb->mData.dList = LoadChild<Gfx*>(dlist);
|
||||
limb->mData.trans.x = reader->ReadFloat();
|
||||
limb->mData.trans.y = reader->ReadFloat();
|
||||
limb->mData.trans.z = reader->ReadFloat();
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SF64 {
|
||||
class ResourceFactoryBinaryLimbV0 : public LUS::ResourceFactoryBinary {
|
||||
class ResourceFactoryBinaryLimbV0 : public Ship::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -3,13 +3,13 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace SF64 {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryMessageV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryMessageV0::ReadResource(std::shared_ptr<Ship::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto msg = std::make_shared<Message>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
||||
|
||||
auto size = reader->ReadUInt32();
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SF64 {
|
||||
class ResourceFactoryBinaryMessageV0 : public LUS::ResourceFactoryBinary {
|
||||
class ResourceFactoryBinaryMessageV0 : public Ship::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -5,13 +5,13 @@
|
||||
#include "ResourceUtil.h"
|
||||
|
||||
namespace SF64 {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryMessageLookupV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryMessageLookupV0::ReadResource(std::shared_ptr<Ship::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto table = std::make_shared<MessageLookup>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
||||
auto count = reader->ReadUInt32();
|
||||
|
||||
for (uint32_t i = 0; i < count - 1; i++) {
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SF64 {
|
||||
class ResourceFactoryBinaryMessageLookupV0 : public LUS::ResourceFactoryBinary {
|
||||
class ResourceFactoryBinaryMessageLookupV0 : public Ship::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -6,13 +6,13 @@
|
||||
|
||||
namespace SF64 {
|
||||
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryObjectInitV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryObjectInitV0::ReadResource(std::shared_ptr<Ship::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto obj = std::make_shared<ObjectInit>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
||||
auto count = reader->ReadUInt32();
|
||||
|
||||
for(size_t i = 0; i < count; i++) {
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SF64 {
|
||||
class ResourceFactoryBinaryObjectInitV0 : public LUS::ResourceFactoryBinary {
|
||||
class ResourceFactoryBinaryObjectInitV0 : public Ship::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -5,11 +5,14 @@
|
||||
|
||||
namespace SF64 {
|
||||
template <typename T> T LoadChild(uint64_t crc) {
|
||||
if (crc == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
auto path = ResourceGetNameByCrc(crc);
|
||||
if (path == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
auto asset = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(path);
|
||||
auto asset = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(path);
|
||||
return asset ? static_cast<T>(asset->GetRawPointer()) : nullptr;
|
||||
}
|
||||
}
|
@ -4,13 +4,13 @@
|
||||
#include "ResourceUtil.h"
|
||||
|
||||
namespace SF64 {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryScriptCMDV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryScriptCMDV0::ReadResource(std::shared_ptr<Ship::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto cmds = std::make_shared<ScriptCMDs>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
||||
|
||||
auto size = reader->ReadUInt32();
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SF64 {
|
||||
class ResourceFactoryBinaryScriptCMDV0 : public LUS::ResourceFactoryBinary {
|
||||
class ResourceFactoryBinaryScriptCMDV0 : public Ship::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -4,13 +4,13 @@
|
||||
#include "ResourceUtil.h"
|
||||
|
||||
namespace SF64 {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryScriptV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryScriptV0::ReadResource(std::shared_ptr<Ship::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto script = std::make_shared<Script>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
||||
|
||||
auto size = reader->ReadUInt32();
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SF64 {
|
||||
class ResourceFactoryBinaryScriptV0 : public LUS::ResourceFactoryBinary {
|
||||
class ResourceFactoryBinaryScriptV0 : public Ship::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -5,13 +5,13 @@
|
||||
#include "ResourceUtil.h"
|
||||
|
||||
namespace SF64 {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinarySkeletonV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
std::shared_ptr<Ship::IResource> ResourceFactoryBinarySkeletonV0::ReadResource(std::shared_ptr<Ship::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto skel = std::make_shared<Skeleton>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
||||
|
||||
auto count = reader->ReadUInt32();
|
||||
for(size_t i = 0; i < count; i++) {
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SF64 {
|
||||
class ResourceFactoryBinarySkeletonV0 : public LUS::ResourceFactoryBinary {
|
||||
class ResourceFactoryBinarySkeletonV0 : public Ship::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -3,13 +3,13 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace SF64 {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryVec3fV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryVec3fV0::ReadResource(std::shared_ptr<Ship::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto vec = std::make_shared<Vec3fArray>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
||||
|
||||
auto vecCount = reader->ReadUInt32();
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SF64 {
|
||||
class ResourceFactoryBinaryVec3fV0 : public LUS::ResourceFactoryBinary {
|
||||
class ResourceFactoryBinaryVec3fV0 : public Ship::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -3,13 +3,13 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace SF64 {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryVec3sV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryVec3sV0::ReadResource(std::shared_ptr<Ship::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto vec = std::make_shared<Vec3sArray>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
|
||||
|
||||
auto vecCount = reader->ReadUInt32();
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SF64 {
|
||||
class ResourceFactoryBinaryVec3sV0 : public LUS::ResourceFactoryBinary {
|
||||
class ResourceFactoryBinaryVec3sV0 : public Ship::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
@ -21,11 +21,11 @@ struct AnimationData {
|
||||
/* 0x08 */ JointKey* jointKey;
|
||||
}; // size = 0xC
|
||||
|
||||
class Animation : public LUS::Resource<AnimationData> {
|
||||
class Animation : public Ship::Resource<AnimationData> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
Animation() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
Animation() : Resource(std::shared_ptr<Ship::ResourceInitData>()) {}
|
||||
|
||||
AnimationData* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -19,11 +19,11 @@ struct ColPolyData {
|
||||
ColPolyData(Vec3s tri, int16_t unk_06, Vec3s norm, int16_t unk_0E, int32_t dist) : tri(std::move(tri)), unk_06(unk_06), norm(std::move(norm)), unk_0E(unk_0E), dist(dist) {}
|
||||
}; // size = 0x14
|
||||
|
||||
class ColPoly : public LUS::Resource<ColPolyData> {
|
||||
class ColPoly : public Ship::Resource<ColPolyData> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
ColPoly() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
ColPoly() : Resource(std::shared_ptr<Ship::ResourceInitData>()) {}
|
||||
|
||||
ColPolyData* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -26,11 +26,11 @@ struct EnvSettingsData {
|
||||
/* 0x40 */ int32_t ambB;
|
||||
};
|
||||
|
||||
class EnvSettings : public LUS::Resource<EnvSettingsData> {
|
||||
class EnvSettings : public Ship::Resource<EnvSettingsData> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
EnvSettings() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
EnvSettings() : Resource(std::shared_ptr<Ship::ResourceInitData>()) {}
|
||||
|
||||
EnvSettingsData* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -40,11 +40,11 @@ enum class ArrayType {
|
||||
u8, s8, u16, s16, u32, s32, u64, f32, f64, Vec2f, Vec3f, Vec3s, Vec3i, Vec4f, Vec4s,
|
||||
};
|
||||
|
||||
class GenericArray : public LUS::Resource<uint8_t> {
|
||||
class GenericArray : public Ship::Resource<uint8_t> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
GenericArray() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
GenericArray() : Resource(std::shared_ptr<Ship::ResourceInitData>()) {}
|
||||
|
||||
uint8_t* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <Resource.h>
|
||||
|
||||
namespace SF64 {
|
||||
class Hitbox : public LUS::Resource<float> {
|
||||
class Hitbox : public Ship::Resource<float> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
|
@ -23,11 +23,11 @@ struct LimbData {
|
||||
/* 0x01C */ LimbData* child;
|
||||
}; // size = 0x20
|
||||
|
||||
class Limb : public LUS::Resource<LimbData> {
|
||||
class Limb : public Ship::Resource<LimbData> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
Limb() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
Limb() : Resource(std::shared_ptr<Ship::ResourceInitData>()) {}
|
||||
|
||||
LimbData* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -10,7 +10,7 @@ typedef struct {
|
||||
u16* msgPtr;
|
||||
} MsgLookup;
|
||||
|
||||
class Message : public LUS::Resource<void> {
|
||||
class Message : public Ship::Resource<void> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
@ -20,7 +20,7 @@ class Message : public LUS::Resource<void> {
|
||||
std::vector<uint16_t> mMessage;
|
||||
};
|
||||
|
||||
class MessageLookup : public LUS::Resource<MsgLookup> {
|
||||
class MessageLookup : public Ship::Resource<MsgLookup> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
|
@ -16,11 +16,11 @@ struct ObjectInitData {
|
||||
/* 0x10 */ int16_t id;
|
||||
}; // size = 0x14
|
||||
|
||||
class ObjectInit : public LUS::Resource<ObjectInitData> {
|
||||
class ObjectInit : public Ship::Resource<ObjectInitData> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
ObjectInit() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
ObjectInit() : Resource(std::shared_ptr<Ship::ResourceInitData>()) {}
|
||||
|
||||
ObjectInitData* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -5,7 +5,7 @@ enum class ResourceType {
|
||||
// SF64
|
||||
AnimData = 0x414E494D, // ANIM
|
||||
ColPoly = 0x43504C59, // CPLY
|
||||
EnvSettings = 0x454E5653, // ENVS
|
||||
Environment = 0x454E5653, // ENVS
|
||||
Limb = 0x4C494D42, // LIMB
|
||||
Message = 0x4D534720, // MSG
|
||||
MessageTable = 0x4D534754, // MSGT
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <Resource.h>
|
||||
|
||||
namespace SF64 {
|
||||
class Script : public LUS::Resource<uint16_t*> {
|
||||
class Script : public Ship::Resource<uint16_t*> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
@ -14,7 +14,7 @@ class Script : public LUS::Resource<uint16_t*> {
|
||||
std::vector<uint16_t*> mScripts;
|
||||
};
|
||||
|
||||
class ScriptCMDs : public LUS::Resource<uint16_t> {
|
||||
class ScriptCMDs : public Ship::Resource<uint16_t> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
|
@ -5,11 +5,11 @@
|
||||
#include <Resource.h>
|
||||
|
||||
namespace SF64 {
|
||||
class Skeleton : public LUS::Resource<LimbData*> {
|
||||
class Skeleton : public Ship::Resource<LimbData*> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
Skeleton() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
Skeleton() : Resource(std::shared_ptr<Ship::ResourceInitData>()) {}
|
||||
|
||||
LimbData** GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -11,11 +11,11 @@ struct Vec3fData {
|
||||
Vec3fData(float x, float y, float z) : x(x), y(y), z(z) {}
|
||||
};
|
||||
|
||||
class Vec3fArray : public LUS::Resource<Vec3fData> {
|
||||
class Vec3fArray : public Ship::Resource<Vec3fData> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
Vec3fArray() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
Vec3fArray() : Resource(std::shared_ptr<Ship::ResourceInitData>()) {}
|
||||
|
||||
Vec3fData* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -11,11 +11,11 @@ struct Vec3sData {
|
||||
Vec3sData(int16_t x, int16_t y, int16_t z) : x(x), y(y), z(z) {}
|
||||
};
|
||||
|
||||
class Vec3sArray : public LUS::Resource<Vec3sData> {
|
||||
class Vec3sArray : public Ship::Resource<Vec3sData> {
|
||||
public:
|
||||
using Resource::Resource;
|
||||
|
||||
Vec3sArray() : Resource(std::shared_ptr<LUS::ResourceInitData>()) {}
|
||||
Vec3sArray() : Resource(std::shared_ptr<Ship::ResourceInitData>()) {}
|
||||
|
||||
Vec3sData* GetPointer();
|
||||
size_t GetPointerSize();
|
||||
|
@ -3,11 +3,11 @@
|
||||
#include "ResolutionEditor.h"
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <ImGui/imgui.h>
|
||||
#include <imgui.h>
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include "libultraship/src/Context.h"
|
||||
|
||||
#include <ImGui/imgui_internal.h>
|
||||
#include <imgui_internal.h>
|
||||
#include <libultraship/libultraship.h>
|
||||
#include <Fast3D/gfx_pc.h>
|
||||
#include "port/Engine.h"
|
||||
@ -18,14 +18,14 @@ extern "C" {
|
||||
|
||||
namespace GameUI {
|
||||
std::shared_ptr<GameMenuBar> mGameMenuBar;
|
||||
std::shared_ptr<LUS::GuiWindow> mConsoleWindow;
|
||||
std::shared_ptr<LUS::GuiWindow> mStatsWindow;
|
||||
std::shared_ptr<LUS::GuiWindow> mInputEditorWindow;
|
||||
std::shared_ptr<LUS::GuiWindow> mGfxDebuggerWindow;
|
||||
std::shared_ptr<Ship::GuiWindow> mConsoleWindow;
|
||||
std::shared_ptr<Ship::GuiWindow> mStatsWindow;
|
||||
std::shared_ptr<Ship::GuiWindow> mInputEditorWindow;
|
||||
std::shared_ptr<Ship::GuiWindow> mGfxDebuggerWindow;
|
||||
std::shared_ptr<AdvancedResolutionSettings::AdvancedResolutionSettingsWindow> mAdvancedResolutionSettingsWindow;
|
||||
|
||||
void SetupGuiElements() {
|
||||
auto gui = LUS::Context::GetInstance()->GetWindow()->GetGui();
|
||||
auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
|
||||
|
||||
auto& style = ImGui::GetStyle();
|
||||
style.FramePadding = ImVec2(4.0f, 6.0f);
|
||||
@ -112,28 +112,28 @@ void DrawSettingsMenu(){
|
||||
// audio_set_player_volume(SEQ_PLAYER_ENV, CVarGetFloat("gEnvironmentVolume", 1.0f));
|
||||
// }
|
||||
//
|
||||
// static std::unordered_map<LUS::AudioBackend, const char*> audioBackendNames = {
|
||||
// { LUS::AudioBackend::WASAPI, "Windows Audio Session API" },
|
||||
// { LUS::AudioBackend::PULSE, "PulseAudio" },
|
||||
// { LUS::AudioBackend::SDL, "SDL" },
|
||||
// static std::unordered_map<Ship::AudioBackend, const char*> audioBackendNames = {
|
||||
// { Ship::AudioBackend::WASAPI, "Windows Audio Session API" },
|
||||
// { Ship::AudioBackend::PULSE, "PulseAudio" },
|
||||
// { Ship::AudioBackend::SDL, "SDL" },
|
||||
// };
|
||||
//
|
||||
// ImGui::Text("Audio API (Needs reload)");
|
||||
// auto currentAudioBackend = LUS::Context::GetInstance()->GetAudio()->GetAudioBackend();
|
||||
// auto currentAudioBackend = Ship::Context::GetInstance()->GetAudio()->GetAudioBackend();
|
||||
//
|
||||
// if (LUS::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) {
|
||||
// if (Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) {
|
||||
// UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
|
||||
// }
|
||||
// if (ImGui::BeginCombo("##AApi", audioBackendNames[currentAudioBackend])) {
|
||||
// for (uint8_t i = 0; i < LUS::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size(); i++) {
|
||||
// auto backend = LUS::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->data()[i];
|
||||
// for (uint8_t i = 0; i < Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size(); i++) {
|
||||
// auto backend = Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->data()[i];
|
||||
// if (ImGui::Selectable(audioBackendNames[backend], backend == currentAudioBackend)) {
|
||||
// LUS::Context::GetInstance()->GetAudio()->SetAudioBackend(backend);
|
||||
// Ship::Context::GetInstance()->GetAudio()->SetAudioBackend(backend);
|
||||
// }
|
||||
// }
|
||||
// ImGui::EndCombo();
|
||||
// }
|
||||
// if (LUS::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) {
|
||||
// if (Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) {
|
||||
// UIWidgets::ReEnableComponent("");
|
||||
// }
|
||||
//
|
||||
@ -175,23 +175,23 @@ void DrawSettingsMenu(){
|
||||
UIWidgets::Spacer(0);
|
||||
|
||||
// Previously was running every frame, and nothing was setting it? Maybe a bad copy/paste?
|
||||
// LUS::Context::GetInstance()->GetWindow()->SetResolutionMultiplier(CVarGetFloat("gInternalResolution", 1));
|
||||
// Ship::Context::GetInstance()->GetWindow()->SetResolutionMultiplier(CVarGetFloat("gInternalResolution", 1));
|
||||
// UIWidgets::Tooltip("Multiplies your output resolution by the value inputted, as a more intensive but effective form of anti-aliasing");
|
||||
#ifndef __WIIU__
|
||||
if (UIWidgets::CVarSliderInt("MSAA: %d", "gMSAAValue", 1, 8, 1, {
|
||||
.tooltip = "Activates multi-sample anti-aliasing when above 1x up to 8x for 8 samples for every pixel"
|
||||
})) {
|
||||
LUS::Context::GetInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger("gMSAAValue", 1));
|
||||
Ship::Context::GetInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger("gMSAAValue", 1));
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // FPS Slider
|
||||
const int minFps = 30;
|
||||
static int maxFps;
|
||||
if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) {
|
||||
if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::DX11) {
|
||||
maxFps = 360;
|
||||
} else {
|
||||
maxFps = LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
|
||||
maxFps = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
|
||||
}
|
||||
int currentFps = 0;
|
||||
#ifdef __WIIU__
|
||||
@ -253,15 +253,15 @@ void DrawSettingsMenu(){
|
||||
currentFps = 60;
|
||||
}
|
||||
CVarSetInteger("gInterpolationFPS", currentFps);
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
#else
|
||||
bool matchingRefreshRate =
|
||||
CVarGetInteger("gMatchRefreshRate", 0) && LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() != LUS::WindowBackend::DX11;
|
||||
CVarGetInteger("gMatchRefreshRate", 0) && Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() != Ship::WindowBackend::DX11;
|
||||
UIWidgets::CVarSliderInt((currentFps == 20) ? "FPS: Original (20)" : "FPS: %d", "gInterpolationFPS", minFps, maxFps, 1, {
|
||||
.disabled = matchingRefreshRate
|
||||
});
|
||||
#endif
|
||||
if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) {
|
||||
if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::DX11) {
|
||||
UIWidgets::Tooltip(
|
||||
"Uses Matrix Interpolation to create extra frames, resulting in smoother graphics. This is purely "
|
||||
"visual and does not impact game logic, execution of glitches etc.\n\n"
|
||||
@ -275,13 +275,13 @@ void DrawSettingsMenu(){
|
||||
}
|
||||
} // END FPS Slider
|
||||
|
||||
if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) {
|
||||
if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::DX11) {
|
||||
UIWidgets::Spacer(0);
|
||||
if (ImGui::Button("Match Refresh Rate")) {
|
||||
int hz = LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
|
||||
int hz = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
|
||||
if (hz >= 30 && hz <= 360) {
|
||||
CVarSetInteger("gInterpolationFPS", hz);
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -290,7 +290,7 @@ void DrawSettingsMenu(){
|
||||
|
||||
UIWidgets::Tooltip("Matches interpolation value to the current game's window refresh rate");
|
||||
|
||||
if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) {
|
||||
if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::DX11) {
|
||||
UIWidgets::PaddedEnhancementSliderInt(CVarGetInteger("gExtraLatencyThreshold", 80) == 0 ? "Jitter fix: Off" : "Jitter fix: >= %d FPS",
|
||||
"##ExtraLatencyThreshold", "gExtraLatencyThreshold", 0, 360, "", 80, true, true, false);
|
||||
UIWidgets::Tooltip("When Interpolation FPS setting is at least this threshold, add one frame of input lag (e.g. 16.6 ms for 60 FPS) in order to avoid jitter. This setting allows the CPU to work on one frame while GPU works on the previous frame.\nThis setting should be used when your computer is too slow to do CPU + GPU work in time.");
|
||||
@ -299,51 +299,51 @@ void DrawSettingsMenu(){
|
||||
UIWidgets::PaddedSeparator(true, true, 3.0f, 3.0f);
|
||||
|
||||
|
||||
static std::unordered_map<LUS::WindowBackend, const char*> windowBackendNames = {
|
||||
{ LUS::WindowBackend::DX11, "DirectX" },
|
||||
{ LUS::WindowBackend::SDL_OPENGL, "OpenGL"},
|
||||
{ LUS::WindowBackend::SDL_METAL, "Metal" },
|
||||
{ LUS::WindowBackend::GX2, "GX2"}
|
||||
static std::unordered_map<Ship::WindowBackend, const char*> windowBackendNames = {
|
||||
{ Ship::WindowBackend::DX11, "DirectX" },
|
||||
{ Ship::WindowBackend::SDL_OPENGL, "OpenGL"},
|
||||
{ Ship::WindowBackend::SDL_METAL, "Metal" },
|
||||
{ Ship::WindowBackend::GX2, "GX2"}
|
||||
};
|
||||
|
||||
ImGui::Text("Renderer API (Needs reload)");
|
||||
LUS::WindowBackend runningWindowBackend = LUS::Context::GetInstance()->GetWindow()->GetWindowBackend();
|
||||
LUS::WindowBackend configWindowBackend;
|
||||
int configWindowBackendId = LUS::Context::GetInstance()->GetConfig()->GetInt("Window.Backend.Id", -1);
|
||||
if (configWindowBackendId != -1 && configWindowBackendId < static_cast<int>(LUS::WindowBackend::BACKEND_COUNT)) {
|
||||
configWindowBackend = static_cast<LUS::WindowBackend>(configWindowBackendId);
|
||||
Ship::WindowBackend runningWindowBackend = Ship::Context::GetInstance()->GetWindow()->GetWindowBackend();
|
||||
Ship::WindowBackend configWindowBackend;
|
||||
int configWindowBackendId = Ship::Context::GetInstance()->GetConfig()->GetInt("Window.Backend.Id", -1);
|
||||
if (configWindowBackendId != -1 && configWindowBackendId < static_cast<int>(Ship::WindowBackend::BACKEND_COUNT)) {
|
||||
configWindowBackend = static_cast<Ship::WindowBackend>(configWindowBackendId);
|
||||
} else {
|
||||
configWindowBackend = runningWindowBackend;
|
||||
}
|
||||
|
||||
if (LUS::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1) {
|
||||
if (Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1) {
|
||||
UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
|
||||
}
|
||||
if (ImGui::BeginCombo("##RApi", windowBackendNames[configWindowBackend])) {
|
||||
for (size_t i = 0; i < LUS::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size(); i++) {
|
||||
auto backend = LUS::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->data()[i];
|
||||
for (size_t i = 0; i < Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size(); i++) {
|
||||
auto backend = Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->data()[i];
|
||||
if (ImGui::Selectable(windowBackendNames[backend], backend == configWindowBackend)) {
|
||||
LUS::Context::GetInstance()->GetConfig()->SetInt("Window.Backend.Id", static_cast<int>(backend));
|
||||
LUS::Context::GetInstance()->GetConfig()->SetString("Window.Backend.Name",
|
||||
Ship::Context::GetInstance()->GetConfig()->SetInt("Window.Backend.Id", static_cast<int>(backend));
|
||||
Ship::Context::GetInstance()->GetConfig()->SetString("Window.Backend.Name",
|
||||
windowBackendNames[backend]);
|
||||
LUS::Context::GetInstance()->GetConfig()->Save();
|
||||
Ship::Context::GetInstance()->GetConfig()->Save();
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
if (LUS::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1) {
|
||||
if (Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1) {
|
||||
UIWidgets::ReEnableComponent("");
|
||||
}
|
||||
|
||||
if (LUS::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) {
|
||||
if (Ship::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) {
|
||||
UIWidgets::PaddedEnhancementCheckbox("Enable Vsync", "gVsyncEnabled", true, false);
|
||||
}
|
||||
|
||||
if (LUS::Context::GetInstance()->GetWindow()->SupportsWindowedFullscreen()) {
|
||||
if (Ship::Context::GetInstance()->GetWindow()->SupportsWindowedFullscreen()) {
|
||||
UIWidgets::PaddedEnhancementCheckbox("Windowed fullscreen", "gSdlWindowedFullscreen", true, false);
|
||||
}
|
||||
|
||||
if (LUS::Context::GetInstance()->GetWindow()->GetGui()->SupportsViewports()) {
|
||||
if (Ship::Context::GetInstance()->GetWindow()->GetGui()->SupportsViewports()) {
|
||||
UIWidgets::PaddedEnhancementCheckbox("Allow multi-windows", "gEnableMultiViewports", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true);
|
||||
UIWidgets::Tooltip("Allows windows to be able to be dragged off of the main game window. Requires a reload to take effect.");
|
||||
}
|
||||
@ -355,7 +355,7 @@ void DrawSettingsMenu(){
|
||||
|
||||
UIWidgets::Spacer(0);
|
||||
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->DrawSettings();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->DrawSettings();
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
@ -364,11 +364,11 @@ void DrawSettingsMenu(){
|
||||
void DrawMenuBarIcon() {
|
||||
static bool gameIconLoaded = false;
|
||||
if (!gameIconLoaded) {
|
||||
// LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTexture("Game_Icon", "textures/icons/gIcon.png");
|
||||
// Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTexture("Game_Icon", "textures/icons/gIcon.png");
|
||||
gameIconLoaded = false;
|
||||
}
|
||||
|
||||
if (LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Game_Icon")) {
|
||||
if (Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Game_Icon")) {
|
||||
#ifdef __SWITCH__
|
||||
ImVec2 iconSize = ImVec2(20.0f, 20.0f);
|
||||
float posScale = 1.0f;
|
||||
@ -380,7 +380,7 @@ void DrawMenuBarIcon() {
|
||||
float posScale = 1.5f;
|
||||
#endif
|
||||
ImGui::SetCursorPos(ImVec2(5, 2.5f) * posScale);
|
||||
ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Game_Icon"), iconSize);
|
||||
ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Game_Icon"), iconSize);
|
||||
ImGui::SameLine();
|
||||
ImGui::SetCursorPos(ImVec2(25, 0) * posScale);
|
||||
}
|
||||
@ -400,11 +400,11 @@ void DrawGameMenu() {
|
||||
#if !defined(__SWITCH__) && !defined(__WIIU__)
|
||||
|
||||
if (UIWidgets::MenuItem("Toggle Fullscreen", "F9")) {
|
||||
LUS::Context::GetInstance()->GetWindow()->ToggleFullscreen();
|
||||
Ship::Context::GetInstance()->GetWindow()->ToggleFullscreen();
|
||||
}
|
||||
|
||||
if (UIWidgets::MenuItem("Quit")) {
|
||||
LUS::Context::GetInstance()->GetWindow()->Close();
|
||||
Ship::Context::GetInstance()->GetWindow()->Close();
|
||||
}
|
||||
#endif
|
||||
ImGui::EndMenu();
|
||||
|
@ -6,9 +6,9 @@ namespace GameUI {
|
||||
void Destroy();
|
||||
}
|
||||
|
||||
class GameMenuBar : public LUS::GuiMenuBar {
|
||||
class GameMenuBar : public Ship::GuiMenuBar {
|
||||
public:
|
||||
using LUS::GuiMenuBar::GuiMenuBar;
|
||||
using Ship::GuiMenuBar::GuiMenuBar;
|
||||
protected:
|
||||
void DrawElement() override;
|
||||
void InitElement() override {};
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "UIWidgets.h"
|
||||
#include "libultraship/src/Context.h"
|
||||
|
||||
#include <ImGui/imgui.h>
|
||||
#include <imgui.h>
|
||||
#include <libultraship/libultraship.h>
|
||||
#include <graphic/Fast3D/gfx_pc.h>
|
||||
|
||||
@ -40,7 +40,7 @@ namespace AdvancedResolutionSettings {
|
||||
const int pixelCountPresets[] = { 480, 240, 480, 720, 960, 1200, 1440, 1080, 2160, 480 };
|
||||
const int default_pixelCount = 0; // Default combo list option
|
||||
|
||||
const uint32_t minVerticalPixelCount = 240; // see: LUS::AdvancedResolution()
|
||||
const uint32_t minVerticalPixelCount = 240; // see: Ship::AdvancedResolution()
|
||||
const uint32_t maxVerticalPixelCount = 4320;
|
||||
|
||||
const unsigned short default_maxIntegerScaleFactor = 6; // Default size of Integer scale factor slider.
|
||||
@ -104,7 +104,7 @@ namespace AdvancedResolutionSettings {
|
||||
(CVarGetInteger("gAdvancedResolution.VerticalResolutionToggle", 0) &&
|
||||
CVarGetInteger("gAdvancedResolution.Enabled", 0)) ||
|
||||
CVarGetInteger("gLowResMode", 0))) {
|
||||
LUS::Context::GetInstance()->GetWindow()->SetResolutionMultiplier(CVarGetFloat("gInternalResolution", 1));
|
||||
Ship::Context::GetInstance()->GetWindow()->SetResolutionMultiplier(CVarGetFloat("gInternalResolution", 1));
|
||||
}
|
||||
UIWidgets::Tooltip("Multiplies your output resolution by the value entered, as a more intensive but effective "
|
||||
"form of anti-aliasing"); // Description pulled from SohMenuBar.cpp
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <libultraship/libultraship.h>
|
||||
|
||||
namespace AdvancedResolutionSettings {
|
||||
class AdvancedResolutionSettingsWindow : public LUS::GuiWindow {
|
||||
class AdvancedResolutionSettingsWindow : public Ship::GuiWindow {
|
||||
private:
|
||||
bool IsDroppingFrames();
|
||||
|
||||
@ -10,7 +10,7 @@ namespace AdvancedResolutionSettings {
|
||||
bool IsBoolArrayTrue(bool*);
|
||||
|
||||
public:
|
||||
using LUS::GuiWindow::GuiWindow;
|
||||
using Ship::GuiWindow::GuiWindow;
|
||||
|
||||
void InitElement() override;
|
||||
void DrawElement() override;
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
#include "libultraship/src/Context.h"
|
||||
|
||||
#include <ImGui/imgui.h>
|
||||
#include <ImGui/imgui_internal.h>
|
||||
#include <imgui.h>
|
||||
#include <imgui_internal.h>
|
||||
#include <libultraship/libultraship.h>
|
||||
#include <libultraship/libultra/types.h>
|
||||
|
||||
@ -205,7 +205,7 @@ namespace UIWidgets {
|
||||
bool val = (bool)CVarGetInteger(cvarName, defaultValue);
|
||||
if (CustomCheckbox(text, &val, disabled, disabledGraphic)) {
|
||||
CVarSetInteger(cvarName, val);
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ namespace UIWidgets {
|
||||
CVarSetInteger(cvarName, i);
|
||||
selected = i;
|
||||
changed = true;
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -258,7 +258,7 @@ namespace UIWidgets {
|
||||
if (disabledValue >= 0 && selected != disabledValue) {
|
||||
CVarSetInteger(cvarName, disabledValue);
|
||||
changed = true;
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
}
|
||||
}
|
||||
|
||||
@ -347,7 +347,7 @@ namespace UIWidgets {
|
||||
|
||||
if (changed) {
|
||||
CVarSetInteger(cvarName, val);
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
}
|
||||
|
||||
return changed;
|
||||
@ -423,7 +423,7 @@ namespace UIWidgets {
|
||||
|
||||
if (changed) {
|
||||
CVarSetFloat(cvarName, val);
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
}
|
||||
|
||||
return changed;
|
||||
@ -470,7 +470,7 @@ namespace UIWidgets {
|
||||
int val = CVarGetInteger(cvarName, 0);
|
||||
if (ImGui::RadioButton(make_invisible.c_str(), id == val)) {
|
||||
CVarSetInteger(cvarName, id);
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
ret = true;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
@ -497,7 +497,7 @@ namespace UIWidgets {
|
||||
|
||||
CVarSetColor(cvarName, colorsRGBA);
|
||||
CVarSetInteger(Cvar_RBM.c_str(), 0); //On click disable rainbow mode.
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
changed = true;
|
||||
}
|
||||
Tooltip("Revert colors to the game's original colors (GameCube version)\nOverwrites previously chosen color");
|
||||
@ -673,7 +673,7 @@ namespace UIWidgets {
|
||||
return dirty;
|
||||
}
|
||||
|
||||
bool WindowButton(const char* label, const char* cvarName, std::shared_ptr<LUS::GuiWindow> windowPtr, const ButtonOptions& options) {
|
||||
bool WindowButton(const char* label, const char* cvarName, std::shared_ptr<Ship::GuiWindow> windowPtr, const ButtonOptions& options) {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0, 0));
|
||||
std::string buttonText = label;
|
||||
bool dirty = false;
|
||||
@ -763,7 +763,7 @@ namespace UIWidgets {
|
||||
bool value = (bool)CVarGetInteger(cvarName, options.defaultValue);
|
||||
if (Checkbox(label, &value, options)) {
|
||||
CVarSetInteger(cvarName, value);
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
dirty = true;
|
||||
}
|
||||
return dirty;
|
||||
@ -867,7 +867,7 @@ namespace UIWidgets {
|
||||
uint8_t value = (uint8_t)CVarGetInteger(cvarName, options.defaultIndex);
|
||||
if (Combobox(label, &value, comboArray, options)) {
|
||||
CVarSetInteger(cvarName, value);
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
dirty = true;
|
||||
}
|
||||
return dirty;
|
||||
@ -914,7 +914,7 @@ namespace UIWidgets {
|
||||
if (Button("-", { .color = options.color, .size = Sizes::Inline }) && *value > min) {
|
||||
*value -= options.step;
|
||||
if (*value < min) *value = min;
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
dirty = true;
|
||||
}
|
||||
ImGui::SameLine(0, 3.0f);
|
||||
@ -923,7 +923,7 @@ namespace UIWidgets {
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
}
|
||||
if (ImGui::SliderScalar(invisibleLabel, ImGuiDataType_S32, value, &min, &max, options.format, options.flags)) {
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
dirty = true;
|
||||
}
|
||||
if (options.showButtons) {
|
||||
@ -932,7 +932,7 @@ namespace UIWidgets {
|
||||
if (Button("+", { .color = options.color, .size = Sizes::Inline }) && *value < max) {
|
||||
*value += options.step;
|
||||
if (*value > max) *value = max;
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
@ -953,7 +953,7 @@ namespace UIWidgets {
|
||||
int32_t value = CVarGetInteger(cvarName, defaultValue);
|
||||
if (SliderInt(label, &value, min, max, options)) {
|
||||
CVarSetInteger(cvarName, value);
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
dirty = true;
|
||||
}
|
||||
return dirty;
|
||||
@ -985,7 +985,7 @@ namespace UIWidgets {
|
||||
if (Button("-", { .color = options.color, .size = Sizes::Inline }) && *value > min) {
|
||||
*value -= options.step;
|
||||
if (*value < min) *value = min;
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
dirty = true;
|
||||
}
|
||||
ImGui::SameLine(0, 3.0f);
|
||||
@ -995,7 +995,7 @@ namespace UIWidgets {
|
||||
}
|
||||
if (ImGui::SliderScalar(invisibleLabel, ImGuiDataType_Float, &valueToDisplay, &minToDisplay, &maxToDisplay, options.format, options.flags)) {
|
||||
*value = options.isPercentage ? valueToDisplay / 100.0f : valueToDisplay;
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
dirty = true;
|
||||
}
|
||||
if (options.showButtons) {
|
||||
@ -1004,7 +1004,7 @@ namespace UIWidgets {
|
||||
if (Button("+", { .color = options.color, .size = Sizes::Inline }) && *value < max) {
|
||||
*value += options.step;
|
||||
if (*value > max) *value = max;
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
@ -1025,7 +1025,7 @@ namespace UIWidgets {
|
||||
float value = CVarGetFloat(cvarName, defaultValue);
|
||||
if (SliderFloat(label, &value, min, max, options)) {
|
||||
CVarSetFloat(cvarName, value);
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
dirty = true;
|
||||
}
|
||||
return dirty;
|
||||
|
@ -3,9 +3,9 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <span>
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include <ImGui/imgui.h>
|
||||
#include <imgui.h>
|
||||
#include <libultraship/libultraship.h>
|
||||
|
||||
namespace UIWidgets {
|
||||
@ -141,7 +141,7 @@ namespace UIWidgets {
|
||||
void PushStyleButton(const ImVec4& color = Colors::Gray);
|
||||
void PopStyleButton();
|
||||
bool Button(const char* label, const ButtonOptions& options = {});
|
||||
bool WindowButton(const char* label, const char* cvarName, std::shared_ptr<LUS::GuiWindow> windowPtr, const ButtonOptions& options = {});
|
||||
bool WindowButton(const char* label, const char* cvarName, std::shared_ptr<Ship::GuiWindow> windowPtr, const ButtonOptions& options = {});
|
||||
|
||||
struct CheckboxOptions {
|
||||
const ImVec4 color = Colors::Indigo;
|
||||
|
@ -59,6 +59,9 @@ void Controller_Init(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// LTODO: Fix this
|
||||
#define osContGetStatus(x) true
|
||||
|
||||
void Controller_UpdateInput(void) {
|
||||
s32 i;
|
||||
|
||||
@ -97,7 +100,11 @@ void Controller_ReadData(void) {
|
||||
|
||||
void Save_ReadData(void) {
|
||||
if ((gStartNMI == 0) && (Save_ReadEeprom(&gSaveIOBuffer) == 0)) {
|
||||
<<<<<<< HEAD
|
||||
osSendMesg(&gSaveMesgQueue, (OSMesg) SI_SAVE_SUCCESS, OS_MESG_NOBLOCK);
|
||||
=======
|
||||
osSendMesg(&gSaveMesgQueue, OS_MESG_32(SI_SAVE_SUCCESS), OS_MESG_PRI_NORMAL);
|
||||
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
|
||||
return;
|
||||
}
|
||||
osSendMesg(&gSaveMesgQueue, OS_MESG_32(SI_SAVE_FAILED), OS_MESG_PRI_NORMAL);
|
||||
@ -105,7 +112,11 @@ void Save_ReadData(void) {
|
||||
|
||||
void Save_WriteData(void) {
|
||||
if ((gStartNMI == 0) && (Save_WriteEeprom(&gSaveIOBuffer) == 0)) {
|
||||
<<<<<<< HEAD
|
||||
osSendMesg(&gSaveMesgQueue, (OSMesg) SI_SAVE_SUCCESS, OS_MESG_NOBLOCK);
|
||||
=======
|
||||
osSendMesg(&gSaveMesgQueue, OS_MESG_32(SI_SAVE_SUCCESS), OS_MESG_PRI_NORMAL);
|
||||
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
|
||||
return;
|
||||
}
|
||||
osSendMesg(&gSaveMesgQueue, OS_MESG_32(SI_SAVE_FAILED), OS_MESG_PRI_NORMAL);
|
||||
|
@ -15,32 +15,32 @@ OSMesgQueue gPiMgrCmdQueue; // 800E2010
|
||||
OSMesg sPiMgrCmdBuff[50]; // 800E2028
|
||||
|
||||
OSMesgQueue gDmaMesgQueue;
|
||||
void* sDmaMsgBuff[1];
|
||||
OSMesg sDmaMsgBuff[1];
|
||||
OSIoMesg gDmaIOMsg;
|
||||
OSMesgQueue gSerialEventQueue;
|
||||
void* sSerialEventBuff[1];
|
||||
OSMesg sSerialEventBuff[1];
|
||||
OSMesgQueue gMainThreadMesgQueue;
|
||||
void* sMainThreadMsgBuff[32];
|
||||
OSMesg sMainThreadMsgBuff[32];
|
||||
OSMesgQueue gTaskMesgQueue;
|
||||
void* sTaskMsgBuff[16];
|
||||
OSMesg sTaskMsgBuff[16];
|
||||
OSMesgQueue gAudioVImesgQueue;
|
||||
void* sAudioVImsgBuff[1];
|
||||
OSMesg sAudioVImsgBuff[1];
|
||||
OSMesgQueue gAudioTaskMesgQueue;
|
||||
void* sAudioTaskMsgBuff[1];
|
||||
OSMesg sAudioTaskMsgBuff[1];
|
||||
OSMesgQueue gGfxVImesgQueue;
|
||||
void* sGfxVImsgBuff[4];
|
||||
OSMesg sGfxVImsgBuff[4];
|
||||
OSMesgQueue gGfxTaskMesgQueue;
|
||||
void* sGfxTaskMsgBuff[2];
|
||||
OSMesg sGfxTaskMsgBuff[2];
|
||||
OSMesgQueue gSerialThreadMesgQueue;
|
||||
void* sSerialThreadMsgBuff[8];
|
||||
OSMesg sSerialThreadMsgBuff[8];
|
||||
OSMesgQueue gControllerMesgQueue;
|
||||
void* sControllerMsgBuff[1];
|
||||
OSMesg sControllerMsgBuff[1];
|
||||
OSMesgQueue gSaveMesgQueue;
|
||||
void* sSaveMsgBuff[1];
|
||||
OSMesg sSaveMsgBuff[1];
|
||||
OSMesgQueue gTimerTaskMesgQueue;
|
||||
void* sTimerTaskMsgBuff[16];
|
||||
OSMesg sTimerTaskMsgBuff[16];
|
||||
OSMesgQueue gTimerWaitMesgQueue;
|
||||
void* sTimerWaitMsgBuff[1];
|
||||
OSMesg sTimerWaitMsgBuff[1];
|
||||
|
||||
GfxPool gGfxPools[2];
|
||||
|
||||
@ -103,8 +103,9 @@ void Main_Initialize(void) {
|
||||
}
|
||||
|
||||
void Audio_ThreadEntry(void* arg0) {
|
||||
SPTask* task;
|
||||
// SPTask* task;
|
||||
|
||||
<<<<<<< HEAD
|
||||
AudioLoad_Init();
|
||||
Audio_InitSounds();
|
||||
|
||||
@ -128,6 +129,30 @@ void Audio_ThreadEntry(void* arg0) {
|
||||
}
|
||||
MQ_WAIT_FOR_MESG(&gAudioVImesgQueue, NULL);
|
||||
}
|
||||
=======
|
||||
// AudioLoad_Init();
|
||||
// Audio_InitSounds();
|
||||
// task = AudioThread_CreateTask();
|
||||
// if (task != NULL) {
|
||||
// task->msgQueue = &gAudioTaskMsgQueue;
|
||||
// task->msg = OS_MESG_32(TASK_MESG_1);
|
||||
// osWritebackDCacheAll();
|
||||
// osSendMesg(&gTaskMsgQueue, OS_MESG_PTR(task), OS_MESG_PRI_NORMAL);
|
||||
// }
|
||||
// while (true) {
|
||||
// task = AudioThread_CreateTask();
|
||||
// if (task != NULL) {
|
||||
// task->msgQueue = &gAudioTaskMsgQueue;
|
||||
// task->msg = OS_MESG_32(TASK_MESG_1);
|
||||
// osWritebackDCacheAll();
|
||||
// }
|
||||
// MQ_GET_MESG(&gAudioTaskMesgQueue, NULL);
|
||||
// if (task != NULL) {
|
||||
// osSendMesg(&gTaskMsgQueue, OS_MESG_PTR(task), OS_MESG_PRI_NORMAL);
|
||||
// }
|
||||
// MQ_WAIT_FOR_MESG(&gAudioVImesgQueue, NULL);
|
||||
// }
|
||||
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
|
||||
}
|
||||
|
||||
void Graphics_SetTask(void) {
|
||||
@ -213,9 +238,15 @@ void SerialInterface_ThreadUpdate() {
|
||||
void Timer_ThreadEntry(void* arg0) {
|
||||
OSMesg sp24;
|
||||
|
||||
<<<<<<< HEAD
|
||||
while (true) {
|
||||
MQ_WAIT_FOR_MESG(&gTimerTaskMesgQueue, &sp24);
|
||||
// Timer_CompleteTask(sp24);
|
||||
=======
|
||||
while (1) {
|
||||
osRecvMesg(&gTimerTaskMesgQueue, &sp24, OS_MESG_BLOCK);
|
||||
// Timer_CompleteTask(sp24.ptr);
|
||||
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,10 +258,10 @@ void Graphics_ThreadEntry(void* arg0) {
|
||||
u8 validVIsPerFrame;
|
||||
|
||||
Game_Initialize();
|
||||
osSendMesg(&gSerialThreadMsgQueue, OS_MESG_32(SI_READ_CONTROLLER), OS_MESG_PRI_NORMAL);
|
||||
osSendMesg(&gSerialThreadMesgQueue, OS_MESG_32(SI_READ_CONTROLLER), OS_MESG_PRI_NORMAL);
|
||||
Graphics_InitializeTask(gSysFrameCount);
|
||||
{
|
||||
gSPSegment(gUnkDisp1++, 0, 0);
|
||||
__gSPSegment(gUnkDisp1++, 0, 0);
|
||||
gSPDisplayList(gMasterDisp++, gGfxPool->unkDL1);
|
||||
Game_Update();
|
||||
gSPEndDisplayList(gUnkDisp1++);
|
||||
@ -254,15 +285,15 @@ void Graphics_ThreadUpdate() {
|
||||
|
||||
gSysFrameCount++;
|
||||
Graphics_InitializeTask(gSysFrameCount);
|
||||
osRecvMesg(&gControllerMsgQueue, NULL, OS_MESG_NOBLOCK);
|
||||
osSendMesg(&gSerialThreadMsgQueue, OS_MESG_32(SI_RUMBLE), OS_MESG_PRI_NORMAL);
|
||||
osRecvMesg(&gControllerMesgQueue, NULL, OS_MESG_NOBLOCK);
|
||||
osSendMesg(&gSerialThreadMesgQueue, OS_MESG_32(SI_RUMBLE), OS_MESG_PRI_NORMAL);
|
||||
Controller_UpdateInput();
|
||||
Controller_ReadData();
|
||||
Controller_Rumble();
|
||||
osSendMesg(&gSerialThreadMsgQueue, OS_MESG_32(SI_READ_CONTROLLER), OS_MESG_PRI_NORMAL);
|
||||
osSendMesg(&gSerialThreadMesgQueue, OS_MESG_32(SI_READ_CONTROLLER), OS_MESG_PRI_NORMAL);
|
||||
Main_SetVIMode();
|
||||
{
|
||||
gSPSegment(gUnkDisp1++, 0, 0);
|
||||
__gSPSegment(gUnkDisp1++, 0, 0);
|
||||
gSPDisplayList(gMasterDisp++, gGfxPool->unkDL1);
|
||||
Game_Update();
|
||||
if (gStartNMI == 1) {
|
||||
@ -274,7 +305,7 @@ void Graphics_ThreadUpdate() {
|
||||
gDPFullSync(gMasterDisp++);
|
||||
gSPEndDisplayList(gMasterDisp++);
|
||||
}
|
||||
osRecvMesg(&gGfxTaskMsgQueue, NULL, OS_MESG_BLOCK);
|
||||
osRecvMesg(&gGfxTaskMesgQueue, NULL, OS_MESG_BLOCK);
|
||||
Graphics_SetTask();
|
||||
|
||||
if (GfxDebuggerIsDebuggingRequested()) {
|
||||
@ -310,16 +341,16 @@ void Main_InitMesgQueues(void) {
|
||||
osCreateMesgQueue(&gGfxTaskMesgQueue, sGfxTaskMsgBuff, ARRAY_COUNT(sGfxTaskMsgBuff));
|
||||
osCreateMesgQueue(&gSerialEventQueue, sSerialEventBuff, ARRAY_COUNT(sSerialEventBuff));
|
||||
osSetEventMesg(OS_EVENT_SI, &gSerialEventQueue, OS_MESG_PTR(NULL));
|
||||
osCreateMesgQueue(&gMainThreadMsgQueue, sMainThreadMsgBuff, ARRAY_COUNT(sMainThreadMsgBuff));
|
||||
osViSetEvent(&gMainThreadMsgQueue, OS_MESG_32(EVENT_MESG_VI), 1);
|
||||
osSetEventMesg(OS_EVENT_SP, &gMainThreadMsgQueue, OS_MESG_32(EVENT_MESG_SP));
|
||||
osSetEventMesg(OS_EVENT_DP, &gMainThreadMsgQueue, OS_MESG_32(EVENT_MESG_DP));
|
||||
osSetEventMesg(OS_EVENT_PRENMI, &gMainThreadMsgQueue, OS_MESG_32(EVENT_MESG_PRENMI));
|
||||
osCreateMesgQueue(&gTimerTaskMsgQueue, sTimerTaskMsgBuff, ARRAY_COUNT(sTimerTaskMsgBuff));
|
||||
osCreateMesgQueue(&gTimerWaitMsgQueue, sTimerWaitMsgBuff, ARRAY_COUNT(sTimerWaitMsgBuff));
|
||||
osCreateMesgQueue(&gSerialThreadMsgQueue, sSerialThreadMsgBuff, ARRAY_COUNT(sSerialThreadMsgBuff));
|
||||
osCreateMesgQueue(&gControllerMsgQueue, sControllerMsgBuff, ARRAY_COUNT(sControllerMsgBuff));
|
||||
osCreateMesgQueue(&gSaveMsgQueue, sSaveMsgBuff, ARRAY_COUNT(sSaveMsgBuff));
|
||||
osCreateMesgQueue(&gMainThreadMesgQueue, sMainThreadMsgBuff, ARRAY_COUNT(sMainThreadMsgBuff));
|
||||
osViSetEvent(&gMainThreadMesgQueue, OS_MESG_32(EVENT_MESG_VI), 1);
|
||||
osSetEventMesg(OS_EVENT_SP, &gMainThreadMesgQueue, OS_MESG_32(EVENT_MESG_SP));
|
||||
osSetEventMesg(OS_EVENT_DP, &gMainThreadMesgQueue, OS_MESG_32(EVENT_MESG_DP));
|
||||
osSetEventMesg(OS_EVENT_PRENMI, &gMainThreadMesgQueue, OS_MESG_32(EVENT_MESG_PRENMI));
|
||||
osCreateMesgQueue(&gTimerTaskMesgQueue, sTimerTaskMsgBuff, ARRAY_COUNT(sTimerTaskMsgBuff));
|
||||
osCreateMesgQueue(&gTimerWaitMesgQueue, sTimerWaitMsgBuff, ARRAY_COUNT(sTimerWaitMsgBuff));
|
||||
osCreateMesgQueue(&gSerialThreadMesgQueue, sSerialThreadMsgBuff, ARRAY_COUNT(sSerialThreadMsgBuff));
|
||||
osCreateMesgQueue(&gControllerMesgQueue, sControllerMsgBuff, ARRAY_COUNT(sControllerMsgBuff));
|
||||
osCreateMesgQueue(&gSaveMesgQueue, sSaveMsgBuff, ARRAY_COUNT(sSaveMsgBuff));
|
||||
}
|
||||
|
||||
void Main_HandleRDP(void) {
|
||||
@ -356,6 +387,7 @@ void Main_HandleRSP(void) {
|
||||
// }
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
void Main_GetNewTasks(void) {
|
||||
u8 i;
|
||||
SPTask** audioTask;
|
||||
@ -413,6 +445,8 @@ void Main_GetNewTasks(void) {
|
||||
}
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
|
||||
void Main_StartNextTask(void) {
|
||||
if (sAudioTasks[0] != NULL) {
|
||||
if (gCurrentTask != NULL) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "sys.h"
|
||||
|
||||
#define qs1616(e) ((s32) ((e) * 0x00010000))
|
||||
#define qs1616(e) ((s32) ((e) *0x00010000))
|
||||
|
||||
#define IPART(x) ((qs1616(x) >> 16) & 0xFFFF)
|
||||
#define FPART(x) (qs1616(x) & 0xFFFF)
|
||||
@ -17,12 +17,8 @@
|
||||
} \
|
||||
}
|
||||
|
||||
Mtx gIdentityMtx = gdSPDefMtx(
|
||||
1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f
|
||||
);
|
||||
Mtx gIdentityMtx =
|
||||
gdSPDefMtx(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
Matrix gIdentityMatrix = { {
|
||||
{ 1.0f, 0.0f, 0.0f, 0.0f },
|
||||
@ -32,9 +28,9 @@ Matrix gIdentityMatrix = { {
|
||||
} };
|
||||
|
||||
Matrix* gGfxMatrix;
|
||||
Matrix sGfxMatrixStack[0x150];
|
||||
Matrix sGfxMatrixStack[0x20];
|
||||
Matrix* gCalcMatrix;
|
||||
Matrix sCalcMatrixStack[0x150];
|
||||
Matrix sCalcMatrixStack[0x20];
|
||||
|
||||
// Copies src Matrix into dst
|
||||
void Matrix_Copy(Matrix* dst, Matrix* src) {
|
||||
@ -65,211 +61,72 @@ void Matrix_Mult(Matrix* mtx, Matrix* tf, u8 mode) {
|
||||
f32 ry;
|
||||
f32 rz;
|
||||
f32 rw;
|
||||
|
||||
//---COL1---
|
||||
f32 cx = mfB->xx;
|
||||
f32 cy = mfB->xy;
|
||||
f32 cz = mfB->xz;
|
||||
f32 cw = mfB->xw;
|
||||
//--------
|
||||
|
||||
rx = mfA->xx;
|
||||
ry = mfA->yx;
|
||||
rz = mfA->zx;
|
||||
rw = mfA->wx;
|
||||
dest->xx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xy;
|
||||
ry = mfA->yy;
|
||||
rz = mfA->zy;
|
||||
rw = mfA->wy;
|
||||
dest->xy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xz;
|
||||
ry = mfA->yz;
|
||||
rz = mfA->zz;
|
||||
rw = mfA->wz;
|
||||
dest->xz = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xw;
|
||||
ry = mfA->yw;
|
||||
rz = mfA->zw;
|
||||
rw = mfA->ww;
|
||||
dest->xw = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
//---2Col---
|
||||
cx = mfB->yx;
|
||||
cy = mfB->yy;
|
||||
cz = mfB->yz;
|
||||
cw = mfB->yw;
|
||||
//--------
|
||||
rx = mfA->xx;
|
||||
ry = mfA->yx;
|
||||
rz = mfA->zx;
|
||||
rw = mfA->wx;
|
||||
dest->yx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xy;
|
||||
ry = mfA->yy;
|
||||
rz = mfA->zy;
|
||||
rw = mfA->wy;
|
||||
dest->yy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xz;
|
||||
ry = mfA->yz;
|
||||
rz = mfA->zz;
|
||||
rw = mfA->wz;
|
||||
dest->yz = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xw;
|
||||
ry = mfA->yw;
|
||||
rz = mfA->zw;
|
||||
rw = mfA->ww;
|
||||
dest->yw = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
//---3Col---
|
||||
cx = mfB->zx;
|
||||
cy = mfB->zy;
|
||||
cz = mfB->zz;
|
||||
cw = mfB->zw;
|
||||
//--------
|
||||
rx = mfA->xx;
|
||||
ry = mfA->yx;
|
||||
rz = mfA->zx;
|
||||
rw = mfA->wx;
|
||||
dest->zx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xy;
|
||||
ry = mfA->yy;
|
||||
rz = mfA->zy;
|
||||
rw = mfA->wy;
|
||||
dest->zy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xz;
|
||||
ry = mfA->yz;
|
||||
rz = mfA->zz;
|
||||
rw = mfA->wz;
|
||||
dest->zz = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xw;
|
||||
ry = mfA->yw;
|
||||
rz = mfA->zw;
|
||||
rw = mfA->ww;
|
||||
dest->zw = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
//---4Col---
|
||||
cx = mfB->wx;
|
||||
cy = mfB->wy;
|
||||
cz = mfB->wz;
|
||||
cw = mfB->ww;
|
||||
//--------
|
||||
rx = mfA->xx;
|
||||
ry = mfA->yx;
|
||||
rz = mfA->zx;
|
||||
rw = mfA->wx;
|
||||
dest->wx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xy;
|
||||
ry = mfA->yy;
|
||||
rz = mfA->zy;
|
||||
rw = mfA->wy;
|
||||
dest->wy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xz;
|
||||
ry = mfA->yz;
|
||||
rz = mfA->zz;
|
||||
rw = mfA->wz;
|
||||
dest->wz = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
|
||||
rx = mfA->xw;
|
||||
ry = mfA->yw;
|
||||
rz = mfA->zw;
|
||||
rw = mfA->ww;
|
||||
dest->ww = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw);
|
||||
}
|
||||
|
||||
void Matrix_MtxFCopy(MtxF* dest, MtxF* src) {
|
||||
dest->xx = src->xx;
|
||||
dest->yx = src->yx;
|
||||
dest->zx = src->zx;
|
||||
dest->wx = src->wx;
|
||||
dest->xy = src->xy;
|
||||
dest->yy = src->yy;
|
||||
dest->zy = src->zy;
|
||||
dest->wy = src->wy;
|
||||
dest->xx = src->xx;
|
||||
dest->yx = src->yx;
|
||||
dest->zx = src->zx;
|
||||
dest->wx = src->wx;
|
||||
dest->xy = src->xy;
|
||||
dest->yy = src->yy;
|
||||
dest->zy = src->zy;
|
||||
dest->wy = src->wy;
|
||||
dest->xz = src->xz;
|
||||
dest->yz = src->yz;
|
||||
dest->zz = src->zz;
|
||||
dest->wz = src->wz;
|
||||
dest->xw = src->xw;
|
||||
dest->yw = src->yw;
|
||||
dest->zw = src->zw;
|
||||
dest->ww = src->ww;
|
||||
dest->xz = src->xz;
|
||||
dest->yz = src->yz;
|
||||
dest->zz = src->zz;
|
||||
dest->wz = src->wz;
|
||||
dest->xw = src->xw;
|
||||
dest->yw = src->yw;
|
||||
dest->zw = src->zw;
|
||||
dest->ww = src->ww;
|
||||
}
|
||||
|
||||
// Copies tf into mtx (MTXMODE_NEW) or applies it to mtx (MTXMODE_APPLY)
|
||||
void Matrix_Mult(Matrix* mtx, Matrix* tf, u8 mode) {
|
||||
MtxF* cmf = mtx->m;
|
||||
s32 i0;
|
||||
s32 i1;
|
||||
s32 i2;
|
||||
s32 i3;
|
||||
|
||||
if (mode == 1) {
|
||||
MtxFMtxFMult(cmf, tf->m, cmf);
|
||||
rx = mtx->m[0][0];
|
||||
ry = mtx->m[1][0];
|
||||
rz = mtx->m[2][0];
|
||||
rw = mtx->m[3][0];
|
||||
|
||||
for (i0 = 0; i0 < 4; i0++) {
|
||||
mtx->m[i0][0] = (rx * tf->m[i0][0]) + (ry * tf->m[i0][1]) + (rz * tf->m[i0][2]) + (rw * tf->m[i0][3]);
|
||||
}
|
||||
|
||||
rx = mtx->m[0][1];
|
||||
ry = mtx->m[1][1];
|
||||
rz = mtx->m[2][1];
|
||||
rw = mtx->m[3][1];
|
||||
|
||||
for (i1 = 0; i1 < 4; i1++) {
|
||||
mtx->m[i1][1] = (rx * tf->m[i1][0]) + (ry * tf->m[i1][1]) + (rz * tf->m[i1][2]) + (rw * tf->m[i1][3]);
|
||||
}
|
||||
|
||||
rx = mtx->m[0][2];
|
||||
ry = mtx->m[1][2];
|
||||
rz = mtx->m[2][2];
|
||||
rw = mtx->m[3][2];
|
||||
|
||||
for (i2 = 0; i2 < 4; i2++) {
|
||||
mtx->m[i2][2] = (rx * tf->m[i2][0]) + (ry * tf->m[i2][1]) + (rz * tf->m[i2][2]) + (rw * tf->m[i2][3]);
|
||||
}
|
||||
|
||||
rx = mtx->m[0][3];
|
||||
ry = mtx->m[1][3];
|
||||
rz = mtx->m[2][3];
|
||||
rw = mtx->m[3][3];
|
||||
|
||||
for (i3 = 0; i3 < 4; i3++) {
|
||||
mtx->m[i3][3] = (rx * tf->m[i3][0]) + (ry * tf->m[i3][1]) + (rz * tf->m[i3][2]) + (rw * tf->m[i3][3]);
|
||||
}
|
||||
} else {
|
||||
Matrix_MtxFCopy(cmf, tf->m);
|
||||
Matrix_Copy(mtx, tf);
|
||||
}
|
||||
}
|
||||
|
||||
// Creates a translation matrix in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY)
|
||||
void Matrix_Translate(Matrix* mtx, f32 x, f32 y, f32 z, u8 mode) {
|
||||
MtxF* cmf = mtx->m;
|
||||
f32 tempX;
|
||||
f32 tempY;
|
||||
f32 rx;
|
||||
f32 ry;
|
||||
s32 i;
|
||||
|
||||
if (mode == 1) {
|
||||
tempX = cmf->xx;
|
||||
tempY = cmf->xy;
|
||||
cmf->xw += tempX * x + tempY * y + cmf->xz * z;
|
||||
tempX = cmf->yx;
|
||||
tempY = cmf->yy;
|
||||
cmf->yw += tempX * x + tempY * y + cmf->yz * z;
|
||||
tempX = cmf->zx;
|
||||
tempY = cmf->zy;
|
||||
cmf->zw += tempX * x + tempY * y + cmf->zz * z;
|
||||
tempX = cmf->wx;
|
||||
tempY = cmf->wy;
|
||||
cmf->ww += tempX * x + tempY * y + cmf->wz * z;
|
||||
for (i = 0; i < 4; i++) {
|
||||
rx = mtx->m[0][i];
|
||||
ry = mtx->m[1][i];
|
||||
|
||||
mtx->m[3][i] += (rx * x) + (ry * y) + (mtx->m[2][i] * z);
|
||||
}
|
||||
} else {
|
||||
cmf->yx = 0.0f;
|
||||
cmf->zx = 0.0f;
|
||||
cmf->wx = 0.0f;
|
||||
cmf->xy = 0.0f;
|
||||
cmf->zy = 0.0f;
|
||||
cmf->wy = 0.0f;
|
||||
cmf->xz = 0.0f;
|
||||
cmf->yz = 0.0f;
|
||||
cmf->wz = 0.0f;
|
||||
cmf->xx = 1.0f;
|
||||
cmf->yy = 1.0f;
|
||||
cmf->zz = 1.0f;
|
||||
cmf->ww = 1.0f;
|
||||
cmf->xw = x;
|
||||
cmf->yw = y;
|
||||
cmf->zw = z;
|
||||
mtx->m[3][0] = x;
|
||||
mtx->m[3][1] = y;
|
||||
mtx->m[3][2] = z;
|
||||
mtx->m[0][1] = mtx->m[0][2] = mtx->m[0][3] = mtx->m[1][0] = mtx->m[1][2] = mtx->m[1][3] = mtx->m[2][0] =
|
||||
mtx->m[2][1] = mtx->m[2][3] = 0.0f;
|
||||
mtx->m[0][0] = mtx->m[1][1] = mtx->m[2][2] = mtx->m[3][3] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,35 +137,21 @@ void Matrix_Scale(Matrix* mtx, f32 xScale, f32 yScale, f32 zScale, u8 mode) {
|
||||
s32 i;
|
||||
|
||||
if (mode == 1) {
|
||||
cmf->xx *= x;
|
||||
cmf->yx *= x;
|
||||
cmf->zx *= x;
|
||||
cmf->xy *= y;
|
||||
cmf->yy *= y;
|
||||
cmf->zy *= y;
|
||||
cmf->xz *= z;
|
||||
cmf->yz *= z;
|
||||
cmf->zz *= z;
|
||||
cmf->wx *= x;
|
||||
cmf->wy *= y;
|
||||
cmf->wz *= z;
|
||||
for (i = 0; i < 4; i++) {
|
||||
rx = mtx->m[0][i];
|
||||
ry = mtx->m[1][i];
|
||||
|
||||
mtx->m[0][i] = rx * xScale;
|
||||
mtx->m[1][i] = ry * yScale;
|
||||
mtx->m[2][i] *= zScale;
|
||||
}
|
||||
} else {
|
||||
cmf->yx = 0.0f;
|
||||
cmf->zx = 0.0f;
|
||||
cmf->wx = 0.0f;
|
||||
cmf->xy = 0.0f;
|
||||
cmf->zy = 0.0f;
|
||||
cmf->wy = 0.0f;
|
||||
cmf->xz = 0.0f;
|
||||
cmf->yz = 0.0f;
|
||||
cmf->wz = 0.0f;
|
||||
cmf->xw = 0.0f;
|
||||
cmf->yw = 0.0f;
|
||||
cmf->zw = 0.0f;
|
||||
cmf->ww = 1.0f;
|
||||
cmf->xx = x;
|
||||
cmf->yy = y;
|
||||
cmf->zz = z;
|
||||
mtx->m[0][0] = xScale;
|
||||
mtx->m[1][1] = yScale;
|
||||
mtx->m[2][2] = zScale;
|
||||
mtx->m[0][1] = mtx->m[0][2] = mtx->m[0][3] = mtx->m[1][0] = mtx->m[1][2] = mtx->m[1][3] = mtx->m[2][0] =
|
||||
mtx->m[2][1] = mtx->m[2][3] = mtx->m[3][0] = mtx->m[3][1] = mtx->m[3][2] = 0.0f;
|
||||
mtx->m[3][3] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,60 +163,23 @@ void Matrix_RotateX(Matrix* mtx, f32 angle, u8 mode) {
|
||||
f32 rz;
|
||||
s32 i;
|
||||
|
||||
sn = __sinf(angle);
|
||||
cs = __cosf(angle);
|
||||
if (mode == 1) {
|
||||
if (x != 0) {
|
||||
cmf = mtx->m;
|
||||
for (i = 0; i < 4; i++) {
|
||||
ry = mtx->m[1][i];
|
||||
rz = mtx->m[2][i];
|
||||
|
||||
sin = __sinf(x);
|
||||
cos = __cosf(x);
|
||||
|
||||
tempY = cmf->xy;
|
||||
tempZ = cmf->xz;
|
||||
cmf->xy = tempY * cos + tempZ * sin;
|
||||
cmf->xz = tempZ * cos - tempY * sin;
|
||||
|
||||
tempY = cmf->yy;
|
||||
tempZ = cmf->yz;
|
||||
cmf->yy = tempY * cos + tempZ * sin;
|
||||
cmf->yz = tempZ * cos - tempY * sin;
|
||||
|
||||
tempY = cmf->zy;
|
||||
tempZ = cmf->zz;
|
||||
cmf->zy = tempY * cos + tempZ * sin;
|
||||
cmf->zz = tempZ * cos - tempY * sin;
|
||||
|
||||
tempY = cmf->wy;
|
||||
tempZ = cmf->wz;
|
||||
cmf->wy = tempY * cos + tempZ * sin;
|
||||
cmf->wz = tempZ * cos - tempY * sin;
|
||||
mtx->m[1][i] = (ry * cs) + (rz * sn);
|
||||
mtx->m[2][i] = (rz * cs) - (ry * sn);
|
||||
}
|
||||
} else {
|
||||
cmf = mtx->m;
|
||||
|
||||
if (x != 0) {
|
||||
sin = __sinf(x);
|
||||
cos = __cosf(x);
|
||||
} else {
|
||||
sin = zero;
|
||||
cos = one;
|
||||
}
|
||||
|
||||
cmf->xx = one;
|
||||
cmf->yx = zero;
|
||||
cmf->zx = zero;
|
||||
cmf->wx = zero;
|
||||
cmf->xy = zero;
|
||||
cmf->yy = cos;
|
||||
cmf->zy = sin;
|
||||
cmf->wy = zero;
|
||||
cmf->xz = zero;
|
||||
cmf->yz = -sin;
|
||||
cmf->zz = cos;
|
||||
cmf->wz = zero;
|
||||
cmf->xw = zero;
|
||||
cmf->yw = zero;
|
||||
cmf->zw = zero;
|
||||
cmf->ww = one;
|
||||
mtx->m[1][1] = mtx->m[2][2] = cs;
|
||||
mtx->m[1][2] = sn;
|
||||
mtx->m[2][1] = -sn;
|
||||
mtx->m[0][0] = mtx->m[3][3] = 1.0f;
|
||||
mtx->m[0][1] = mtx->m[0][2] = mtx->m[0][3] = mtx->m[1][0] = mtx->m[1][3] = mtx->m[2][0] = mtx->m[2][3] =
|
||||
mtx->m[3][0] = mtx->m[3][1] = mtx->m[3][2] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,60 +191,23 @@ void Matrix_RotateY(Matrix* mtx, f32 angle, u8 mode) {
|
||||
f32 rz;
|
||||
s32 i;
|
||||
|
||||
sn = __sinf(angle);
|
||||
cs = __cosf(angle);
|
||||
if (mode == 1) {
|
||||
if (y != 0.0f) {
|
||||
cmf = mtx->m;
|
||||
for (i = 0; i < 4; i++) {
|
||||
rx = mtx->m[0][i];
|
||||
rz = mtx->m[2][i];
|
||||
|
||||
sin = __sinf(y);
|
||||
cos = __cosf(y);
|
||||
|
||||
tempX = cmf->xx;
|
||||
tempZ = cmf->xz;
|
||||
cmf->xx = tempX * cos - tempZ * sin;
|
||||
cmf->xz = tempX * sin + tempZ * cos;
|
||||
|
||||
tempX = cmf->yx;
|
||||
tempZ = cmf->yz;
|
||||
cmf->yx = tempX * cos - tempZ * sin;
|
||||
cmf->yz = tempX * sin + tempZ * cos;
|
||||
|
||||
tempX = cmf->zx;
|
||||
tempZ = cmf->zz;
|
||||
cmf->zx = tempX * cos - tempZ * sin;
|
||||
cmf->zz = tempX * sin + tempZ * cos;
|
||||
|
||||
tempX = cmf->wx;
|
||||
tempZ = cmf->wz;
|
||||
cmf->wx = tempX * cos - tempZ * sin;
|
||||
cmf->wz = tempX * sin + tempZ * cos;
|
||||
mtx->m[0][i] = (rx * cs) - (rz * sn);
|
||||
mtx->m[2][i] = (rx * sn) + (rz * cs);
|
||||
}
|
||||
} else {
|
||||
cmf = mtx->m;
|
||||
|
||||
if (y != 0.0f) {
|
||||
sin = __sinf(y);
|
||||
cos = __cosf(y);
|
||||
} else {
|
||||
cos = one;
|
||||
sin = zero;
|
||||
}
|
||||
|
||||
cmf->yx = zero;
|
||||
cmf->wx = zero;
|
||||
cmf->xy = zero;
|
||||
cmf->zy = zero;
|
||||
cmf->wy = zero;
|
||||
cmf->yz = zero;
|
||||
cmf->wz = zero;
|
||||
cmf->xw = zero;
|
||||
cmf->yw = zero;
|
||||
cmf->zw = zero;
|
||||
cmf->yy = one;
|
||||
cmf->ww = one;
|
||||
cmf->xx = cos;
|
||||
cmf->zz = cos;
|
||||
cmf->zx = -sin;
|
||||
cmf->xz = sin;
|
||||
mtx->m[0][0] = mtx->m[2][2] = cs;
|
||||
mtx->m[0][2] = -sn;
|
||||
mtx->m[2][0] = sn;
|
||||
mtx->m[1][1] = mtx->m[3][3] = 1.0f;
|
||||
mtx->m[0][1] = mtx->m[0][3] = mtx->m[1][0] = mtx->m[1][2] = mtx->m[1][3] = mtx->m[2][1] = mtx->m[2][3] =
|
||||
mtx->m[3][0] = mtx->m[3][1] = mtx->m[3][2] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@ -450,154 +219,117 @@ void Matrix_RotateZ(Matrix* mtx, f32 angle, u8 mode) {
|
||||
f32 ry;
|
||||
s32 i;
|
||||
|
||||
sn = __sinf(angle);
|
||||
cs = __cosf(angle);
|
||||
if (mode == 1) {
|
||||
if (z != 0) {
|
||||
cmf = mtx->m;
|
||||
for (i = 0; i < 4; i++) {
|
||||
rx = mtx->m[0][i];
|
||||
ry = mtx->m[1][i];
|
||||
|
||||
sin = __sinf(z);
|
||||
cos = __cosf(z);
|
||||
|
||||
tempX = cmf->xx;
|
||||
tempY = cmf->xy;
|
||||
cmf->xx = tempX * cos + tempY * sin;
|
||||
cmf->xy = tempY * cos - tempX * sin;
|
||||
|
||||
tempX = cmf->yx;
|
||||
tempY = cmf->yy;
|
||||
cmf->yx = tempX * cos + tempY * sin;
|
||||
cmf->yy = tempY * cos - tempX * sin;
|
||||
|
||||
tempX = cmf->zx;
|
||||
tempY = cmf->zy;
|
||||
cmf->zx = tempX * cos + tempY * sin;
|
||||
cmf->zy = tempY * cos - tempX * sin;
|
||||
|
||||
tempX = cmf->wx;
|
||||
tempY = cmf->wy;
|
||||
cmf->wx = tempX * cos + tempY * sin;
|
||||
cmf->wy = tempY * cos - tempX * sin;
|
||||
mtx->m[0][i] = (rx * cs) + (ry * sn);
|
||||
mtx->m[1][i] = (ry * cs) - (rx * sn);
|
||||
}
|
||||
} else {
|
||||
cmf = mtx->m;
|
||||
|
||||
if (z != 0) {
|
||||
sin = __sinf(z);
|
||||
cos = __cosf(z);
|
||||
} else {
|
||||
sin = 0.0f;
|
||||
cos = 1.0f;
|
||||
}
|
||||
|
||||
cmf->zx = 0.0f;
|
||||
cmf->wx = 0.0f;
|
||||
cmf->zy = 0.0f;
|
||||
cmf->wy = 0.0f;
|
||||
cmf->xz = 0.0f;
|
||||
cmf->yz = 0.0f;
|
||||
cmf->wz = 0.0f;
|
||||
cmf->xw = 0.0f;
|
||||
cmf->yw = 0.0f;
|
||||
cmf->zw = 0.0f;
|
||||
cmf->zz = 1.0f;
|
||||
cmf->ww = 1.0f;
|
||||
cmf->xx = cos;
|
||||
cmf->yy = cos;
|
||||
cmf->yx = sin;
|
||||
cmf->xy = -sin;
|
||||
mtx->m[0][0] = mtx->m[1][1] = cs;
|
||||
mtx->m[0][1] = sn;
|
||||
mtx->m[1][0] = -sn;
|
||||
mtx->m[2][2] = mtx->m[3][3] = 1.0f;
|
||||
mtx->m[0][2] = mtx->m[0][3] = mtx->m[1][2] = mtx->m[1][3] = mtx->m[2][0] = mtx->m[2][1] = mtx->m[2][3] =
|
||||
mtx->m[3][0] = mtx->m[3][1] = mtx->m[3][2] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Creates rotation matrix about a given vector axis in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY).
|
||||
// The vector specifying the axis does not need to be a unit vector.
|
||||
void Matrix_RotateAxis(Matrix* mtx, f32 angle, f32 x, f32 y, f32 z, u8 mode) {
|
||||
MtxF* cmf;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
f32 versin;
|
||||
f32 temp1;
|
||||
f32 temp2;
|
||||
f32 temp3;
|
||||
f32 temp4;
|
||||
void Matrix_RotateAxis(Matrix* mtx, f32 angle, f32 axisX, f32 axisY, f32 axisZ, u8 mode) {
|
||||
f32 rx;
|
||||
f32 ry;
|
||||
f32 rz;
|
||||
f32 norm;
|
||||
f32 cxx;
|
||||
f32 cyx;
|
||||
f32 czx;
|
||||
f32 cxy;
|
||||
f32 cyy;
|
||||
f32 czy;
|
||||
f32 cxz;
|
||||
f32 cyz;
|
||||
f32 czz;
|
||||
f32 xx;
|
||||
f32 yy;
|
||||
f32 zz;
|
||||
f32 xy;
|
||||
f32 yz;
|
||||
f32 xz;
|
||||
f32 sinA;
|
||||
f32 cosA;
|
||||
|
||||
norm = sqrtf((axisX * axisX) + (axisY * axisY) + (axisZ * axisZ));
|
||||
if (norm != 0.0) {
|
||||
axisX /= norm;
|
||||
axisY /= norm;
|
||||
axisZ /= norm;
|
||||
sinA = __sinf(angle);
|
||||
cosA = __cosf(angle);
|
||||
xx = axisX * axisX;
|
||||
yy = axisY * axisY;
|
||||
zz = axisZ * axisZ;
|
||||
xy = axisX * axisY;
|
||||
yz = axisY * axisZ;
|
||||
xz = axisX * axisZ;
|
||||
|
||||
if (mode == 1) {
|
||||
if (angle != 0) {
|
||||
cmf = mtx->m;
|
||||
cxx = (1.0f - xx) * cosA + xx;
|
||||
cyx = (1.0f - cosA) * xy + axisZ * sinA;
|
||||
czx = (1.0f - cosA) * xz - axisY * sinA;
|
||||
|
||||
sin = __sinf(angle);
|
||||
cos = __cosf(angle);
|
||||
cxy = (1.0f - cosA) * xy - axisZ * sinA;
|
||||
cyy = (1.0f - yy) * cosA + yy;
|
||||
czy = (1.0f - cosA) * yz + axisX * sinA;
|
||||
|
||||
temp1 = cmf->xx;
|
||||
temp2 = cmf->xy;
|
||||
temp3 = cmf->xz;
|
||||
temp4 = (x * temp1 + y * temp2 + z * temp3) * (1.0f - cos);
|
||||
cmf->xx = temp1 * cos + x * temp4 + sin * (temp2 * z - temp3 * y);
|
||||
cmf->xy = temp2 * cos + y * temp4 + sin * (temp3 * x - temp1 * z);
|
||||
cmf->xz = temp3 * cos + z * temp4 + sin * (temp1 * y - temp2 * x);
|
||||
cxz = (1.0f - cosA) * xz + axisY * sinA;
|
||||
cyz = (1.0f - cosA) * yz - axisX * sinA;
|
||||
czz = (1.0f - zz) * cosA + zz;
|
||||
|
||||
temp1 = cmf->yx;
|
||||
temp2 = cmf->yy;
|
||||
temp3 = cmf->yz;
|
||||
temp4 = (x * temp1 + y * temp2 + z * temp3) * (1.0f - cos);
|
||||
cmf->yx = temp1 * cos + x * temp4 + sin * (temp2 * z - temp3 * y);
|
||||
cmf->yy = temp2 * cos + y * temp4 + sin * (temp3 * x - temp1 * z);
|
||||
cmf->yz = temp3 * cos + z * temp4 + sin * (temp1 * y - temp2 * x);
|
||||
// loop doesn't seem to work here.
|
||||
rx = mtx->m[0][0];
|
||||
ry = mtx->m[0][1];
|
||||
rz = mtx->m[0][2];
|
||||
mtx->m[0][0] = (rx * cxx) + (ry * cxy) + (rz * cxz);
|
||||
mtx->m[0][1] = (rx * cyx) + (ry * cyy) + (rz * cyz);
|
||||
mtx->m[0][2] = (rx * czx) + (ry * czy) + (rz * czz);
|
||||
|
||||
temp1 = cmf->zx;
|
||||
temp2 = cmf->zy;
|
||||
temp3 = cmf->zz;
|
||||
temp4 = (x * temp1 + y * temp2 + z * temp3) * (1.0f - cos);
|
||||
cmf->zx = temp1 * cos + x * temp4 + sin * (temp2 * z - temp3 * y);
|
||||
cmf->zy = temp2 * cos + y * temp4 + sin * (temp3 * x - temp1 * z);
|
||||
cmf->zz = temp3 * cos + z * temp4 + sin * (temp1 * y - temp2 * x);
|
||||
}
|
||||
rx = mtx->m[1][0];
|
||||
ry = mtx->m[1][1];
|
||||
rz = mtx->m[1][2];
|
||||
mtx->m[1][0] = (rx * cxx) + (ry * cxy) + (rz * cxz);
|
||||
mtx->m[1][1] = (rx * cyx) + (ry * cyy) + (rz * cyz);
|
||||
mtx->m[1][2] = (rx * czx) + (ry * czy) + (rz * czz);
|
||||
|
||||
rx = mtx->m[2][0];
|
||||
ry = mtx->m[2][1];
|
||||
rz = mtx->m[2][2];
|
||||
mtx->m[2][0] = (rx * cxx) + (ry * cxy) + (rz * cxz);
|
||||
mtx->m[2][1] = (rx * cyx) + (ry * cyy) + (rz * cyz);
|
||||
mtx->m[2][2] = (rx * czx) + (ry * czy) + (rz * czz);
|
||||
} else {
|
||||
cmf = mtx->m;
|
||||
mtx->m[0][0] = (1.0f - xx) * cosA + xx;
|
||||
mtx->m[0][1] = (1.0f - cosA) * xy + axisZ * sinA;
|
||||
mtx->m[0][2] = (1.0f - cosA) * xz - axisY * sinA;
|
||||
mtx->m[0][3] = 0.0f;
|
||||
|
||||
if (angle != 0) {
|
||||
sin = __sinf(angle);
|
||||
cos = __cosf(angle);
|
||||
versin = 1.0f - cos;
|
||||
mtx->m[1][0] = (1.0f - cosA) * xy - axisZ * sinA;
|
||||
mtx->m[1][1] = (1.0f - yy) * cosA + yy;
|
||||
mtx->m[1][2] = (1.0f - cosA) * yz + axisX * sinA;
|
||||
mtx->m[1][3] = 0.0f;
|
||||
|
||||
cmf->xx = x * x * versin + cos;
|
||||
cmf->yy = y * y * versin + cos;
|
||||
cmf->zz = z * z * versin + cos;
|
||||
mtx->m[2][0] = (1.0f - cosA) * xz + axisY * sinA;
|
||||
mtx->m[2][1] = (1.0f - cosA) * yz - axisX * sinA;
|
||||
mtx->m[2][2] = (1.0f - zz) * cosA + zz;
|
||||
mtx->m[2][3] = 0.0f;
|
||||
|
||||
if (0) {}
|
||||
|
||||
temp2 = x * versin * y;
|
||||
temp3 = z * sin;
|
||||
cmf->yx = temp2 + temp3;
|
||||
cmf->xy = temp2 - temp3;
|
||||
|
||||
temp2 = x * versin * z;
|
||||
temp3 = y * sin;
|
||||
cmf->zx = temp2 - temp3;
|
||||
cmf->xz = temp2 + temp3;
|
||||
|
||||
temp2 = y * versin * z;
|
||||
temp3 = x * sin;
|
||||
cmf->zy = temp2 + temp3;
|
||||
cmf->yz = temp2 - temp3;
|
||||
|
||||
cmf->wx = cmf->wy = cmf->wz = cmf->xw = cmf->yw = cmf->zw = 0.0f;
|
||||
cmf->ww = 1.0f;
|
||||
} else {
|
||||
cmf->xx = 1.0f;
|
||||
cmf->yx = 0.0f;
|
||||
cmf->zx = 0.0f;
|
||||
cmf->wx = 0.0f;
|
||||
cmf->xy = 0.0f;
|
||||
cmf->yy = 1.0f;
|
||||
cmf->zy = 0.0f;
|
||||
cmf->wy = 0.0f;
|
||||
cmf->xz = 0.0f;
|
||||
cmf->yz = 0.0f;
|
||||
cmf->zz = 1.0f;
|
||||
cmf->wz = 0.0f;
|
||||
cmf->xw = 0.0f;
|
||||
cmf->yw = 0.0f;
|
||||
cmf->zw = 0.0f;
|
||||
cmf->ww = 1.0f;
|
||||
mtx->m[3][0] = mtx->m[3][1] = mtx->m[3][2] = 0.0f;
|
||||
mtx->m[3][3] = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user