Skip to content

Commit

Permalink
1.1.0 (#86)
Browse files Browse the repository at this point in the history
* memfile fix attempt

* memfile fix

* update pr branch

* readd crash address for pr tests

* fix other refs

* copy pasta

* more granular actor pos/angle control

* simplify menu closing logic, add proc id to actor list

* migrate checkers to their own menu

* minor cleanup

* more actor view optimizations

* skip startup logos

* rm extra mappings in tools menu

* lfc checker wip

* use new docker image(s)

* tell dme about the env it's running in

* crash test

* fix: Crash test at the end of main

* removed redundant declaration

* rm crash test

* actor view address, update button combo checks for pause/delete

* skip wii intros

* rm extra testing

* remove counters from save manager

* use fpcEx_Search

* very basic sound test menu

* add set scent option in pause menu

* rm debug logging

* ee checker

* golden bugs menu

* allow setting of charlo donation

* add leever range viewer

* add funraising flags, sort rupee flags into their own menu

* sort pause menu into sub menus

* sort tools menu into sub menus

* intro cs flag WIP

* fix actor spawner

* add coro/rusl td

* update hundo saves, add stage info display

* updating (simplifying) docker config

* added wii BiTE saves

* Update README.md

Removed comment about the old patcher using a lot of memory.

* account for dScnLogo_c size difference on PAL

* rm wii fade on warning menu

* use same class name for dScnLogo_c

* add missing enum

* keep fade function

* rm intro cs flag feature for now

* fix bombs

* update release automation

* fixed wii nand writing

---------

Co-authored-by: kipcode66 <[email protected]>
Co-authored-by: TakaRikka <[email protected]>
Co-authored-by: kipcode66 <[email protected]>
  • Loading branch information
4 people authored Sep 28, 2024
1 parent dac181e commit f967268
Show file tree
Hide file tree
Showing 280 changed files with 7,144 additions and 1,507 deletions.
23 changes: 3 additions & 20 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,22 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/ubuntu/.devcontainer/base.Dockerfile

# [Choice] Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon): ubuntu-22.04, ubuntu-20.04, ubuntu-18.04
ARG VARIANT="jammy"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
USER vscode
FROM devkitpro/devkitppc

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

RUN sudo dpkg --add-architecture i386
#RUN sudo dpkg --add-architecture i386
RUN sudo apt-get update && sudo apt-get install -y build-essential
RUN sudo apt-get install -y python3-pip
RUN sudo apt-get install -y libarchive-tools
RUN sudo apt-get install -y clang-format-10
RUN sudo apt-get install -y libarchive-tools
RUN sudo apt-get install -y cmake
# RUN sudo apt-get install -y wine64
# RUN sudo apt-get install -y wine
RUN sudo apt-get install -y ninja-build
RUN sudo apt-get upgrade -y
RUN sudo apt-get install -y libtinfo5

RUN python3 -m pip install Pillow

# Install DevkitPPC
RUN sudo ln -sf /proc/self/mounts /etc/mtab
WORKDIR /tmp
COPY install-devkitpro-pacman install-devkitpro-pacman
RUN sudo chmod +x ./install-devkitpro-pacman
RUN sudo ./install-devkitpro-pacman
RUN sudo dkp-pacman -Syu --noconfirm
WORKDIR /etc
RUN sudo ln -sf /proc/self/mounts mtab
RUN sudo dkp-pacman -S --noconfirm gamecube-dev wii-dev

# # Install the patchers
# WORKDIR /workspaces/romhack/wii
# RUN curl -L https://github.com/zsrtp/romhack-compiler/releases/download/v0.1.1-r2/romhack-v0.1.1-r2-linux-x64-musl.zip | bsdtar -xvf -
Expand Down
45 changes: 28 additions & 17 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,43 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.241.1/containers/ubuntu
{
"name": "Ubuntu",
"name": "TGPZ",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04
// Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon.
"args": { "VARIANT": "ubuntu-20.04" }
"dockerfile": "Dockerfile"
},
"extensions": [
"ms-vscode.cpptools-extension-pack",
"ms-vscode.makefile-tools",
"ms-python.python",
"ms-vscode.hexeditor",
"twxs.cmake",
"Gruntfuggly.todo-tree",
"bungcip.better-toml",
"mhutchie.git-graph"
],
"features": {
"ghcr.io/devcontainers/features/python:1": {
"version": "3.12.5"
}
},

"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools-extension-pack",
"ms-vscode.makefile-tools",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.vscode-pylance",
"ms-vscode.hexeditor",
"twxs.cmake",
"Gruntfuggly.todo-tree",
"bungcip.better-toml",
"mhutchie.git-graph"
]
}
},

"onCreateCommand": "python3 -m pip install Pillow pycryptodome",

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"runArgs": [
"--network=host"
],
]

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
//"remoteUser": "vscode"
}
6 changes: 3 additions & 3 deletions .github/workflows/multi-region-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Multi-Region Tests

on:
pull_request:
branches: [ master ]
branches: [ main ]

jobs:
build:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
dolphin_memory: "0x8044A6C0"
iso_name: tpgz.iso
container:
image: ghcr.io/pheenoh/zsrtp-tpgz:${{ matrix.container }}
image: ghcr.io/zsrtp/zsrtp-tpgz:${{ matrix.container }}
options: --shm-size=128m --ulimit core=-1 --privileged=true
name: ${{ matrix.platform }}-${{ matrix.region }} Test
steps:
Expand All @@ -70,4 +70,4 @@ jobs:
run: |
dolphin-emu-nogui --platform=headless --video_backend=Null -e build/${{ matrix.iso_name }} &
sleep 15
/dme -c ${{ matrix.dolphin_memory }}
dme -d dolphin-emu-nog -a ${{ matrix.dolphin_memory }} -q 0 --platform offscreen
7 changes: 7 additions & 0 deletions .github/workflows/tpgz-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ jobs:
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Download existing meta.json
run: aws s3 cp s3://${{ secrets.AWS_S3_BUCKET }}/patches/meta.json meta.json
- name: Update meta.json
run: |
python3 external/misc/meta.py
- name: Upload updated meta.json to S3
run: aws s3 cp meta.json s3://${{ secrets.AWS_S3_BUCKET }}/patches/meta.json --acl public-read
- name: Sync directory to S3
run: |
aws s3 sync patches/ s3://${{ secrets.AWS_S3_BUCKET }}/patches/ --acl public-read
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ include(cmake/relmapper.cmake)
include(cmake/fonts.cmake)

project(TPGZ
VERSION 1.0.0
VERSION 1.1.0
DESCRIPTION "Twilight Princess speedrunning practice and testing tool"
HOMEPAGE_URL "tpgz.io"
LANGUAGES C CXX ASM)
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ A *Twilight Princess* ROM hack for speedrun practice and research.

## Download
### Web
Patch your TP (GameCube) rom on the web using our website [tpgz.io](https://tpgz.io).
- This uses a lot of memory, so it requires a decent computer.
- The Wii version is currently not supported for web patching. Please follow the offline patching guide.
Patch your TP (GameCube/Wii) rom on the web using our website [tpgz.io](https://tpgz.io).

### Offline
To patch your rom offline, please follow our [guide](./docs/CreatingAnIso.md).
Expand Down
4 changes: 2 additions & 2 deletions RomHack.toml.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ iso = "@TPGZ_CFG_BLD_ISO@"
"tpgz/save_files/any" = "../@TPGZ_CFG_SAVE_ANY_PATH@/any"

# any% bite saves
"tpgz/save_files/any_bite.bin" = "../res/save_files/any_bite.bin"
"tpgz/save_files/any_bite" = "../res/save_files/any_bite"
"tpgz/save_files/any_bite.bin" = "../@TPGZ_CFG_SAVE_ANY_PATH@/any_bite.bin"
"tpgz/save_files/any_bite" = "../@TPGZ_CFG_SAVE_ANY_PATH@/any_bite"

# 100% saves
"tpgz/save_files/hundo.bin" = "../res/save_files/hundo.bin"
Expand Down
4 changes: 4 additions & 0 deletions external/gcn_c/include/nand.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#define NAND_OPEN_WRITE 0x02
#define NAND_OPEN_RW (NAND_OPEN_READ | NAND_OPEN_WRITE)

#define NAND_SEEK_BEG 0
#define NAND_SEEK_CUR 1
#define NAND_SEEK_END 2

typedef struct NANDInfo {
uint8_t unk[0x90];
} NANDInfo;
Expand Down
48 changes: 34 additions & 14 deletions external/gcn_c/include/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@
#define OPEN_MODE_READ
#define OPEN_MODE_WRITE
#define OPEN_MODE_RW
#define STORAGE_SEEK_BEG 0
#define STORAGE_SEEK_CUR 1
#define STORAGE_SEEK_END 2
#else // WII_PLATFORM
#include "nand.h"
#define STORAGE_FILENAME_MAX NAND_FILENAME_MAX
#define FileInfo NANDInfo
#define OPEN_MODE_READ NAND_OPEN_READ
#define OPEN_MODE_WRITE NAND_OPEN_WRITE
#define OPEN_MODE_RW NAND_OPEN_RW
#define STORAGE_SEEK_BEG NAND_SEEK_BEG
#define STORAGE_SEEK_CUR NAND_SEEK_CUR
#define STORAGE_SEEK_END NAND_SEEK_END
#endif // WII_PLATFORM

enum StorageError {
Expand Down Expand Up @@ -45,17 +51,34 @@ typedef struct Storage {
int32_t result;
char file_name_buffer[STORAGE_FILENAME_MAX * 2];
uint32_t result_size;
uint32_t position;
} Storage;

#ifndef WII_PLATFORM
#define StorageCreate(ch, fileName, size, fileBuffer) CARDCreate(ch, fileName, size, fileBuffer)
#define StorageDelete(ch, fileName) CARDDelete(ch, fileName)
#define StorageOpen(ch, fileName, fileInfo, mode) CARDOpen(ch, fileName, fileInfo)
#define StorageClose(fileInfo) CARDClose(fileInfo)
#define StorageRead(storage, data, length, offset) \
({ (storage).result = CARDRead(&(storage).info, data, length, offset); })
#define StorageWrite(storage, data, length, offset) \
({ (storage).result = CARDWrite(&(storage).info, data, length, offset); })
#define StorageRead(storage, data, length) \
({ (storage).result = CARDRead(&(storage).info, data, length, (storage).position); (storage).position += length; (storage).result; })
#define StorageWrite(storage, data, length) \
({ (storage).result = CARDWrite(&(storage).info, data, length, (storage).position); (storage).position += length; (storage).result; })
inline int32_t StorageSeek(Storage* storage, int32_t offset, int32_t whence) {
switch (whence) {
case STORAGE_SEEK_BEG:
storage->position = (uint32_t)offset;
break;
case STORAGE_SEEK_CUR:
storage->position += offset;
break;
case STORAGE_SEEK_END:
storage->position = storage->info.length + offset;
break;
default:
return IoError;
}
return storage->position;
}
#else // WII_PLATFORM
#define StorageCreate(ch, fileName, size, fileBuffer) \
({ \
Expand All @@ -66,20 +89,17 @@ typedef struct Storage {
#define StorageDelete(ch, fileName) NANDDelete(fileName)
#define StorageOpen(ch, fileName, fileInfo, mode) NANDOpen(fileName, fileInfo, mode)
#define StorageClose(fileInfo) NANDClose(fileInfo)
#define StorageRead(storage, data, length, offset) \
#define StorageRead(storage, data, length) \
({ \
(storage).result = NANDSeek(&(storage).info, offset, 0); \
if ((storage).result == Ready) { \
(storage).result_size = NANDRead(&(storage).info, data, length); \
} \
(storage).result_size = NANDRead(&(storage).info, data, length); \
(storage).result = Ready; \
})
#define StorageWrite(storage, data, length, offset) \
#define StorageWrite(storage, data, length) \
({ \
(storage).result = NANDSeek(&(storage).info, offset, 0); \
if ((storage).result == Ready) { \
(storage).result_size = NANDWrite(&(storage).info, data, length); \
} \
(storage).result_size = NANDWrite(&(storage).info, data, length); \
(storage).result = Ready; \
})
#define StorageSeek(storage, offset, whence) NANDSeek(&(*(storage)).info, offset, whence)
#endif // WII_PLATFORM

#endif // __STORAGE_H__
27 changes: 23 additions & 4 deletions external/libtp_c/include/JSystem/JAudio2/JAISound.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,31 @@

class JAISoundID {
public:
operator u32() const { return this->mId; }
JAISoundID(u32 pId) { mId = pId; };
operator u32() const { return this->mId.mFullId; }

JAISoundID(u32 pId) { mId.mFullId = pId; };

JAISoundID(JAISoundID const& other) { mId = other.mId; };

JAISoundID() {}

private:
u32 mId;
bool isAnonymous() { return mId.mFullId == 0xffffffff; }
void setAnonymous() { mId.mFullId = -1; }

union {
u32 mFullId;
struct {
u8 b0;
u8 b1;
u8 b2;
u8 b3;
} mBytes;
struct {
u16 mSoundType;
u16 mShortId;
} mAdvancedId; // Debug doesn't have an inline for referencing the short ID so I assume
// it's similar to this
} mId;
};

struct JASTrack {};
Expand Down
22 changes: 22 additions & 0 deletions external/libtp_c/include/SSystem/SComponent/c_phase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef C_PHASE_H
#define C_PHASE_H

#include "../../dolphin/types.h"

typedef int (*cPhs__Handler)(void*);

enum cPhs__Step {
/* 0x0 */ cPhs_INIT_e,
/* 0x1 */ cPhs_LOADING_e,
/* 0x2 */ cPhs_NEXT_e,
/* 0x3 */ cPhs_UNK3_e, // appears to be an alternate error code, unsure how it differs
/* 0x4 */ cPhs_COMPLEATE_e,
/* 0x5 */ cPhs_ERROR_e,
};

typedef struct request_of_phase_process_class {
cPhs__Handler* mpHandlerTable;
int id;
} request_of_phase_process_class;

#endif
23 changes: 20 additions & 3 deletions external/libtp_c/include/Z2AudioLib/Z2AudioMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "Z2SoundStarter.h"
#include "Z2SpeechMgr2.h"
#include "Z2StatusMgr.h"
#include "../defines.h"

#ifdef GCN_PLATFORM
class Z2AudioMgr {
Expand Down Expand Up @@ -62,8 +63,24 @@ class Z2AudioMgr {
};
#endif

/* inline Z2AudioMgr* Z2GetAudioMgr() {
return Z2AudioMgr::getInterface();
} */
#ifdef WII_PLATFORM
#define mAudioMgrPtr Z2SeMgr__mAudioMgrPtr
#else
#define mAudioMgrPtr mAudioMgrPtr__10Z2AudioMgr
#endif

extern "C" Z2AudioMgr* mAudioMgrPtr;

inline Z2AudioMgr* Z2GetAudioMgr() {
return mAudioMgrPtr;
}

LIBTP_DEFINE_FUNC(seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc,
Z2SeMgr__seStart_JAISoundID__Vec_const____unsigned_long__signed_char__float__float__float__float__unsigned_char_,
bool, Z2SeMgr__seStart, (Z2SeMgr*, JAISoundID, Vec const*, u32, s8, f32, f32, f32, f32, u8))

LIBTP_DEFINE_FUNC(seStop__7Z2SeMgrF10JAISoundIDUl,
Z2SeMgr__seStop_JAISoundID__unsigned_long_,
bool, Z2SeMgr__seStop, (Z2SeMgr*, JAISoundID, u32))

#endif /* Z2AUDIOMGR_H */
Loading

0 comments on commit f967268

Please sign in to comment.