Skip to content

Commit

Permalink
Merge branch 'develop-zhora' of https://github.com/HarbourMasters/Shi…
Browse files Browse the repository at this point in the history
…pwright into custom-messages
  • Loading branch information
leggettc18 committed Jul 24, 2022
2 parents 21c585b + ffb3523 commit dca922a
Show file tree
Hide file tree
Showing 41 changed files with 8,680 additions and 247 deletions.
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -405,4 +405,14 @@ tags
oot.otr
*.sav
shipofharkinian.ini
shipofharkinian.json
shipofharkinian.json

# Xcode
xcuserdata/
*.xcconfig
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
**/xcshareddata/WorkspaceSettings.xcsettings
11 changes: 7 additions & 4 deletions OTRExporter/extract_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from rom_info import Z64Rom
import rom_chooser
import struct
import subprocess

def BuildOTR(xmlPath, rom):
shutil.copytree("assets", "Extract/assets")
Expand All @@ -13,11 +14,13 @@ def BuildOTR(xmlPath, rom):
with open("Extract/version", "wb") as f:
f.write(struct.pack('<L', checksum))

execStr = "x64\\Release\\ZAPD.exe" if sys.platform == "win32" else "../ZAPDTR/ZAPD.out"
execStr += " ed -i %s -b %s -fl CFG/filelists -o placeholder -osf placeholder -gsf 1 -rconf CFG/Config.xml -se OTR" % (xmlPath, rom)
zapd_exe = "x64\\Release\\ZAPD.exe" if sys.platform == "win32" else "../ZAPDTR/ZAPD.out"
exec_cmd = [zapd_exe, "ed", "-i", xmlPath, "-b", rom, "-fl", "CFG/filelists",
"-o", "placeholder", "-osf", "placeholder", "-gsf", "1",
"-rconf", "CFG/Config.xml", "-se", "OTR"]

print(execStr)
exitValue = os.system(execStr)
print(exec_cmd)
exitValue = subprocess.call(exec_cmd)
if exitValue != 0:
print("\n")
print("Error when building the OTR file...", file=os.sys.stderr)
Expand Down
14 changes: 11 additions & 3 deletions libultraship/libultraship/ControlDeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "Window.h"
#include "Controller.h"
#include "DisconnectedController.h"
#include "VirtualController.h"
#include "KeyboardController.h"
#include "SDLController.h"
#include <Utils/StringHelper.h>
Expand All @@ -27,8 +27,9 @@ void Ship::ControlDeck::ScanPhysicalDevices() {
}
}

physicalDevices.push_back(std::make_shared<VirtualController>("Auto", "Auto", true));
physicalDevices.push_back(std::make_shared<KeyboardController>());
physicalDevices.push_back(std::make_shared<DisconnectedController>());
physicalDevices.push_back(std::make_shared<VirtualController>("Disconnected", "None", false));

for (const auto& device : physicalDevices) {
for (int i = 0; i < MAXCONTROLLERS; i++) {
Expand All @@ -51,7 +52,14 @@ void Ship::ControlDeck::SetPhysicalDevice(int slot, int deviceSlot) {

void Ship::ControlDeck::WriteToPad(OSContPad* pad) const {
for (size_t i = 0; i < virtualDevices.size(); i++) {
physicalDevices[virtualDevices[i]]->Read(&pad[i], i);
const std::shared_ptr<Controller> backend = physicalDevices[virtualDevices[i]];
if (backend->GetGuid() == "Auto") {
for (const auto& device : physicalDevices) {
device->Read(&pad[i], i);
}
continue;
}
backend->Read(&pad[i], i);
}
}

Expand Down
2 changes: 1 addition & 1 deletion libultraship/libultraship/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Ship {

Controller::Controller() : isRumbling(false), wStickX(0), wStickY(0), wGyroX(0), wGyroY(0), dwPressedButtons(0){
Controller::Controller() : isRumbling(false), wStickX(0), wStickY(0), wGyroX(0), wGyroY(0), wCamX(0), wCamY(0), dwPressedButtons(0){
Attachment = nullptr;
profiles.resize(MAXCONTROLLERS);
for(int slot = 0; slot < MAXCONTROLLERS; slot++) {
Expand Down
44 changes: 40 additions & 4 deletions libultraship/libultraship/ImGuiImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,8 @@ namespace SohImGui {
EnhancementCheckbox("D-pad Support for Browsing Shop Items", "gDpadShop");
EnhancementCheckbox("D-pad as Equip Items", "gDpadEquips");
Tooltip("Allows the D-pad to be used as extra C buttons");
EnhancementCheckbox("Answer Navi Prompt with L Button", "gNaviOnL");
Tooltip("Speak to Navi with L but enter first-person camera with C-Up");
ImGui::Separator();

EnhancementCheckbox("Show Inputs", "gInputEnabled");
Expand Down Expand Up @@ -973,7 +975,12 @@ namespace SohImGui {
Tooltip("The default response to Kaepora Gaebora is\nalways that you understood what he said");
EnhancementCheckbox("Fast Ocarina Playback", "gFastOcarinaPlayback");
Tooltip("Skip the part where the Ocarina playback is called when you play\na song");

EnhancementCheckbox("Prevent Dropped Ocarina Inputs", "gDpadNoDropOcarinaInput");
Tooltip("Prevent dropping inputs when playing the ocarina quickly");
EnhancementCheckbox("Instant Putaway", "gInstantPutaway");
Tooltip("Allow Link to put items away without having to wait around");
EnhancementCheckbox("Mask Select in Inventory", "gMaskSelect");
Tooltip("After completing the mask trading sub-quest,\npress A and any direction on the mask slot to change masks");
ImGui::EndMenu();
}

Expand Down Expand Up @@ -1014,6 +1021,8 @@ namespace SohImGui {
Tooltip("Disables random drops, except from the Goron Pot, Dampe, and bosses");
EnhancementCheckbox("No Heart Drops", "gNoHeartDrops");
Tooltip("Disables heart drops, but not heart placements, like from a Deku Scrub running off\nThis simulates Hero Mode from other games in the series");
EnhancementCheckbox("Always Win Goron Pot", "gGoronPot");
Tooltip("Always get the heart piece/purple rupee from the spinning Goron pot");

if (ImGui::BeginMenu("Potion Values"))
{
Expand Down Expand Up @@ -1192,6 +1201,14 @@ namespace SohImGui {
Tooltip("Correctly centers the Navi text prompt on the HUD's C-Up button");
EnhancementCheckbox("Fix Anubis fireballs", "gAnubisFix");
Tooltip("Make Anubis fireballs do fire damage when reflected\nback at them with the Mirror Shield");
EnhancementCheckbox("Fix Megaton Hammer crouch stab", "gCrouchStabHammerFix");
Tooltip("Make the Megaton Hammer's crouch stab able to destroy\nrocks without first swinging it normally");
if (CVar_GetS32("gCrouchStabHammerFix", 0) == 0) {
CVar_SetS32("gCrouchStabFix", 0);
} else {
EnhancementCheckbox("Remove power crouch stab", "gCrouchStabFix");
Tooltip("Make crouch stabbing always do the same damage as a regular slash");
}

ImGui::EndMenu();
}
Expand Down Expand Up @@ -1239,6 +1256,15 @@ namespace SohImGui {

if (ImGui::SliderInt("##FPSInterpolation", &val, 20, 250, "", ImGuiSliderFlags_AlwaysClamp))
{
if (val > 250)
{
val = 250;
}
else if (val < 20)
{
val = 20;
}

CVar_SetS32(fps_cvar, val);
needs_save = true;
}
Expand Down Expand Up @@ -1335,10 +1361,20 @@ namespace SohImGui {
EnhancementCheckbox("OoT Debug Mode", "gDebugEnabled");
Tooltip("Enables Debug Mode, allowing you to select maps with L + R + Z, noclip with L + D-pad Right,\nand open the debug menu with L on the pause screen");
EnhancementCheckbox("Fast File Select", "gSkipLogoTitle");
Tooltip("Load the game to the selected slot below upon launch\nUse slot number 4 to load directly into the game's internal Map Select\n(Does not require the Debug Menu, but you will be unable to save there\nYou can also load the Map Select with OoT Debug Mode + slot 0)\nWith slot 0 you can directly go to the File Select menu\nAttention: loading an empty save file will result in a crash");
Tooltip("Load the game to the selected menu or file\n\"Zelda Map Select\" require debug mode else you will fallback to File choose menu\nUsing a file number that don't have save will create a save file only\nif you toggle on \"Create a new save if none ?\" else it will bring you to the\nFile choose menu");
if (CVar_GetS32("gSkipLogoTitle", 0)) {
EnhancementSliderInt("Loading %d", "##SaveFileID", "gSaveFileID", 0, 4, "");
}
const char* FastFileSelect[5] = {
"File N.1",
"File N.2",
"File N.3",
"File select",
"Zelda Map Select (require OoT Debug Mode)"
};
ImGui::Text("Loading :");
EnhancementCombobox("gSaveFileID", FastFileSelect, 5, 0);
EnhancementCheckbox("Create a new save if none", "gCreateNewSave");
Tooltip("Enable the creation of a new save file\nif none exist in the File number selected\nNo file name will be assigned please do in Save editor once you see the first text\nelse your save file name will be named \"00000000\"\nIf disabled you will fall back in File select menu");
};
ImGui::Separator();
EnhancementCheckbox("Stats", "gStatsEnabled");
Tooltip("Shows the stats window, with your FPS and frametimes,\nand the OS you're playing on");
Expand Down
4 changes: 2 additions & 2 deletions libultraship/libultraship/InputEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Ship {

float size = 40;
bool readingMode = BtnReading == n64Btn;
bool disabled = BtnReading != -1 && !readingMode || !backend->Connected();
bool disabled = (BtnReading != -1 && !readingMode) || !backend->Connected() || backend->GetGuid() == "Auto";
ImVec2 len = ImGui::CalcTextSize(label);
ImVec2 pos = ImGui::GetCursorPos();
ImGui::SetCursorPosY(pos.y + len.y / 4);
Expand Down Expand Up @@ -90,7 +90,7 @@ namespace Ship {
std::shared_ptr<Controller> Backend = devices[vDevices[CurrentPort]];
DeviceProfile& profile =Backend->profiles[CurrentPort];
float sensitivity = profile.Thresholds[SENSITIVITY];
bool IsKeyboard = Backend->GetGuid() == "Keyboard" || !Backend->Connected();
bool IsKeyboard = Backend->GetGuid() == "Keyboard" || Backend->GetGuid() == "Auto" || !Backend->Connected();
const char* ControllerName = Backend->GetControllerName();

if (ControllerName != nullptr && ImGui::BeginCombo("##ControllerEntries", ControllerName)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@

#include "Controller.h"

class DisconnectedController final : public Ship::Controller {
class VirtualController final : public Ship::Controller {
public:
DisconnectedController() {
GUID = "Disconnected";
VirtualController(const std::string& CUID, const std::string& KeyName, bool Connected) {
GUID = CUID;
isConnected = Connected;
ButtonName = KeyName;
}

std::map<std::vector<std::string>, int32_t> ReadButtonPress();
void ReadFromSource(int32_t slot) override {}
const char* GetControllerName() override { return "Disconnected"; }
const char* GetButtonName(int slot, int n64Button) override { return "None"; }
const char* GetControllerName() override { return GUID.c_str(); }
const char* GetButtonName(int slot, int n64Button) override { return ButtonName.c_str(); }
void WriteToSource(int32_t slot, ControllerCallback* controller) override { }
bool Connected() const override { return false; }
bool Connected() const override { return isConnected; }
bool CanRumble() const override { return false; }
bool CanGyro() const override { return false; }

Expand All @@ -25,6 +27,8 @@ class DisconnectedController final : public Ship::Controller {
std::optional<std::string> GetPadConfSection() { return "Unk"; }
void CreateDefaultBinding(int32_t slot) override {}
protected:
std::string ButtonName;
bool isConnected = false;
std::string GetControllerType() { return "Unk"; }
std::string GetConfSection() { return "Unk"; }
std::string GetBindingConfSection() { return "Unk"; }
Expand Down
2 changes: 1 addition & 1 deletion libultraship/libultraship/libultraship.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@
<ClCompile Include="SDLController.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="VirtualController.h" />
<ClInclude Include="Lib\Mercury\Mercury.h" />
<ClInclude Include="Lib\nlohmann\json.hpp" />
<ClInclude Include="abi.h" />
Expand All @@ -352,7 +353,6 @@
<ClInclude Include="Blob.h" />
<ClInclude Include="ControlDeck.h" />
<ClInclude Include="Cvar.h" />
<ClInclude Include="DisconnectedController.h" />
<ClInclude Include="Environment.h" />
<ClInclude Include="Factories\AudioFactory.h" />
<ClInclude Include="InputEditor.h" />
Expand Down
6 changes: 3 additions & 3 deletions libultraship/libultraship/libultraship.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -674,14 +674,14 @@
<ClInclude Include="ControlDeck.h">
<Filter>Source Files\Controller</Filter>
</ClInclude>
<ClInclude Include="DisconnectedController.h">
<Filter>Source Files\Controller</Filter>
</ClInclude>
<ClInclude Include="Lib\nlohmann\json.hpp">
<Filter>Source Files\Lib\nlohmann</Filter>
</ClInclude>
<ClInclude Include="Lib\Mercury\Mercury.h">
<Filter>Source Files\Lib\Mercury</Filter>
</ClInclude>
<ClInclude Include="VirtualController.h">
<Filter>Source Files\Controller</Filter>
</ClInclude>
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions soh/include/message_data_static.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ typedef enum {
typedef enum {
/* 0 */ TEXTBOX_POS_VARIABLE,
/* 1 */ TEXTBOX_POS_TOP,
/* 2 */ TEXTBOX_POS_BOTTOM,
/* 3 */ TEXTBOX_POS_MIDDLE
/* 2 */ TEXTBOX_POS_MIDDLE,
/* 3 */ TEXTBOX_POS_BOTTOM
} TextBoxPosition;

typedef struct {
Expand Down
36 changes: 36 additions & 0 deletions soh/macosx/Xcode-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string></string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleGetInfoString</key>
<string>3.0.0</string>
<key>CFBundleIconFile</key>
<string>soh</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Ship of Harkinian</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>RACHAEL ALFA</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2022 HarbourMasters.</string>
</dict>
</plist>
Loading

0 comments on commit dca922a

Please sign in to comment.