summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenix3 <kenixwhisperwind@gmail.com>2023-05-04 23:56:57 -0400
committerGitHub <noreply@github.com>2023-05-04 23:56:57 -0400
commitf9cfcde6274fc8a9678ead05616ae5587630b6f2 (patch)
tree7168fb3ad981823bc5fcce75419a01f2596186e7
parentc3ba15ed57c7e238312f763e8390fbe424ecf27a (diff)
Lus updates (#2835)
* Changes for LUS renames in ResourceManager and Archive. * Moves WriteSaveFile and ReadSaveFile to SaveManager. * Removes ImGui namespace. * Bump LUS * Updates gitignore for intellij projects. * Controller usage is now up to date with newest LUS. * Adapters for removal of Controller.WriteToSource from LUS. * Uses correct capitalization on Controller.GetProfile() * Bump LUS --------- Co-authored-by: Christopher Leggett <chris@leggett.dev>
-rw-r--r--.gitignore2
m---------libultraship0
-rw-r--r--soh/soh/OTRGlobals.cpp29
-rw-r--r--soh/src/code/padmgr.c16
4 files changed, 31 insertions, 16 deletions
diff --git a/.gitignore b/.gitignore
index af0068765..3ef2451d2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,7 +7,7 @@ __pycache__/
.vscode/
.vs/
.idea/
-cmake-build-debug
+cmake-build-**
venv/
.cache/
diff --git a/libultraship b/libultraship
-Subproject 7fe0c076a8261d7e878b196d2b5de57beccf117
+Subproject f9e554dc214c2f23cfc74a26348ef9fd3055451
diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp
index afb3a82a6..b684e3143 100644
--- a/soh/soh/OTRGlobals.cpp
+++ b/soh/soh/OTRGlobals.cpp
@@ -1576,12 +1576,27 @@ extern "C" uint32_t OTRGetCurrentHeight() {
return OTRGlobals::Instance->context->GetCurrentHeight();
}
-extern "C" void OTRControllerCallback(ControllerCallback* controller) {
+extern "C" void OTRControllerCallback(uint8_t rumble, uint8_t ledColor) {
auto controlDeck = Ship::Window::GetInstance()->GetControlDeck();
- for (int i = 0; i < controlDeck->GetNumVirtualDevices(); ++i) {
- auto physicalDevice = controlDeck->GetPhysicalDeviceFromVirtualSlot(i);
- physicalDevice->WriteToSource(i, controller);
+ for (int i = 0; i < controlDeck->GetNumConnectedPorts(); ++i) {
+ auto physicalDevice = controlDeck->GetDeviceFromPortIndex(i);
+ switch (ledColor) {
+ case 0:
+ physicalDevice->SetLed(i, 255, 0, 0);
+ break;
+ case 1:
+ physicalDevice->SetLed(i, 0x1E, 0x69, 0x1B);
+ break;
+ case 2:
+ physicalDevice->SetLed(i, 0x64, 0x14, 0x00);
+ break;
+ case 3:
+ physicalDevice->SetLed(i, 0x00, 0x3C, 0x64);
+ break;
+ }
+
+ physicalDevice->SetRumble(i, rumble);
}
}
@@ -1627,10 +1642,10 @@ extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) {
extern "C" int Controller_ShouldRumble(size_t slot) {
auto controlDeck = Ship::Window::GetInstance()->GetControlDeck();
- if (slot < controlDeck->GetNumVirtualDevices()) {
- auto physicalDevice = controlDeck->GetPhysicalDeviceFromVirtualSlot(slot);
+ if (slot < controlDeck->GetNumConnectedPorts()) {
+ auto physicalDevice = controlDeck->GetDeviceFromPortIndex(slot);
- if (physicalDevice->getProfile(slot)->UseRumble && physicalDevice->CanRumble()) {
+ if (physicalDevice->GetProfile(slot)->UseRumble && physicalDevice->CanRumble()) {
return 1;
}
}
diff --git a/soh/src/code/padmgr.c b/soh/src/code/padmgr.c
index cfc0c05b5..ac0bfc2c6 100644
--- a/soh/src/code/padmgr.c
+++ b/soh/src/code/padmgr.c
@@ -11,8 +11,6 @@ extern void* __cdecl memset(_Out_writes_bytes_all_(_Size) void* _Dst, _In_ int _
s32 D_8012D280 = 1;
-static ControllerCallback controllerCallback;
-
OSMesgQueue* PadMgr_LockSerialMesgQueue(PadMgr* padMgr) {
OSMesgQueue* ctrlrQ = NULL;
@@ -296,25 +294,27 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) {
input->press.stick_y += (s8)(input->cur.stick_y - input->prev.stick_y);
}
- controllerCallback.rumble = (padMgr->rumbleEnable[0] > 0);
+ uint8_t rumble = (padMgr->rumbleEnable[0] > 0);
+ uint8_t ledColor = 1;
if (HealthMeter_IsCritical()) {
- controllerCallback.ledColor = 0;
+ ledColor = 0;
} else if (gPlayState) {
switch (CUR_EQUIP_VALUE(EQUIP_TUNIC) - 1) {
case PLAYER_TUNIC_KOKIRI:
- controllerCallback.ledColor = 1;
+ ledColor = 1;
break;
case PLAYER_TUNIC_GORON:
- controllerCallback.ledColor = 2;
+ ledColor = 2;
break;
case PLAYER_TUNIC_ZORA:
- controllerCallback.ledColor = 3;
+ ledColor = 3;
break;
}
}
- OTRControllerCallback(&controllerCallback);
+ OTRControllerCallback(rumble, ledColor);
+
if (CVarGetInteger("gPauseBufferBlockInputFrame", 0)) {
Controller_BlockGameInput();
} else {