Compare commits

..

42 commits
v1.0.2 ... main

Author SHA1 Message Date
Hyper
e4c43ae3b1
Make Bug Report issue template use separate required fields for specs (#1539)
Some checks failed
validate-internal / build (push) Failing after 14m53s
2025-04-12 14:38:04 +01:00
Pollot
abd71bb3e2
Add a guide for dumping the game using a USB storage device (#1471)
* Update README dumping requirements and instructions
Include the option of using a USB storage device for dumping game files in the README.

* Add note to hard drive dumping instructions
Clarify that the instructions for dumping game files directly from the Xbox 360 hard drive differ from those for using a USB storage device by adding a note to the hard drive dumping guide.

* Add dumping guide for USB storage devices
Add a comprehensive guide for dumping the game using a USB storage device instead of a Hard Drive Transfer Cable.

* Apply suggestions from the review

Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>

* Implement additional suggestions from the review
- Rename the file to ```DUMPING-USB-en.md```.
- Add Xbox 360 E to the note about incompatible consoles.
- Move the note under the Pre-requisites section.

---------

Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>
2025-04-12 14:27:17 +01:00
Skyth (Asilkan)
325e4d34a0
Fix profiler crashing in the installer. (#1507)
Some checks failed
validate-internal / build (push) Failing after 17s
2025-04-04 00:17:00 +03:00
Skyth (Asilkan)
1555b97b8a
Fix half pixel getting applied twice to reverse Z vertex shaders. (#1506) 2025-04-03 23:12:24 +03:00
Skyth (Asilkan)
5fca044662
Update version to v1.0.3. (#1492) 2025-04-03 21:55:21 +03:00
ĐeäTh
30aa528f84
Fix line splitting issues from localization changes (#1503)
* fix wrongly split lines from localization changes

* skip 0x200B line split guidance like new line if line starts with it
2025-04-03 20:49:40 +03:00
Skyth (Asilkan)
ff5aae2595
Fix persistent save data getting loaded before mods. (#1505) 2025-04-03 18:14:29 +03:00
Skyth (Asilkan)
21be4e17fb
Try creating the D3D12 device again if redirection to Vulkan fails. (#1504)
Some checks failed
validate-internal / build (push) Failing after 7s
2025-04-03 16:02:30 +03:00
Skyth (Asilkan)
8370312454
Redirect Intel GPUs to Vulkan on auto graphics API mode. (#1491)
Some checks failed
validate-internal / build (push) Failing after 2s
2025-03-30 19:06:03 +03:00
Skyth (Asilkan)
f7c823eeaf
Fix staffroll text getting cropped at narrow aspect ratios. (#1489) 2025-03-30 18:42:37 +03:00
squidbus
f5f92d0761
Prevent rendering ownership change between command lists. (#1486) 2025-03-30 15:53:11 +03:00
Skyth (Asilkan)
49d3b675ed
Implement a mechanism to survive from GPU driver crashes on Windows. (#1480)
Some checks failed
validate-internal / build (push) Failing after 3s
2025-03-30 04:36:55 +03:00
Al. Lopez
b282cbc4a2
Steam Virtual Gamepad support / Steam Input sharing Device Info with SDL (#1086)
Some checks failed
validate-internal / build (push) Failing after 3s
* Experimenting Button Label

Experimenting a way to add a hint for Button Labels. It should attempt to fix the Nintendo Layout issue when using a Nintendo Switch controller

* Create c-cpp.yml

* Create cmake-multi-platform.yml

* Create apply-patch.yml

* removing the workflows

* added experimental Steam Virtual Gamepad support

* restoring notes for Button Labels.

* Initial Gamepad Hotplug Logic improvements

This changes the way how a Controller will be prioritized. By default: it'll always prioritize based on Player 1. It should play nicely with Steam Deck's internal inputs when Steam Input is active

* Lightbar detection when using multiple PlayStation controllers at the same time.

An attempt to remedy the Lightbar activation. While Player 2/3/4 will override the in-game lightbar event upon connection: it'll later revert back to the in-game event.

* Attempt to reduce Input leaking

To avoid "the Controller is leaking" situation, there's now a Gamepad stat management that should reset Controller state based on connected controller.

* Lightbar active fix when gamepad plugged first prior to game launch

Another attempt to fix the lightbar by redoing the controller state mangement. For some reason: the Lightbar gets disabled when a controller is already plugged prior to game launch. It reverts back to normal until the next game event.

* Revert "restoring notes for Button Labels."

This reverts commit ef4e37cb41.

* Reapply "restoring notes for Button Labels."

This reverts commit f3ddd80024.

* Moving all Gamepad Hotplug changes to separate branch

To ensure all Hotplug-related changes don't accidentally get leftover: this commit will revert all the back back to the accidental removal of Button Label's note.

* added SDL's GameController naming convention as Fallback

If EInputDeviceExplicit doesn't recognize a specific Controller Type or Device: it'll fallback to SDL's naming conventions. This helps troubleshooting Controller-related issues when using the debug console.

* Official device naming scheme for EInputDeviceExplicit

Changes some of EInputDeviceExplicit's names to match the device's official name (such as Nintendo Switch Pro Controller, Xbox Wireless Controller, Amazon Luna Controller, etc.)

* spacing formatting fix

* remove "SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS" hint

since #1045 will include it: we're gonna get rid of it on this code section to avoid conflicts.

* moved EInputDevice Unknown class to the top priority

* Replacing EInputDeviceExplicit with SDL_GameControllerName

Based on @hyperbx's suggestions: It'll look for SDL's Controller Name as opposed to EInputDevice's naming scheme.

* remove hid::GetInputDeviceName() from hid.ccp

Now that SDL_GameControllerName handles Controller naming conventions, the hid.ccp portion of GetInputDeviceName is no longer needed.

* Fix indentation

---------

Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>
2025-03-29 21:38:44 +03:00
Hyper
6a50f9fc1f
Moved API to SWA submodule (#1326)
* Remove API sources

* Add SWA submodule
2025-03-29 21:25:24 +03:00
Skyth (Asilkan)
3d38fc1799
Update XenonRecomp submodule for the setjmp/longjmp fix. (#1458)
Some checks failed
validate-internal / build (push) Failing after 2s
2025-03-28 22:38:23 +03:00
Skyth (Asilkan)
33b557e68b
Check if the 4 GB memory allocation failed. (#1459)
* Check if the 4 GB memory allocation failed.

* Update UnleashedRecomp/locale/locale.cpp

Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>

* Update locale.cpp

* Add localizations.

* Fix installer not booting with the changes.

* Fix stale reference crash.

---------

Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>
2025-03-28 22:38:07 +03:00
Al. Lopez
acf260af79
Face Button follows Positional Button layout instead of Labels (#1045)
* Experimenting Button Label

Experimenting a way to add a hint for Button Labels. It should attempt to fix the Nintendo Layout issue when using a Nintendo Switch controller

* added description for Button Labels

* slightly reworded the description

* spaced out the initiation hints
2025-03-28 19:13:32 +03:00
Darío
53596b8e5c
Add CLI installation check option. (#1387)
* Add CLI installation check option.

* Show the console for Windows Release builds.

---------

Co-authored-by: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com>
2025-03-28 19:08:45 +03:00
Hyper
1dd5ba7fcd
Fix DLC info message always being displayed (#1393)
* Fix DLC info message always being displayed

* Use uint32_t for version numbers

* Make AchievementManager follow the same naming convention as PersistentStorageManager

* persistent_data: remove header size field

* Make status success by default or on file not existing
2025-03-28 19:08:13 +03:00
Skyth (Asilkan)
4b4c439709
Update font atlas. (#1473)
Some checks failed
validate-internal / build (push) Failing after 2s
2025-03-25 19:42:12 +03:00
Lorsoen
1562907f18
Minor French translation nitpicks (#1205)
* First iteration

* Typo

* locale.cpp nitpicks

* Forgor

* Corrections + More nitpicking

* au dela -> au delà
2025-03-25 19:32:02 +03:00
Kuid0us
e1f773d65e
Japanese localization: Fix some typos and grammatical errors (#940)
* Japanese localization: Fix some typos and grammatical errors

* Fixed errors described in PR #940 review

* Revert camera movement description in Japanese

* put \u200B
2025-03-25 19:31:52 +03:00
Kuid0us
e0d3a36db9
Changed the game name "Sonic World Adventure" to "Sonic Unleashed" in Japanese installer introduction text (#557)
* Update locale.cpp

Changed Japanese installer introduction text.

* Moved line break location and changed "北米" to US

* Reverting US to 北米 and capitalizing the game name
2025-03-25 19:31:43 +03:00
Skyth (Asilkan)
44b864e527
Fix DX10 cubemap DDS files failing to load correctly. (#1470) 2025-03-25 15:25:03 +03:00
Skyth (Asilkan)
2344a6f10d
Implement hacky fix for some update files not loading. (#1327)
Some checks failed
validate-internal / build (push) Failing after 14m53s
2025-03-24 22:23:09 +03:00
ĐeäTh
bd589ed641
Reset session persistent shoe upgrade bools when achievements are reset (#1429) 2025-03-24 22:18:24 +03:00
ĐeäTh
d0cc13c2fd
Fix "Disable Boost Filter" code not affecting certain parts of the game. (#1468)
* hook different part of the code to affect Eggmanland too

* Update UnleashedRecomp/patches/misc_patches.cpp

Co-authored-by: Skyth (Asilkan) <19259897+blueskythlikesclouds@users.noreply.github.com>

---------

Co-authored-by: Skyth (Asilkan) <19259897+blueskythlikesclouds@users.noreply.github.com>
2025-03-24 22:15:46 +03:00
Hyper
8ca5f1bf53
Added code to force the alternate game title (#1249) 2025-03-24 21:57:35 +03:00
ĐeäTh
7f9ce5037e
Explicitly set working directory to executable directory on boot (#1430)
* Explicitly set working directory to executable directory on boot

* change to GetModuleFileNameW instead

* switch to pre-existing implementations of getting the executable path

* add argument to use current working directory

* use error code variant of current_path
2025-03-24 21:34:37 +03:00
Hyper
b76a44923d
Prohibit Channel Configuration changes during gameplay (#1432) 2025-03-24 21:26:21 +03:00
Onat Erdem
2322b75e54
Fix Options Menu sliders being frame-dependent at lower framerates (#677)
* Fix slider fastIncrement conditions

* Change options menu sliders' fastIncrement logic to use a persistent holdTime variable, rather than the current frame's deltaTime

* Clamp deltaTime to a max value of 1/15f

* Compile fix

* Spacing fix
2025-03-24 21:19:42 +03:00
Isaac Marovitz
2f43b9a304
Improve .gitignore (#576)
* Improve .gitignore

Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>

* Correct whoopsie

Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>

---------

Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
2025-03-24 21:06:55 +03:00
Skyth (Asilkan)
5b53a49114
Preload the executable on Windows. (#1457) 2025-03-24 21:04:47 +03:00
Hyper
8e0d1f2873
Added MSAA level availability checks (#1446)
Some checks failed
validate-internal / build (push) Failing after 8s
2025-03-24 20:57:50 +03:00
Skyth (Asilkan)
d15bb7a501
GPU Upload Heap & UMA. (#1421)
Some checks failed
validate-internal / build (push) Failing after 7s
* Initial work for GPU upload heap & UMA.

* Finish D3D12 Support.

* Rework the logic for the GPU Upload Heap fallback.

* Only enable UMA on Vulkan on integrated GPUs.

* Fix D3D12 fallback condition.

---------

Co-authored-by: Dario <dariosamo@gmail.com>
2025-03-24 03:07:12 +03:00
ĐeäTh
1c1dc09006
change alignment on shop title/ring count (#1425) 2025-03-23 22:50:19 +03:00
Skyth (Asilkan)
a02f34b028
Fix Cool Edge whale not having reflections. (#1441)
Some checks failed
validate-internal / build (push) Failing after 9s
* Fix Cool Edge whale not having reflections.

* Fix Vulkan validation error.
2025-03-23 18:59:10 +03:00
Skyth (Asilkan)
41fd1761b1
Apply half pixel offset in the vertex shader. (#1391) 2025-03-23 17:25:40 +03:00
Skyth (Asilkan)
7866765ab0
Fix mod include directories with backward slashes not working on Linux. (#1444) 2025-03-23 17:16:54 +03:00
MegAmi
824405b236
Replace Markdown issue template with YAML schema (#1426)
Some checks failed
validate-internal / build (push) Failing after 8s
* Replace Markdown issue template with YML schema

* YAML doesn't like that apparently

* Address requested changes
2025-03-19 01:55:02 +00:00
Hyper
d0368665dd
Update README FAQ (#1319)
Some checks failed
validate-internal / build (push) Failing after 14m56s
2025-03-11 15:26:14 +00:00
João Moura
cc1018a8fc
Pass release path to upload-artifact step on Windows builds (#1151)
Some checks failed
validate-internal / build (push) Failing after 7s
2025-03-10 15:18:37 +03:00
211 changed files with 1530 additions and 5202 deletions

View file

@ -1,48 +0,0 @@
---
name: Bug Report
about: Report a bug in Unleashed Recompiled
type: Bug
---
### Validation
- [ ] I have checked the [Issues](https://github.com/hedge-dev/UnleashedRecomp/issues) page to see if my problem has already been reported
- [ ] I have confirmed that this bug does not occur in the original game running on original Xbox 360 hardware
#### If you have DLC installed, please specify which ones you have.
- [ ] Apotos & Shamar Adventure Pack
- [ ] Chun-nan Adventure Pack
- [ ] Empire City & Adabat Adventure Pack
- [ ] Holoska Adventure Pack
- [ ] Mazuri Adventure Pack
- [ ] Spagonia Adventure Pack
#### If you have mods enabled, please specify which ones you have.
Provide a list of your enabled mods in Hedge Mod Manager here. You will not receive support for issues *caused* by mods.
#### If you have codes enabled, please specify which ones you have.
Provide a list of your enabled codes in Hedge Mod Manager here.
### Describe the Bug
A clear and concise description of what the bug is.
### Steps to Reproduce
Steps to reproduce the bug:
1. Go to '...'
2. etc.
### Expected Behavior
A clear and concise description of what you expected to happen.
### Footage
Attach a screenshot or video of the bug. If possible, please also provide footage of the expected behaviour on original Xbox 360 hardware.
### Specifications
Fill out the following details:
- CPU: (e.g. Intel Core [...], AMD Ryzen [...], etc.)
- GPU: (e.g. NVIDIA GeForce [...], Radeon HD [...], Intel HD [...], etc.)
- GPU Driver: (e.g NVIDIA driver 545.XX, AMD driver 24.X.X, etc.)
- OS: (e.g. Windows 10, Windows 11, Linux distro)
- Version: (e.g. 1.0.0)
### Additional Context
Provide any other context about the problem here.

124
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View file

@ -0,0 +1,124 @@
name: Bug Report
description: Report a bug, crash, or other type of error in Unleashed Recompiled
type: Bug
body:
- id: validation
type: checkboxes
attributes:
label: Validation
options:
- label: I have checked the [Issues](https://github.com/hedge-dev/UnleashedRecomp/issues) page to see if my problem has already been reported
required: true
- label: I have confirmed that this bug does not occur in the original game running on original Xbox 360 hardware
required: false
- id: dlc-installed
type: checkboxes
attributes:
label: If you have DLC installed, please specify which ones you have.
options:
- label: Apotos & Shamar Adventure Pack
required: false
- label: Chun-nan Adventure Pack
required: false
- label: Empire City & Adabat Adventure Pack
required: false
- label: Holoska Adventure Pack
required: false
- label: Mazuri Adventure Pack
required: false
- label: Spagonia Adventure Pack
required: false
- id: mods-used
type: textarea
validations:
required: false
attributes:
label: If you have mods enabled, please specify which ones you have.
description: Provide a list of your enabled mods in Hedge Mod Manager here. You will not receive support for issues *caused* by mods.
- id: codes-used
type: textarea
validations:
required: false
attributes:
label: If you have codes enabled, please specify which ones you have.
description: Provide a list of your enabled codes in Hedge Mod Manager here.
- id: describe-bug
type: textarea
validations:
required: true
attributes:
label: Describe the Bug
description: A clear and concise description of what the bug is.
- id: repro-steps
type: textarea
validations:
required: true
attributes:
label: Steps to Reproduce
description: Step-by-step instructions on how to reproduce the bug.
placeholder: |
1. Go to '...'
2. etc.
- id: expected-behavior
type: textarea
validations:
required: true
attributes:
label: Expected Behavior
description: A clear and concise description of what you expected to happen.
- id: footage
type: textarea
validations:
required: true
attributes:
label: Footage
description: Attach a screenshot or video of the bug. If possible, please also provide footage of the expected behaviour on original Xbox 360 hardware.
- id: specs-version
type: input
validations:
required: true
attributes:
label: Version
description: The version of Unleashed Recompiled you are running (e.g. **v1.0.0**). This can be found at the bottom right corner of the installer wizard, options menu, or in the application metadata.
- id: specs-cpu
type: input
validations:
required: true
attributes:
label: CPU
description: The name of your CPU (e.g. **Intel Core [...]**, **AMD Ryzen [...]**, etc.).
- id: specs-gpu
type: input
validations:
required: true
attributes:
label: GPU
description: The name of your GPU (e.g. **NVIDIA GeForce [...]**, **AMD Radeon [...]**, **Intel [...]**, etc.).
- id: specs-gpu-driver
type: input
validations:
required: true
attributes:
label: GPU Driver
description: The version of your GPU driver (e.g. **NVIDIA Driver 572.XX**, **AMD Driver 25.X.X**, **Intel Driver 32.X.XXX.XXXX** etc.).
- id: specs-ram
type: input
validations:
required: true
attributes:
label: Memory
description: The amount of system memory you have (e.g. **8 GB**, **16 GB**, etc.).
- id: specs-os
type: input
validations:
required: true
attributes:
label: Operating System
description: The name of the operating system you are running (e.g. **Windows 10**, **Windows 11**, **Linux distro**).
- id: additional-context
type: textarea
validations:
required: false
attributes:
label: Additional Context
description: Provide any other context about the problem here.

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1 @@
blank_issues_enabled: true

View file

@ -145,13 +145,11 @@ jobs:
Move-Item -Path ".\out\build\${{ env.CMAKE_PRESET }}\UnleashedRecomp\dxil.dll" -Destination ".\release\dxil.dll"
Move-Item -Path ".\out\build\${{ env.CMAKE_PRESET }}\UnleashedRecomp\UnleashedRecomp.exe" -Destination ".\release\UnleashedRecomp.exe"
Compress-Archive -Path .\release\* -DestinationPath .\UnleashedRecomp-Windows.zip
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: UnleashedRecomp-Windows-${{ env.CMAKE_PRESET }}
path: .\UnleashedRecomp-Windows.zip
path: .\release
- name: Upload PDB
uses: actions/upload-artifact@v4

10
.gitignore vendored
View file

@ -397,3 +397,13 @@ FodyWeavers.xsd
# JetBrains Rider
*.sln.iml
# IntelliJ IDEs
.idea/
# macOS metadata
*.DS_Store
# CMake Files
**/cmake-build-debug
**/CMakeCache.txt

3
.gitmodules vendored
View file

@ -58,3 +58,6 @@
[submodule "thirdparty/json"]
path = thirdparty/json
url = https://github.com/nlohmann/json
[submodule "UnleashedRecomp/api"]
path = UnleashedRecomp/api
url = https://github.com/hedge-dev/SWA.git

View file

@ -49,8 +49,8 @@ Unleashed Recompiled is an unofficial PC port of the Xbox 360 version of Sonic U
1) You must have access to the following:
- Xbox 360 (modifications not necessary)
- Xbox 360 Hard Drive (20 GB minimum)
- Xbox 360 Hard Drive Transfer Cable (or a compatible SATA to USB adapter)
- Xbox 360 Storage Device (either an Xbox 360 hard drive or an external USB storage device)
- Xbox 360 Hard Drive Transfer Cable or a compatible SATA to USB adapter (only required for dumping from an Xbox 360 hard drive)
- Sonic Unleashed for Xbox 360 (US or EU, **JP is not supported**)
- Retail Disc or Digital Copy (can be purchased and downloaded from the [Xbox Store](https://www.xbox.com/en-US/games/store/sonic-unleashed/c098fgnmts8f)).
- Title Update required.
@ -65,7 +65,10 @@ Unleashed Recompiled is an unofficial PC port of the Xbox 360 version of Sonic U
2) **Before proceeding with the installation**, make sure to follow the guide on how to acquire the game files from your Xbox 360.
- [English Dumping Guide](/docs/DUMPING-en.md)
- Xbox 360 Hard Drive Dumping Guide
- [English](/docs/DUMPING-en.md)
- Xbox 360 USB Dumping Guide
- [English](/docs/DUMPING-USB-en.md)
3) Download [the latest release](https://github.com/hedge-dev/UnleashedRecomp/releases/latest) of Unleashed Recompiled and extract it to where you'd like the game to be installed.
@ -278,9 +281,16 @@ Simply booting at least once in Desktop Mode will enable the Deck to use the fil
## FAQ
### Do you have a Discord server?
### Do you have a website or Discord server?
Unleashed Recompiled is not associated with any Discord servers. Use the [Issues](https://github.com/hedge-dev/UnleashedRecomp/issues) page if you need support.
Unleashed Recompiled does not have an official website, nor is it affiliated with any Discord servers.
**Please link here when directing anyone to the project.**
> [!CAUTION]
> Do not download builds of Unleashed Recompiled from anywhere but our [Releases](https://github.com/hedge-dev/UnleashedRecomp/releases/latest) page.
>
> **We will never distribute builds on other websites, via Discord servers or via third-party update tools.**
### Why does the installer say my files are invalid?

View file

@ -183,6 +183,8 @@ set(UNLEASHED_RECOMP_USER_CXX_SOURCES
"user/config.cpp"
"user/registry.cpp"
"user/paths.cpp"
"user/persistent_data.cpp"
"user/persistent_storage_manager.cpp"
)
set(UNLEASHED_RECOMP_MOD_CXX_SOURCES
@ -229,7 +231,8 @@ set(UNLEASHED_RECOMP_CXX_SOURCES
"app.cpp"
"exports.cpp"
"main.cpp"
"misc_impl.cpp"
"misc_impl.cpp"
"preload_executable.cpp"
"sdl_listener.cpp"
"stdafx.cpp"
"version.cpp"
@ -310,7 +313,11 @@ endif()
if (UNLEASHED_RECOMP_D3D12)
find_package(directx-headers CONFIG REQUIRED)
find_package(directx12-agility CONFIG REQUIRED)
target_compile_definitions(UnleashedRecomp PRIVATE UNLEASHED_RECOMP_D3D12)
target_compile_definitions(UnleashedRecomp PRIVATE
UNLEASHED_RECOMP_D3D12
D3D12MA_USING_DIRECTX_HEADERS
D3D12MA_OPTIONS16_SUPPORTED
)
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
@ -434,35 +441,6 @@ compile_pixel_shader(resolve_msaa_depth_2x)
compile_pixel_shader(resolve_msaa_depth_4x)
compile_pixel_shader(resolve_msaa_depth_8x)
function(generate_aggregate_header INPUT_DIRECTORY OUTPUT_FILE)
get_filename_component(ABS_OUTPUT_FILE "${OUTPUT_FILE}" ABSOLUTE)
file(GLOB_RECURSE HEADER_FILES "${INPUT_DIRECTORY}/*.h")
set(HEADER_CONTENT "#pragma once\n\n")
foreach(HEADER_FILE IN LISTS HEADER_FILES)
get_filename_component(ABS_HEADER_FILE "${HEADER_FILE}" ABSOLUTE)
if (ABS_HEADER_FILE STREQUAL ABS_OUTPUT_FILE)
continue()
endif()
file(RELATIVE_PATH RELATIVE_HEADER_FILE "${INPUT_DIRECTORY}" "${HEADER_FILE}")
string(APPEND HEADER_CONTENT "#include \"${RELATIVE_HEADER_FILE}\"\n")
endforeach()
if (EXISTS "${OUTPUT_FILE}")
file(READ "${OUTPUT_FILE}" EXISTING_CONTENT)
if (EXISTING_CONTENT STREQUAL HEADER_CONTENT)
return()
endif()
endif()
file(WRITE "${OUTPUT_FILE}" "${HEADER_CONTENT}")
endfunction()
generate_aggregate_header(
"${CMAKE_CURRENT_SOURCE_DIR}/api"
"${CMAKE_CURRENT_SOURCE_DIR}/api/SWA.h"
)
set(RESOURCES_SOURCE_PATH "${PROJECT_SOURCE_DIR}/../UnleashedRecompResources")
set(RESOURCES_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/res")

1
UnleashedRecomp/api Submodule

@ -0,0 +1 @@
Subproject commit f299dd8cf272a0110c91e54e2b6e308a2d897966

View file

@ -1,6 +0,0 @@
#pragma once
namespace Chao::CSD
{
class CBase {};
}

View file

@ -1,8 +0,0 @@
#pragma once
#include <SWA.inl>
namespace Chao::CSD
{
class CMotionPattern : CBase {};
}

View file

@ -1,34 +0,0 @@
#pragma once
#include <SWA.inl>
#include <CSD/Manager/csdmBase.h>
#include <CSD/Manager/csdmResourceBase.h>
#include <CSD/Manager/csdmNodeObserver.h>
#include <CSD/Manager/csdmSubjectBase.h>
#include <Hedgehog/Math/Vector.h>
namespace Chao::CSD
{
struct Node;
class CNode : public CResourceBase<Node>, SubjectBase<CNodeObserver, CNode>, CBase
{
public:
SWA_INSERT_PADDING(0x34);
xpointer<CMotionPattern> m_pMotionPattern;
SWA_INSERT_PADDING(0x18);
~CNode();
void SetText(const char* in_pText);
void SetText(const wchar_t* in_pText);
void GetPosition(Hedgehog::Math::CVector2& out_rResult) const;
void SetPosition(float in_X, float in_Y);
void SetHideFlag(uint32_t in_HideFlag);
void SetRotation(float in_Rotation);
void SetScale(float in_X, float in_Y);
void SetPatternIndex(uint32_t in_PatternIndex);
};
}
#include <CSD/Manager/csdmNode.inl>

View file

@ -1,49 +0,0 @@
#include "SWA.inl"
namespace Chao::CSD
{
inline CNode::~CNode()
{
SWA_VIRTUAL_FUNCTION(void, 0, this);
}
inline void CNode::SetText(const char* in_pText)
{
GuestToHostFunction<int>(sub_830BF640, this, in_pText);
}
inline void CNode::SetText(const wchar_t* in_pText)
{
GuestToHostFunction<int>(sub_830BF640, this, in_pText);
}
inline void CNode::GetPosition(Hedgehog::Math::CVector2& out_rResult) const
{
GuestToHostFunction<void>(sub_830BF008, &out_rResult, this);
}
inline void CNode::SetPosition(float in_X, float in_Y)
{
GuestToHostFunction<int>(sub_830BF078, this, in_X, in_Y);
}
inline void CNode::SetHideFlag(uint32_t in_HideFlag)
{
GuestToHostFunction<int>(sub_830BF080, this, in_HideFlag);
}
inline void CNode::SetRotation(float in_Rotation)
{
GuestToHostFunction<int>(sub_830BF088, this, in_Rotation);
}
inline void CNode::SetScale(float in_X, float in_Y)
{
GuestToHostFunction<int>(sub_830BF090, this, in_X, in_Y);
}
inline void CNode::SetPatternIndex(uint32_t in_PatternIndex)
{
GuestToHostFunction<int>(sub_830BF300, this, in_PatternIndex);
}
}

View file

@ -1,10 +0,0 @@
#pragma once
#include "CSD/Manager/csdmObserverBase.h"
namespace Chao::CSD
{
class CNode;
class CNodeObserver : public CObserverBase<CNode> {};
}

View file

@ -1,23 +0,0 @@
#pragma once
#include "SWA.inl"
namespace Chao::CSD
{
template<typename TObservee>
class CObserverBase
{
public:
struct Vftable
{
be<uint32_t> m_fpDtor;
};
xpointer<Vftable> m_pVftable;
SWA_INSERT_PADDING(0x08);
~CObserverBase();
};
}
#include "CSD/Manager/csdmObserverBase.inl"

View file

@ -1,8 +0,0 @@
namespace Chao::CSD
{
template<typename TObservee>
inline CObserverBase<TObservee>::~CObserverBase()
{
GuestToHostFunction<void>(m_pVftable->m_fpDtor, this);
}
}

View file

@ -1,31 +0,0 @@
#pragma once
#include "SWA.inl"
#include "CSD/Manager/csdmBase.h"
#include "CSD/Manager/csdmResourceBase.h"
namespace Chao::CSD
{
struct Project;
class CProject;
class CScene;
class CTexList;
class CProject : public CResourceBase<Project>, CBase
{
public:
SWA_INSERT_PADDING(0x1C);
RCPtr<CTexList> m_rcTexList;
SWA_INSERT_PADDING(0x1C);
RCPtr<CScene> CreateScene(const char* in_pName) const;
RCPtr<CScene> CreateScene(const char* in_pName, const char* in_pMotionName) const;
void DestroyScene(CScene* in_pScene);
void DestroyScene(RCPtr<CScene>& inout_rcScene);
static void DestroyScene(CProject* in_pProject, RCPtr<CScene>& inout_rcScene);
};
}
#include "CSD/Manager/csdmProject.inl"

View file

@ -1,40 +0,0 @@
#include "kernel/function.h"
namespace Chao::CSD
{
inline RCPtr<CScene> CProject::CreateScene(const char* in_pName) const
{
RCPtr<CScene> rcScene;
GuestToHostFunction<void>(sub_830BEE00, this, rcScene, in_pName, nullptr);
return rcScene;
}
inline RCPtr<CScene> CProject::CreateScene(const char* in_pName, const char* in_pMotionName) const
{
RCPtr<CScene> rcScene;
GuestToHostFunction<void>(sub_830BECE0, this, rcScene, in_pName, in_pMotionName, nullptr);
return rcScene;
}
inline void CProject::DestroyScene(CScene* in_pScene)
{
GuestToHostFunction<void>(sub_830BE298, this, in_pScene);
}
inline void CProject::DestroyScene(RCPtr<CScene>& inout_rcScene)
{
if (!inout_rcScene)
return;
DestroyScene(inout_rcScene.Get());
inout_rcScene = nullptr;
}
inline void CProject::DestroyScene(CProject* in_pProject, RCPtr<CScene>& inout_rcScene)
{
if (in_pProject)
in_pProject->DestroyScene(inout_rcScene);
else
inout_rcScene = nullptr;
}
}

View file

@ -1,28 +0,0 @@
#pragma once
#include "CSD/Manager/csdmRCPtrAbs.h"
namespace Chao::CSD
{
class RCPtrAbs::RCObject
{
public:
struct Vftable
{
be<uint32_t> m_fpDtor;
be<uint32_t> m_fpDeallocate;
};
xpointer<Vftable> m_pVftable;
xpointer<void> m_pMemory;
be<uint32_t> m_RefCount;
xpointer<void> m_pDealloctor;
be<uint32_t> m_eDealloctor;
~RCObject();
void Deallocate(void* in_pMemory);
void Release();
};
}
#include "CSD/Manager/csdmRCObject.inl"

View file

@ -1,35 +0,0 @@
namespace Chao::CSD
{
inline RCPtrAbs::RCObject::~RCObject()
{
GuestToHostFunction<void>(m_pVftable->m_fpDtor, this);
}
inline RCPtrAbs::~RCPtrAbs()
{
RCPtrAbs::RCObject* pObj = m_pObject;
m_pObject = nullptr;
if (pObj)
pObj->Release();
}
inline void* RCPtrAbs::GetAbs() const
{
if (!m_pObject)
return nullptr;
return m_pObject->m_pMemory;
}
inline void RCPtrAbs::RCObject::Deallocate(void* in_pMemory)
{
GuestToHostFunction<void>(m_pVftable->m_fpDeallocate, this, in_pMemory);
}
inline void RCPtrAbs::RCObject::Release()
{
GuestToHostFunction<void>(sub_830BA068, this);
}
}

View file

@ -1,9 +0,0 @@
#pragma once
#include "CSD/Manager/csdmRCPtr.h"
namespace Chao::CSD
{
template<typename T>
class RCPtr<T>::RCObjectImp : public RCObject {};
}

View file

@ -1,14 +0,0 @@
namespace Chao::CSD
{
template<typename T>
void RCPtr<T>::RCObjectImp::Deallocate(void* in_pMemory)
{
// delete static_cast<T*>(in_pMemory);
}
template<typename T>
RCPtrAbs::RCObject* RCPtr<T>::CreateRCObject()
{
return new RCObjectImp();
}
}

View file

@ -1,32 +0,0 @@
#pragma once
#include "CSD/Manager/csdmRCPtrAbs.h"
namespace Chao::CSD
{
template<typename T>
class RCPtr : RCPtrAbs
{
public:
class RCObjectImp;
RCPtr() : RCPtrAbs() {}
RCPtr(T* in_pMemory) : RCPtrAbs(in_pMemory) {}
RCPtr(const RCPtr& in_rOther) : RCPtrAbs(in_rOther) {}
RCPtr(RCPtr&& in_rOther) : RCPtrAbs(std::move(in_rOther)) {}
void Attach(T* in_pObject);
T* Get() const;
void Set(const RCPtr& in_rOther);
T* operator*() const;
T* operator->() const;
RCPtr& operator=(const RCPtr& in_rOther);
operator bool() const;
};
}
#include "CSD/Manager/csdmRCPtr.inl"

View file

@ -1,45 +0,0 @@
namespace Chao::CSD
{
template<typename T>
void RCPtr<T>::Attach(T* in_pObject)
{
RCPtrAbs::AttachAbs(in_pObject);
}
template<typename T>
T* RCPtr<T>::Get() const
{
return static_cast<T*>(RCPtrAbs::GetAbs());
}
template<typename T>
void RCPtr<T>::Set(const RCPtr& in_rOther)
{
RCPtrAbs::SetAbs(in_rOther);
}
template<typename T>
T* RCPtr<T>::operator*() const
{
return Get();
}
template<typename T>
T* RCPtr<T>::operator->() const
{
return Get();
}
template<typename T>
RCPtr<T>& RCPtr<T>::operator=(const RCPtr& in_rOther)
{
Set(in_rOther);
return *this;
}
template<typename T>
RCPtr<T>::operator bool() const
{
return m_pObject != nullptr;
}
}

View file

@ -1,42 +0,0 @@
#pragma once
#include "SWA.inl"
namespace Chao::CSD
{
class RCPtrAbs
{
public:
class RCObject;
struct Vftable
{
be<uint32_t> m_fpDtor;
be<uint32_t> m_fpCreateRCObject;
};
xpointer<Vftable> m_pVftable;
xpointer<RCObject> m_pObject;
RCPtrAbs();
RCPtrAbs(void* in_pMemory);
RCPtrAbs(const RCPtrAbs& in_rOther);
RCPtrAbs(RCPtrAbs&& in_rPtr);
~RCPtrAbs();
RCObject* CreateRCObject();
void AttachAbs(void* in_pMemory);
void* GetAbs() const;
void SetAbs(const RCPtrAbs& in_rPtr);
void* operator*() const;
void* operator->() const;
RCPtrAbs& operator=(const RCPtrAbs& in_rPtr);
operator bool() const;
};
}
#include "CSD/Manager/csdmRCPtrAbs.inl"

View file

@ -1,58 +0,0 @@
namespace Chao::CSD
{
inline RCPtrAbs::RCPtrAbs()
{
AttachAbs(nullptr);
}
inline RCPtrAbs::RCPtrAbs(void* in_pMemory)
{
AttachAbs(in_pMemory);
}
inline RCPtrAbs::RCPtrAbs(const RCPtrAbs& in_rOther)
{
SetAbs(in_rOther);
}
inline RCPtrAbs::RCPtrAbs(RCPtrAbs&& in_rPtr) : m_pObject(in_rPtr.m_pObject)
{
in_rPtr.m_pObject = nullptr;
}
inline RCPtrAbs::RCObject* RCPtrAbs::CreateRCObject()
{
return GuestToHostFunction<RCPtrAbs::RCObject*>(m_pVftable->m_fpCreateRCObject, this);
}
inline void RCPtrAbs::AttachAbs(void* in_pMemory)
{
GuestToHostFunction<void>(sub_830BA298, this, in_pMemory);
}
inline void RCPtrAbs::SetAbs(const RCPtrAbs& in_rPtr)
{
GuestToHostFunction<void>(sub_830BA328, this, in_rPtr);
}
inline void* RCPtrAbs::operator*() const
{
return GetAbs();
}
inline void* RCPtrAbs::operator->() const
{
return GetAbs();
}
inline RCPtrAbs& RCPtrAbs::operator=(const RCPtrAbs& in_rPtr)
{
SetAbs(in_rPtr);
return *this;
}
inline RCPtrAbs::operator bool() const
{
return m_pObject != nullptr;
}
}

View file

@ -1,26 +0,0 @@
#pragma once
#include "CSD/Manager/csdmRCPtr.h"
namespace Chao::CSD
{
template<typename T>
class CResourceBase
{
public:
struct Vftable
{
be<uint32_t> m_fpDtor;
be<uint32_t> m_fpCopyResource;
};
xpointer<Vftable> m_pVftable;
RCPtr<uint8_t> m_rcResourceHolder;
xpointer<T> m_pResource;
~CResourceBase();
void CopyResource(const CResourceBase& in_rOther);
};
}
#include "CSD/Manager/csdmResourceBase.h"

View file

@ -1,15 +0,0 @@
namespace Chao::CSD
{
template<typename T>
inline CResourceBase<T>::~CResourceBase()
{
GuestToHostFunction<void>(m_pVftable->m_fpDtor, this);
}
template<typename T>
inline void CResourceBase<T>::CopyResource(const CResourceBase& in_rOther)
{
m_rcResourceHolder = in_rOther.m_rcResourceHolder;
m_pResource = in_rOther.m_pResource;
}
}

View file

@ -1,53 +0,0 @@
#pragma once
#include "SWA.inl"
#include "CSD/Manager/csdmBase.h"
#include "CSD/Manager/csdmResourceBase.h"
#include "CSD/Manager/csdmSceneObserver.h"
#include "CSD/Manager/csdmSubjectBase.h"
namespace Chao::CSD
{
struct Scene;
class CScene;
class CNode;
enum EMotionRepeatType : uint32_t
{
eMotionRepeatType_PlayOnce = 0,
eMotionRepeatType_Loop = 1,
eMotionRepeatType_PingPong = 2,
eMotionRepeatType_PlayThenDestroy = 3
};
class CScene : public CResourceBase<Scene>, SubjectBase<CSceneObserver, CScene>, CBase
{
public:
SWA_INSERT_PADDING(0x60);
be<float> m_PrevMotionFrame;
be<float> m_MotionFrame;
be<float> m_MotionSpeed;
be<float> m_MotionStartFrame;
be<float> m_MotionEndFrame;
SWA_INSERT_PADDING(0x0C);
be<uint32_t> m_MotionDisableFlag;
SWA_INSERT_PADDING(0x10);
be<EMotionRepeatType> m_MotionRepeatType;
SWA_INSERT_PADDING(0x2C);
~CScene();
void Update(float in_DeltaTime = 0.0f);
void Render(void* in_pUnk);
void GetNode(RCPtr<CNode>& out_rResult, const char* in_pName);
bool SetMotion(const char* in_pName);
void SetMotionFrame(float in_MotionFrame);
void SetPosition(float in_X, float in_Y);
void SetHideFlag(uint32_t in_HideFlag);
void SetRotation(float in_Angle);
void SetScale(float in_X, float in_Y);
};
}
#include "CSD/Manager/csdmScene.inl"

View file

@ -1,53 +0,0 @@
namespace Chao::CSD
{
inline CScene::~CScene()
{
SWA_VIRTUAL_FUNCTION(void, 0, this);
}
inline void CScene::Update(float in_DeltaTime)
{
SWA_VIRTUAL_FUNCTION(void, 2, this, in_DeltaTime);
}
inline void CScene::Render(void* in_pUnk)
{
SWA_VIRTUAL_FUNCTION(void, 3, this, in_pUnk);
}
inline void CScene::GetNode(RCPtr<CNode>& out_rResult, const char* in_pName)
{
GuestToHostFunction<void>(sub_830BCCA8, &out_rResult, this, in_pName);
}
inline bool CScene::SetMotion(const char* in_pName)
{
return GuestToHostFunction<bool>(sub_830BA760, this, in_pName);
}
inline void CScene::SetMotionFrame(float in_MotionFrame)
{
m_PrevMotionFrame = in_MotionFrame;
m_MotionFrame = in_MotionFrame;
}
inline void CScene::SetPosition(float in_X, float in_Y)
{
GuestToHostFunction<void>(sub_830BB550, this, in_X, in_Y);
}
inline void CScene::SetHideFlag(uint32_t in_HideFlag)
{
GuestToHostFunction<void>(sub_830BB378, this, in_HideFlag);
}
inline void CScene::SetRotation(float in_Angle)
{
GuestToHostFunction<void>(sub_830BB5F8, this, in_Angle);
}
inline void CScene::SetScale(float in_X, float in_Y)
{
GuestToHostFunction<void>(sub_830BB650, this, in_X, in_Y);
}
}

View file

@ -1,10 +0,0 @@
#pragma once
#include "CSD/Manager/csdmObserverBase.h"
namespace Chao::CSD
{
class CScene;
class CSceneObserver : public CObserverBase<CScene> {};
}

View file

@ -1,25 +0,0 @@
#pragma once
#include "SWA.inl"
namespace Chao::CSD
{
template<typename TObserver, typename TObservee>
class SubjectBase
{
public:
struct Vftable
{
be<uint32_t> m_fpDtor;
be<uint32_t> m_fpGetObservee;
};
xpointer<Vftable> m_pVftable;
SWA_INSERT_PADDING(0x0C);
~SubjectBase();
TObservee* GetObservee() const;
};
}
#include "CSD/Manager/csdmSubjectBase.inl"

View file

@ -1,14 +0,0 @@
namespace Chao::CSD
{
template<typename TObserver, typename TObservee>
inline SubjectBase<TObserver, TObservee>::~SubjectBase()
{
GuestToHostFunction<void>(m_pVftable->m_fpDtor, this);
}
template<typename TObserver, typename TObservee>
inline TObservee* SubjectBase<TObserver, TObservee>::GetObservee() const
{
return nullptr;
}
}

View file

@ -1,23 +0,0 @@
#pragma once
#include "CSD/Manager/csdmBase.h"
#include "CSD/Manager/csdmRCPtr.h"
namespace Chao::CSD
{
class CTexList : public CBase
{
public:
struct Vftable
{
be<uint32_t> m_fpDtor;
};
xpointer<Vftable> m_pVftable;
RCPtr<uint8_t> m_rcData;
~CTexList();
};
}
#include "CSD/Platform/csdTexList.inl"

View file

@ -1,7 +0,0 @@
namespace Chao::CSD
{
inline CTexList::~CTexList()
{
GuestToHostFunction<void>(m_pVftable->m_fpDtor, this);
}
}

View file

@ -1,378 +0,0 @@
#pragma once
#include <Hedgehog/Base/System/hhAllocator.h>
namespace hh
{
template<
class Key,
class T,
class Compare = std::less<Key>,
class Allocator = Hedgehog::Base::TAllocator<std::pair<const Key, T>>>
class map
{
protected:
enum EColor
{
eColor_Red,
eColor_Black
};
struct SNode
{
using allocator_type = typename std::allocator_traits<Allocator>::template rebind_alloc<SNode>;
xpointer<SNode> pLeft;
xpointer<SNode> pParent;
xpointer<SNode> pRight;
std::pair<const Key, T> Value;
uint8_t Color;
bool IsNil;
};
Compare m_Comp;
typename SNode::allocator_type m_Alloc;
xpointer<SNode> m_pHead;
be<uint32_t> m_Count;
struct SFindResult
{
SNode* pParent;
bool IsRight;
SNode* pBound;
};
bool LowerBoundDuplicate(const SNode* pBound, const Key& in_rKey) const
{
return !pBound->IsNil && !m_Comp(in_rKey, pBound->Value.first);
}
SFindResult FindLowerBound(const Key& in_rKey) const
{
SFindResult result{ m_pHead->pParent, true, m_pHead };
SNode* pNode = result.pParent;
while (!pNode->IsNil)
{
result.pParent = pNode;
if (m_Comp(pNode->Value.first, in_rKey))
{
result.IsRight = true;
pNode = pNode->pRight;
}
else
{
result.IsRight = false;
result.pBound = pNode;
pNode = pNode->pLeft;
}
}
return result;
}
SNode* Find(const Key& in_rKey) const
{
const SFindResult result = FindLowerBound(in_rKey);
return LowerBoundDuplicate(result.pBound, in_rKey) ? result.pBound : m_pHead.get();
}
static SNode* Max(SNode* pNode)
{
while (!pNode->pRight->IsNil)
pNode = pNode->pRight;
return pNode;
}
static SNode* Min(SNode* pNode)
{
while (!pNode->pLeft->IsNil)
pNode = pNode->pLeft;
return pNode;
}
public:
using key_type = Key;
using mapped_type = T;
using value_type = std::pair<const Key, T>;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using key_compare = Compare;
using allocator_type = Allocator;
using reference = value_type&;
using const_reference = const value_type&;
using pointer = typename std::allocator_traits<Allocator>::pointer;
using const_pointer = typename std::allocator_traits<Allocator>::const_pointer;
class iterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = std::pair<const Key, T>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;
iterator(const std::nullptr_t&) = delete;
iterator(SNode* pNode) : m_pNode(pNode) {}
reference operator*() const { return m_pNode->Value; }
pointer operator->() const { return &m_pNode->Value; }
iterator& operator++()
{
if (m_pNode->pRight->IsNil)
{
SNode* pNode;
while (!(pNode = m_pNode->pParent)->IsNil && m_pNode == pNode->pRight)
m_pNode = pNode;
m_pNode = pNode;
}
else
{
m_pNode = map::Min(m_pNode->pRight);
}
return *this;
}
iterator operator++(int)
{
iterator temp(*this);
++(*this);
return temp;
}
iterator& operator--()
{
if (m_pNode->IsNil)
{
m_pNode = m_pNode->pRight;
}
else if (m_pNode->pLeft->IsNil)
{
SNode* pNode;
while (!(pNode = m_pNode->pParent)->IsNil && m_pNode == pNode->pLeft)
m_pNode = pNode;
if (!m_pNode->IsNil)
m_pNode = pNode;
}
else
{
m_pNode = map::Max(m_pNode->pLeft);
}
return *this;
}
iterator operator--(int)
{
iterator temp(*this);
--(*this);
return temp;
}
bool operator==(const iterator& rhs) const { return m_pNode == rhs.m_pNode; }
bool operator!=(const iterator& rhs) const { return !(*this == rhs); }
private:
SNode* m_pNode;
friend class iterator;
friend class map;
};
class const_iterator
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = std::pair<const Key, T>;
using difference_type = std::ptrdiff_t;
using pointer = const value_type*;
using reference = const value_type&;
const_iterator(const std::nullptr_t&) = delete;
const_iterator(SNode* pNode) : m_pNode(pNode) {}
const_iterator(const iterator& iterator) : m_pNode(iterator.m_pNode) {}
reference operator*() const { return m_pNode->Value; }
pointer operator->() const { return &m_pNode->Value; }
const_iterator& operator++()
{
if (m_pNode->pRight->IsNil)
{
SNode* pNode;
while (!(pNode = m_pNode->pParent)->IsNil && m_pNode == pNode->pRight)
m_pNode = pNode;
m_pNode = pNode;
}
else
{
m_pNode = map::Min(m_pNode->pRight);
}
return *this;
}
const_iterator operator++(int)
{
const_iterator temp(*this);
++(*this);
return temp;
}
const_iterator& operator--()
{
if (m_pNode->IsNil)
{
m_pNode = m_pNode->pRight;
}
else if (m_pNode->pLeft->IsNil)
{
SNode* pNode;
while (!(pNode = m_pNode->pParent)->IsNil && m_pNode == pNode->pLeft)
m_pNode = pNode;
if (!m_pNode->IsNil)
m_pNode = pNode;
}
else
{
m_pNode = map::Max(m_pNode->pLeft);
}
return *this;
}
const_iterator operator--(int)
{
const_iterator temp(*this);
--(*this);
return temp;
}
bool operator==(const const_iterator& rhs) const { return m_pNode == rhs.m_pNode; }
bool operator!=(const const_iterator& rhs) const { return !(*this == rhs); }
private:
SNode* m_pNode;
friend class map;
};
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
public:
allocator_type get_allocator() const
{
return m_Alloc;
}
T& at(const Key& key)
{
return Find(key)->Value.second;
}
const T& at(const Key& key) const
{
return Find(key)->Value.second;
}
iterator begin()
{
return iterator(m_pHead->pLeft);
}
const_iterator begin() const
{
return const_iterator(m_pHead->pLeft);
}
const_iterator cbegin() const
{
return const_iterator(m_pHead->pLeft);
}
iterator end()
{
return iterator(m_pHead);
}
const_iterator end() const
{
return const_iterator(m_pHead);
}
const_iterator cend() const
{
return const_iterator(m_pHead);
}
reverse_iterator rbegin()
{
return reverse_iterator(end());
}
const_reverse_iterator rbegin() const
{
return const_reverse_iterator(end());
}
const_reverse_iterator crbegin() const
{
return const_reverse_iterator(cend());
}
reverse_iterator rend()
{
return reverse_iterator(begin());
}
const_reverse_iterator rend() const
{
return const_reverse_iterator(begin());
}
const_reverse_iterator crend() const
{
return const_reverse_iterator(cbegin());
}
bool empty() const
{
return m_Count == 0;
}
size_type size() const
{
return m_Count;
}
size_type max_size() const
{
return ~0u;
}
size_type count(const Key& key) const
{
return LowerBoundDuplicate(FindLowerBound(key).pBound, key) ? 1u : 0u;
}
iterator find(const Key& key)
{
return iterator(Find(key));
}
const_iterator find(const Key& key) const
{
return const_iterator(Find(key));
}
};
static_assert(sizeof(map<int, int>) == 0xC);
}

View file

@ -1,255 +0,0 @@
#pragma once
#include <Hedgehog/Base/System/hhAllocator.h>
namespace hh
{
template<typename T, typename Allocator = Hedgehog::Base::TAllocator<T>>
class vector
{
protected:
Allocator m_Alloc;
xpointer<T> m_pFirst;
xpointer<T> m_pLast;
xpointer<T> m_pEnd;
public:
using value_type = T;
using allocator_type = Allocator;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using reference = value_type&;
using const_reference = const value_type&;
using pointer = typename std::allocator_traits<Allocator>::pointer;
using const_pointer = typename std::allocator_traits<Allocator>::const_pointer;
class iterator
{
public:
using iterator_category = std::random_access_iterator_tag;
using value_type = T;
using difference_type = std::ptrdiff_t;
using pointer = T*;
using reference = T&;
iterator() : m_pPtr(nullptr) {}
iterator(T* p) : m_pPtr(p) {}
reference operator*() const { return *m_pPtr; }
pointer operator->() const { return m_pPtr; }
iterator& operator++() { ++m_pPtr; return *this; }
iterator operator++(int) { iterator tmp = *this; ++(*this); return tmp; }
iterator& operator--() { --m_pPtr; return *this; }
iterator operator--(int) { iterator tmp = *this; --(*this); return tmp; }
iterator& operator+=(difference_type n) { m_pPtr += n; return *this; }
iterator operator+(difference_type n) const { iterator tmp = *this; return tmp += n; }
friend iterator operator+(difference_type n, iterator it) { return it + n; }
iterator& operator-=(difference_type n) { return *this += -n; }
iterator operator-(difference_type n) const { iterator tmp = *this; return tmp -= n; }
difference_type operator-(const iterator& other) const { return m_pPtr - other.m_pPtr; }
reference operator[](difference_type n) const { return *(*this + n); }
bool operator==(const iterator& other) const { return m_pPtr == other.m_pPtr; }
bool operator!=(const iterator& other) const { return !(*this == other); }
bool operator<(const iterator& other) const { return m_pPtr < other.m_pPtr; }
bool operator<=(const iterator& other) const { return !(other < *this); }
bool operator>(const iterator& other) const { return other < *this; }
bool operator>=(const iterator& other) const { return !(*this < other); }
private:
T* m_pPtr;
friend class vector;
friend class const_iterator;
};
class const_iterator
{
public:
using iterator_category = std::random_access_iterator_tag;
using value_type = T;
using difference_type = std::ptrdiff_t;
using pointer = const T*;
using reference = const T&;
const_iterator() : m_pPtr(nullptr) {}
const_iterator(T* p) : m_pPtr(p) {}
const_iterator(const iterator& other) : m_pPtr(other.m_pPtr) {}
reference operator*() const { return *m_pPtr; }
pointer operator->() const { return m_pPtr; }
const_iterator& operator++() { ++m_pPtr; return *this; }
const_iterator operator++(int) { const_iterator tmp = *this; ++(*this); return tmp; }
const_iterator& operator--() { --m_pPtr; return *this; }
const_iterator operator--(int) { const_iterator tmp = *this; --(*this); return tmp; }
const_iterator& operator+=(difference_type n) { m_pPtr += n; return *this; }
const_iterator operator+(difference_type n) const { const_iterator tmp = *this; return tmp += n; }
friend const_iterator operator+(difference_type n, const_iterator it) { return it + n; }
const_iterator& operator-=(difference_type n) { return *this += -n; }
const_iterator operator-(difference_type n) const { const_iterator tmp = *this; return tmp -= n; }
difference_type operator-(const const_iterator& other) const { return m_pPtr - other.m_pPtr; }
reference operator[](difference_type n) const { return *(*this + n); }
bool operator==(const const_iterator& other) const { return m_pPtr == other.m_pPtr; }
bool operator!=(const const_iterator& other) const { return !(*this == other); }
bool operator<(const const_iterator& other) const { return m_pPtr < other.m_pPtr; }
bool operator<=(const const_iterator& other) const { return !(other < *this); }
bool operator>(const const_iterator& other) const { return other < *this; }
bool operator>=(const const_iterator& other) const { return !(*this < other); }
private:
T* m_pPtr;
friend class vector;
};
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
allocator_type get_allocator() const
{
return m_Alloc;
}
reference at(size_type pos)
{
return m_pFirst[pos];
}
const_reference at(size_type pos) const
{
return m_pFirst[pos];
}
reference operator[](size_type pos)
{
return m_pFirst[pos];
}
const_reference operator[](size_type pos) const
{
return m_pFirst[pos];
}
reference front()
{
return m_pFirst[0];
}
const_reference front() const
{
return m_pFirst[0];
}
reference back()
{
return m_pLast[-1];
}
const_reference back() const
{
return m_pLast[-1];
}
T* data()
{
return m_pFirst;
}
const T* data() const
{
return m_pFirst;
}
iterator begin()
{
return iterator(m_pFirst);
}
const_iterator begin() const
{
return const_iterator(m_pFirst);
}
const_iterator cbegin() const
{
return const_iterator(m_pFirst);
}
iterator end()
{
return iterator(m_pLast);
}
const_iterator end() const
{
return const_iterator(m_pLast);
}
const_iterator cend() const
{
return const_iterator(m_pLast);
}
reverse_iterator rbegin()
{
return reverse_iterator(end());
}
const_reverse_iterator rbegin() const
{
return const_reverse_iterator(end());
}
const_reverse_iterator crbegin() const
{
return const_reverse_iterator(cend());
}
reverse_iterator rend()
{
return reverse_iterator(begin());
}
const_reverse_iterator rend() const
{
return const_reverse_iterator(begin());
}
const_reverse_iterator crend() const
{
return const_reverse_iterator(cbegin());
}
bool empty() const
{
return m_pFirst == m_pLast;
}
size_type size() const
{
return m_pLast - m_pFirst;
}
size_type max_size() const
{
return ~0u;
}
size_type capacity() const
{
return m_pEnd - m_pFirst;
}
};
SWA_ASSERT_SIZEOF(vector<int>, 0x10);
}

View file

@ -1,36 +0,0 @@
#pragma once
#include "SWA.inl"
inline void* __HH_ALLOC(const uint32_t in_Size)
{
return GuestToHostFunction<void*>(sub_822C0988, in_Size);
}
inline void __HH_FREE(const void* in_pData)
{
GuestToHostFunction<void>(sub_822C0270, in_pData);
}
namespace Hedgehog::Base
{
template<class T>
class TAllocator
{
public:
using value_type = T;
TAllocator() noexcept {}
template<class U> TAllocator(TAllocator<U> const&) noexcept {}
value_type* allocate(std::size_t n)
{
return reinterpret_cast<value_type*>(__HH_ALLOC(n * sizeof(value_type)));
}
void deallocate(value_type* p, std::size_t) noexcept
{
__HH_FREE(p);
}
};
}

View file

@ -1,27 +0,0 @@
#pragma once
#include <SWA.inl>
namespace Hedgehog::Base
{
class CSharedString;
class CStringSymbol
{
public:
be<uint32_t> m_Index;
CStringSymbol();
CStringSymbol(const char* in_pName);
CStringSymbol(const CSharedString& in_rName);
bool operator==(const CStringSymbol& in_rOther) const;
bool operator!=(const CStringSymbol& in_rOther) const;
bool operator<(const CStringSymbol& in_rOther) const;
};
SWA_ASSERT_OFFSETOF(CStringSymbol, m_Index, 0);
SWA_ASSERT_SIZEOF(CStringSymbol, 4);
}
#include <Hedgehog/Base/System/hhSymbol.inl>

View file

@ -1,31 +0,0 @@
namespace Hedgehog::Base
{
inline CStringSymbol::CStringSymbol()
{
}
inline CStringSymbol::CStringSymbol(const char* in_pName)
{
GuestToHostFunction<void>(sub_82E014D8, this, in_pName);
}
inline CStringSymbol::CStringSymbol(const CSharedString& in_rName)
{
GuestToHostFunction<void>(sub_82E013B0, this, &in_rName);
}
inline bool CStringSymbol::operator==(const CStringSymbol& in_rOther) const
{
return m_Index == in_rOther.m_Index;
}
inline bool CStringSymbol::operator!=(const CStringSymbol& in_rOther) const
{
return m_Index != in_rOther.m_Index;
}
inline bool CStringSymbol::operator<(const CStringSymbol& in_rOther) const
{
return m_Index < in_rOther.m_Index;
}
}

View file

@ -1,20 +0,0 @@
#pragma once
#include "Hedgehog/Base/Thread/hhHolderBase.h"
#define HH_BASE_HOLDER(x) \
Hedgehog::Base::THolder(x)
namespace Hedgehog::Base
{
template<typename T, bool ForceSync = true>
class THolder : public CHolderBase
{
public:
THolder(T* in_pObject) : CHolderBase(in_pObject, ForceSync) {}
T* get() const;
T* operator->() const;
T* operator*() const;
};
}

View file

@ -1,28 +0,0 @@
#pragma once
#include "SWA.inl"
namespace Hedgehog::Base
{
class CSynchronizedObject;
class CHolderBase
{
protected:
xpointer<CSynchronizedObject> m_pSynchronizedObject;
bool m_Locked;
public:
CHolderBase() : m_pSynchronizedObject(nullptr), m_Locked(false) {}
CHolderBase(CSynchronizedObject* in_pSynchronizedObject, bool in_ForceSync = false);
CHolderBase(CHolderBase&& io_rOther);
CHolderBase(const CHolderBase& in_rOther);
~CHolderBase();
CSynchronizedObject* get() const;
CSynchronizedObject* operator->() const;
CSynchronizedObject* operator*() const;
explicit operator bool() const;
};
}

View file

@ -1,12 +0,0 @@
#pragma once
#include "SWA.inl"
namespace Hedgehog::Base
{
class CSynchronizedObject
{
public:
SWA_INSERT_PADDING(0x04);
};
}

View file

@ -1,27 +0,0 @@
#pragma once
#include "SWA.inl"
#include "Hedgehog/Base/Thread/hhHolder.h"
namespace Hedgehog::Base
{
template<typename T, bool ForceSync = false>
class TSynchronizedPtr
{
xpointer<T> m_pObject;
public:
TSynchronizedPtr(T* in_pObject);
TSynchronizedPtr();
TSynchronizedPtr(const TSynchronizedPtr& in_rOther);
TSynchronizedPtr(TSynchronizedPtr&& io_rOther);
TSynchronizedPtr<T, ForceSync>& operator=(T* const in_pObject);
THolder<T, ForceSync> get() const;
THolder<T, ForceSync> operator->() const;
THolder<T, ForceSync> operator*() const;
explicit operator bool() const;
};
}

View file

@ -1,22 +0,0 @@
#pragma once
#include <SWA.inl>
namespace Hedgehog::Base
{
struct SStringHolder
{
be<uint32_t> RefCount;
char aStr[];
static SStringHolder* GetHolder(const char* in_pStr);
static SStringHolder* Make(const char* in_pStr);
void AddRef();
void Release();
bool IsUnique() const;
};
}
#include <Hedgehog/Base/Type/detail/hhStringHolder.inl>

View file

@ -1,47 +0,0 @@
namespace Hedgehog::Base
{
inline SStringHolder* SStringHolder::GetHolder(const char* in_pStr)
{
return (SStringHolder*)((size_t)in_pStr - sizeof(RefCount));
}
inline SStringHolder* SStringHolder::Make(const char* in_pStr)
{
auto pHolder = (SStringHolder*)__HH_ALLOC(sizeof(RefCount) + strlen(in_pStr) + 1);
pHolder->RefCount = 1;
strcpy(pHolder->aStr, in_pStr);
return pHolder;
}
inline void SStringHolder::AddRef()
{
std::atomic_ref refCount(RefCount.value);
be<uint32_t> original, incremented;
do
{
original = RefCount;
incremented = original + 1;
} while (!refCount.compare_exchange_weak(original.value, incremented.value));
}
inline void SStringHolder::Release()
{
std::atomic_ref refCount(RefCount.value);
be<uint32_t> original, decremented;
do
{
original = RefCount;
decremented = original - 1;
} while (!refCount.compare_exchange_weak(original.value, decremented.value));
if (decremented == 0)
__HH_FREE(this);
}
inline bool SStringHolder::IsUnique() const
{
return RefCount == 1;
}
}

View file

@ -1,38 +0,0 @@
#pragma once
#include <Hedgehog/Base/Type/detail/hhStringHolder.h>
namespace Hedgehog::Base
{
class CSharedString
{
private:
xpointer<const char> m_pStr;
SStringHolder* GetHolder() const;
CSharedString(SStringHolder* in_pHolder);
public:
static constexpr size_t npos = ~0u;
CSharedString();
CSharedString(const char* in_pStr);
CSharedString(const CSharedString& in_rOther);
CSharedString(CSharedString&& io_rOther);
~CSharedString();
const char* get() const;
const char* c_str() const;
const char* data() const;
size_t size() const;
size_t length() const;
bool empty() const;
const char* begin() const;
const char* end() const;
};
}
#include <Hedgehog/Base/Type/hhSharedString.inl>

View file

@ -1,78 +0,0 @@
namespace Hedgehog::Base
{
inline SStringHolder* CSharedString::GetHolder() const
{
return SStringHolder::GetHolder(m_pStr);
}
inline CSharedString::CSharedString(SStringHolder* in_pHolder) : m_pStr(in_pHolder->aStr)
{
}
inline CSharedString::CSharedString() : m_pStr(nullptr)
{
}
inline CSharedString::CSharedString(const char* in_pStr) : m_pStr(nullptr)
{
size_t length;
if (in_pStr && (length = strlen(in_pStr)) != 0)
m_pStr.ptr = g_memory.MapVirtual(SStringHolder::Make(in_pStr)->aStr);
}
inline CSharedString::CSharedString(const CSharedString& in_rOther) : m_pStr(in_rOther.m_pStr)
{
GetHolder()->AddRef();
}
inline CSharedString::CSharedString(CSharedString&& io_rOther) : m_pStr(io_rOther.m_pStr)
{
io_rOther.m_pStr = nullptr;
}
inline CSharedString::~CSharedString()
{
GetHolder()->Release();
}
inline const char* CSharedString::get() const
{
return m_pStr;
}
inline const char* CSharedString::c_str() const
{
return get();
}
inline const char* CSharedString::data() const
{
return get();
}
inline size_t CSharedString::size() const
{
return strlen(m_pStr);
}
inline size_t CSharedString::length() const
{
return size();
}
inline bool CSharedString::empty() const
{
return size() == 0;
}
inline const char* CSharedString::begin() const
{
return get();
}
inline const char* CSharedString::end() const
{
return &m_pStr[size()];
}
}

View file

@ -1,23 +0,0 @@
#pragma once
#include "SWA.inl"
namespace Hedgehog::Base
{
class CObject
{
public:
CObject();
CObject(const swa_null_ctor&);
void* operator new(const size_t in_Size);
void* operator new(const size_t in_Size, const size_t in_Align);
void operator delete(void* in_pMem);
void* operator new(const size_t in_Size, void* in_pObj);
void* operator new(const size_t in_Size, const size_t in_Align, void* in_pObj);
void operator delete(void* in_pMem, void* in_pObj);
};
}

View file

@ -1,40 +0,0 @@
#pragma once
#include <Hedgehog/Base/hhObject.h>
#include <Hedgehog/Base/Type/hhSharedString.h>
namespace Hedgehog::Database
{
enum EDatabaseDataFlags : uint8_t
{
eDatabaseDataFlags_IsMadeOne = 0x1,
eDatabaseDataFlags_IsMadeAll = 0x2,
eDatabaseDataFlags_CreatedFromArchive = 0x4,
eDatabaseDataFlags_IsMadeMakingOne = 0x8
};
class CDatabaseData : public Base::CObject
{
public:
struct Vftable
{
be<uint32_t> m_fpDtor;
be<uint32_t> m_fpCheckMadeAll;
};
xpointer<Vftable> m_pVftable;
uint8_t m_Flags;
Base::CSharedString m_TypeAndName;
~CDatabaseData();
bool CheckMadeAll();
bool IsMadeOne() const;
void SetMadeOne();
bool IsMadeAllInternal();
bool IsMadeAll();
};
}
#include "Hedgehog/Database/System/hhDatabaseData.inl"

View file

@ -1,36 +0,0 @@
namespace Hedgehog::Database
{
inline CDatabaseData::~CDatabaseData()
{
GuestToHostFunction<void>(m_pVftable->m_fpDtor, this);
}
inline bool CDatabaseData::CheckMadeAll()
{
return GuestToHostFunction<bool>(m_pVftable->m_fpCheckMadeAll, this);
}
inline bool CDatabaseData::IsMadeOne() const
{
return (m_Flags & eDatabaseDataFlags_IsMadeOne) != 0;
}
inline void CDatabaseData::SetMadeOne()
{
m_Flags |= eDatabaseDataFlags_IsMadeOne;
}
inline bool CDatabaseData::IsMadeAllInternal()
{
if ((m_Flags & eDatabaseDataFlags_IsMadeOne) == 0 || !CheckMadeAll())
return false;
m_Flags |= eDatabaseDataFlags_IsMadeAll;
return true;
}
inline bool CDatabaseData::IsMadeAll()
{
return (m_Flags & eDatabaseDataFlags_IsMadeAll) != 0 || IsMadeAllInternal();
}
}

View file

@ -1,27 +0,0 @@
#pragma once
#include <SWA.inl>
namespace Hedgehog::Math
{
class CMatrix
{
public:
be<float> m_M00;
be<float> m_M01;
be<float> m_M02;
be<float> m_M03;
be<float> m_M10;
be<float> m_M11;
be<float> m_M12;
be<float> m_M13;
be<float> m_M20;
be<float> m_M21;
be<float> m_M22;
be<float> m_M23;
be<float> m_M30;
be<float> m_M31;
be<float> m_M32;
be<float> m_M33;
};
}

View file

@ -1,15 +0,0 @@
#pragma once
#include <SWA.inl>
namespace Hedgehog::Math
{
class CQuaternion
{
public:
be<float> X;
be<float> Y;
be<float> Z;
be<float> W;
};
}

View file

@ -1,31 +0,0 @@
#pragma once
#include "SWA.inl"
namespace Hedgehog::Math
{
class CVector2
{
public:
be<float> X;
be<float> Y;
};
class CVector
{
public:
be<float> X;
be<float> Y;
be<float> Z;
be<float> W;
};
class CVector4
{
public:
be<float> X;
be<float> Y;
be<float> Z;
be<float> W;
};
}

View file

@ -1,16 +0,0 @@
#pragma once
#include <SWA.inl>
namespace Hedgehog::Mirage
{
class CMatrixNodeListener;
class CMatrixNode : public Base::CObject
{
public:
SWA_INSERT_PADDING(0x60);
};
SWA_ASSERT_SIZEOF(CMatrixNode, 0x60);
}

View file

@ -1,19 +0,0 @@
#pragma once
#include <SWA.inl>
namespace Hedgehog::Mirage
{
class CTransform
{
public:
Math::CQuaternion m_Rotation;
Math::CVector m_Position;
Math::CMatrix m_Matrix;
};
SWA_ASSERT_OFFSETOF(CTransform, m_Rotation, 0x00);
SWA_ASSERT_OFFSETOF(CTransform, m_Position, 0x10);
SWA_ASSERT_OFFSETOF(CTransform, m_Matrix, 0x20);
SWA_ASSERT_SIZEOF(CTransform, 0x60);
}

View file

@ -1,19 +0,0 @@
#pragma once
#include <SWA.inl>
namespace Hedgehog::Mirage
{
class CRenderingInfrastructure;
class CVertexDeclarationPtr
{
public:
xpointer<void> m_pD3DVertexDeclaration;
xpointer<CRenderingInfrastructure> m_pRenderingInfrastructure;
};
SWA_ASSERT_OFFSETOF(CVertexDeclarationPtr, m_pD3DVertexDeclaration, 0x0);
SWA_ASSERT_OFFSETOF(CVertexDeclarationPtr, m_pRenderingInfrastructure, 0x4);
SWA_ASSERT_SIZEOF(CVertexDeclarationPtr, 0x8);
}

View file

@ -1,39 +0,0 @@
#pragma once
#include <boost/smart_ptr/shared_ptr.h>
#include <Hedgehog/Base/Container/hhVector.h>
#include <Hedgehog/Database/System/hhDatabaseData.h>
namespace Hedgehog::Mirage
{
class CMaterialData;
class CTexsetData;
class CShaderListData;
class CParameterFloat4Element;
class CParameterInt4Element;
class CParameterBoolElement;
class CMaterialData : public Database::CDatabaseData
{
public:
boost::shared_ptr<CShaderListData> m_spShaderListData;
boost::shared_ptr<CTexsetData> m_spTexsetData;
hh::vector<boost::shared_ptr<CParameterFloat4Element>> m_Float4Params;
hh::vector<boost::shared_ptr<CParameterInt4Element>> m_Int4Params;
hh::vector<boost::shared_ptr<CParameterBoolElement>> m_Bool4Params;
uint8_t m_AlphaThreshold;
bool m_DoubleSided;
bool m_Additive;
};
SWA_ASSERT_OFFSETOF(CMaterialData, m_spShaderListData, 0xC);
SWA_ASSERT_OFFSETOF(CMaterialData, m_spTexsetData, 0x14);
SWA_ASSERT_OFFSETOF(CMaterialData, m_Float4Params, 0x1C);
SWA_ASSERT_OFFSETOF(CMaterialData, m_Int4Params, 0x2C);
SWA_ASSERT_OFFSETOF(CMaterialData, m_Bool4Params, 0x3C);
SWA_ASSERT_OFFSETOF(CMaterialData, m_AlphaThreshold, 0x4C);
SWA_ASSERT_OFFSETOF(CMaterialData, m_DoubleSided, 0x4D);
SWA_ASSERT_OFFSETOF(CMaterialData, m_Additive, 0x4E);
SWA_ASSERT_SIZEOF(CMaterialData, 0x50);
}

View file

@ -1,43 +0,0 @@
#pragma once
#include <boost/smart_ptr/shared_ptr.h>
#include <Hedgehog/Base/Type/hhSharedString.h>
#include <Hedgehog/Database/System/hhDatabaseData.h>
#include <Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h>
namespace Hedgehog::Mirage
{
class CMaterialData;
class CMeshData : public Database::CDatabaseData
{
public:
be<uint32_t> m_IndexNum;
be<uint32_t> m_VertexNum;
be<uint32_t> m_VertexSize;
be<uint32_t> m_NodeNum;
xpointer<uint8_t> m_pNodeIndices;
be<uint32_t> m_VertexOffset;
be<uint32_t> m_IndexOffset;
xpointer<void> m_pD3DIndexBuffer;
xpointer<void> m_pD3DVertexBuffer;
CVertexDeclarationPtr m_VertexDeclarationPtr;
SWA_INSERT_PADDING(0x4);
boost::shared_ptr<CMaterialData> m_spMaterial;
SWA_INSERT_PADDING(0xC);
};
SWA_ASSERT_OFFSETOF(CMeshData, m_IndexNum, 0xC);
SWA_ASSERT_OFFSETOF(CMeshData, m_VertexNum, 0x10);
SWA_ASSERT_OFFSETOF(CMeshData, m_VertexSize, 0x14);
SWA_ASSERT_OFFSETOF(CMeshData, m_NodeNum, 0x18);
SWA_ASSERT_OFFSETOF(CMeshData, m_pNodeIndices, 0x1C);
SWA_ASSERT_OFFSETOF(CMeshData, m_VertexOffset, 0x20);
SWA_ASSERT_OFFSETOF(CMeshData, m_IndexOffset, 0x24);
SWA_ASSERT_OFFSETOF(CMeshData, m_pD3DIndexBuffer, 0x28);
SWA_ASSERT_OFFSETOF(CMeshData, m_pD3DVertexBuffer, 0x2C);
SWA_ASSERT_OFFSETOF(CMeshData, m_VertexDeclarationPtr, 0x30);
SWA_ASSERT_OFFSETOF(CMeshData, m_spMaterial, 0x3C);
SWA_ASSERT_SIZEOF(CMeshData, 0x50);
}

View file

@ -1,26 +0,0 @@
#pragma once
#include <boost/smart_ptr/shared_ptr.h>
#include <Hedgehog/Database/System/hhDatabaseData.h>
namespace Hedgehog::Mirage
{
class CMaterialData;
class CMeshIndexData : public Hedgehog::Database::CDatabaseData
{
public:
be<uint32_t> m_IndexNum;
be<uint32_t> m_NodeNum;
xpointer<uint8_t> m_pNodeIndices;
xpointer<void> m_pD3DIndexBuffer;
boost::shared_ptr<CMaterialData> m_spMaterial;
};
SWA_ASSERT_OFFSETOF(CMeshIndexData, m_IndexNum, 0xC);
SWA_ASSERT_OFFSETOF(CMeshIndexData, m_NodeNum, 0x10);
SWA_ASSERT_OFFSETOF(CMeshIndexData, m_pNodeIndices, 0x14);
SWA_ASSERT_OFFSETOF(CMeshIndexData, m_pD3DIndexBuffer, 0x18);
SWA_ASSERT_OFFSETOF(CMeshIndexData, m_spMaterial, 0x1C);
SWA_ASSERT_SIZEOF(CMeshIndexData, 0x24);
}

View file

@ -1,46 +0,0 @@
#pragma once
#include <Hedgehog/Base/Container/hhVector.h>
#include <Hedgehog/Database/System/hhDatabaseData.h>
namespace Hedgehog::Mirage
{
class CNodeGroupModelData;
class CMeshData;
class CModelNodeData;
class CMatrixData;
class CAabbData;
class CSphereData;
class CMorphModelData;
class CModelData : public Database::CDatabaseData
{
public:
be<uint32_t> m_NodeGroupModelNum;
hh::vector<boost::shared_ptr<CNodeGroupModelData>> m_NodeGroupModels;
hh::vector<boost::shared_ptr<CMeshData>> m_OpaqueMeshes;
hh::vector<boost::shared_ptr<CMeshData>> m_TransparentMeshes;
hh::vector<boost::shared_ptr<CMeshData>> m_PunchThroughMeshes;
be<uint32_t> m_NodeNum;
boost::shared_ptr<uint8_t[]> m_spNodeParentIndices;
boost::shared_ptr<CModelNodeData[]> m_spNodes;
boost::shared_ptr<CMatrixData[]> m_spNodeMatrices;
boost::shared_ptr<CAabbData> m_spAabb;
boost::shared_ptr<CSphereData> m_spSphere;
hh::vector<boost::shared_ptr<CMorphModelData>> m_MorphModels;
};
SWA_ASSERT_OFFSETOF(CModelData, m_NodeGroupModelNum, 0xC);
SWA_ASSERT_OFFSETOF(CModelData, m_NodeGroupModels, 0x10);
SWA_ASSERT_OFFSETOF(CModelData, m_OpaqueMeshes, 0x20);
SWA_ASSERT_OFFSETOF(CModelData, m_TransparentMeshes, 0x30);
SWA_ASSERT_OFFSETOF(CModelData, m_PunchThroughMeshes, 0x40);
SWA_ASSERT_OFFSETOF(CModelData, m_NodeNum, 0x50);
SWA_ASSERT_OFFSETOF(CModelData, m_spNodeParentIndices, 0x54);
SWA_ASSERT_OFFSETOF(CModelData, m_spNodes, 0x5C);
SWA_ASSERT_OFFSETOF(CModelData, m_spNodeMatrices, 0x64);
SWA_ASSERT_OFFSETOF(CModelData, m_spAabb, 0x6C);
SWA_ASSERT_OFFSETOF(CModelData, m_spSphere, 0x74);
SWA_ASSERT_OFFSETOF(CModelData, m_MorphModels, 0x7C);
SWA_ASSERT_SIZEOF(CModelData, 0x8C);
}

View file

@ -1,38 +0,0 @@
#pragma once
#include <boost/smart_ptr/shared_ptr.h>
#include <Hedgehog/Base/Container/hhVector.h>
#include <Hedgehog/Database/System/hhDatabaseData.h>
#include <Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h>
namespace Hedgehog::Mirage
{
class CMorphTargetData;
class CMeshIndexData;
class CMorphModelData : public Hedgehog::Database::CDatabaseData
{
public:
be<uint32_t> m_VertexNum;
be<uint32_t> m_VertexSize;
be<uint32_t> m_MorphTargetVertexSize;
xpointer<void> m_pD3DVertexBuffer;
CVertexDeclarationPtr m_VertexDeclarationPtr;
hh::vector<boost::shared_ptr<CMorphTargetData>> m_MorphTargetList;
hh::vector<boost::shared_ptr<CMeshIndexData>> m_OpaqueMeshList;
hh::vector<boost::shared_ptr<CMeshIndexData>> m_TransparentMeshList;
hh::vector<boost::shared_ptr<CMeshIndexData>> m_PunchThroughMeshList;
};
SWA_ASSERT_OFFSETOF(CMorphModelData, m_VertexNum, 0xC);
SWA_ASSERT_OFFSETOF(CMorphModelData, m_VertexSize, 0x10);
SWA_ASSERT_OFFSETOF(CMorphModelData, m_MorphTargetVertexSize, 0x14);
SWA_ASSERT_OFFSETOF(CMorphModelData, m_pD3DVertexBuffer, 0x18);
SWA_ASSERT_OFFSETOF(CMorphModelData, m_VertexDeclarationPtr, 0x1C);
SWA_ASSERT_OFFSETOF(CMorphModelData, m_MorphTargetList, 0x24);
SWA_ASSERT_OFFSETOF(CMorphModelData, m_OpaqueMeshList, 0x34);
SWA_ASSERT_OFFSETOF(CMorphModelData, m_TransparentMeshList, 0x44);
SWA_ASSERT_OFFSETOF(CMorphModelData, m_PunchThroughMeshList, 0x54);
SWA_ASSERT_SIZEOF(CMorphModelData, 0x64);
}

View file

@ -1,30 +0,0 @@
#pragma once
#include <Hedgehog/Base/Container/hhVector.h>
#include <Hedgehog/Database/System/hhDatabaseData.h>
namespace Hedgehog::Mirage
{
class CMeshData;
class CNodeGroupModelData : public Database::CDatabaseData
{
public:
hh::vector<boost::shared_ptr<CMeshData>> m_OpaqueMeshes;
hh::vector<boost::shared_ptr<CMeshData>> m_TransparentMeshes;
hh::vector<boost::shared_ptr<CMeshData>> m_PunchThroughMeshes;
be<uint32_t> m_SpecialMeshGroupNum;
boost::shared_ptr<be<uint32_t>> m_SpecialMeshGroupModes;
hh::vector<hh::vector<boost::shared_ptr<CMeshData>>> m_SpecialMeshGroups;
Base::CSharedString m_Name;
};
SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_OpaqueMeshes, 0xC);
SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_TransparentMeshes, 0x1C);
SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_PunchThroughMeshes, 0x2C);
SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_SpecialMeshGroupNum, 0x3C);
SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_SpecialMeshGroupModes, 0x40);
SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_SpecialMeshGroups, 0x48);
SWA_ASSERT_OFFSETOF(CNodeGroupModelData, m_Name, 0x58);
SWA_ASSERT_SIZEOF(CNodeGroupModelData, 0x5C);
}

View file

@ -1,30 +0,0 @@
#pragma once
#include <boost/smart_ptr/shared_ptr.h>
#include <Hedgehog/Database/System/hhDatabaseData.h>
namespace Hedgehog::Base
{
class CCriticalSectionD3D9;
}
namespace Hedgehog::Mirage
{
class CRenderingInfrastructure;
class CPixelShaderCodeData : public Database::CDatabaseData
{
public:
xpointer<void> m_pD3DPixelShader;
xpointer<uint8_t> m_spFunction;
boost::shared_ptr<Base::CCriticalSectionD3D9> m_spCriticalSection;
xpointer<CRenderingInfrastructure> m_pRenderingInfrastructure;
};
SWA_ASSERT_OFFSETOF(CPixelShaderCodeData, m_pD3DPixelShader, 0xC);
SWA_ASSERT_OFFSETOF(CPixelShaderCodeData, m_spFunction, 0x10);
SWA_ASSERT_OFFSETOF(CPixelShaderCodeData, m_spCriticalSection, 0x14);
SWA_ASSERT_OFFSETOF(CPixelShaderCodeData, m_pRenderingInfrastructure, 0x1C);
SWA_ASSERT_SIZEOF(CPixelShaderCodeData, 0x20);
}

View file

@ -1,22 +0,0 @@
#pragma once
#include <Hedgehog/Base/Container/hhVector.h>
#include <Hedgehog/Database/System/hhDatabaseData.h>
namespace Hedgehog::Mirage
{
class CPixelShaderCodeData;
class CPixelShaderParameterData;
class CPixelShaderData : public Hedgehog::Database::CDatabaseData
{
public:
boost::shared_ptr<CPixelShaderCodeData> m_spCode;
SWA_INSERT_PADDING(0x4);
hh::vector<boost::shared_ptr<CPixelShaderParameterData>> m_ParameterList;
};
SWA_ASSERT_OFFSETOF(CPixelShaderData, m_spCode, 0xC);
SWA_ASSERT_OFFSETOF(CPixelShaderData, m_ParameterList, 0x18);
SWA_ASSERT_SIZEOF(CPixelShaderData, 0x28);
}

View file

@ -1,46 +0,0 @@
#pragma once
#include <boost/smart_ptr/shared_ptr.h>
#include <Hedgehog/Base/Container/hhMap.h>
#include <Hedgehog/Base/System/hhSymbol.h>
#include <Hedgehog/Database/System/hhDatabaseData.h>
namespace Hedgehog::Mirage
{
class CVertexShaderData;
class CPixelShaderData;
class CVertexShaderPermutationData
{
public:
hh::map<be<uint32_t>, boost::shared_ptr<CVertexShaderData>> m_VertexShaders;
be<uint32_t> m_SubPermutations;
};
SWA_ASSERT_OFFSETOF(CVertexShaderPermutationData, m_VertexShaders, 0x0);
SWA_ASSERT_OFFSETOF(CVertexShaderPermutationData, m_SubPermutations, 0xC);
SWA_ASSERT_SIZEOF(CVertexShaderPermutationData, 0x10);
class CPixelShaderPermutationData
{
public:
hh::map<Base::CStringSymbol, boost::shared_ptr<CVertexShaderPermutationData>> m_VertexShaderPermutations;
hh::map<be<uint32_t>, boost::shared_ptr<CPixelShaderData>> m_PixelShaders;
be<uint32_t> m_SubPermutations;
};
SWA_ASSERT_OFFSETOF(CPixelShaderPermutationData, m_VertexShaderPermutations, 0x0);
SWA_ASSERT_OFFSETOF(CPixelShaderPermutationData, m_PixelShaders, 0xC);
SWA_ASSERT_OFFSETOF(CPixelShaderPermutationData, m_SubPermutations, 0x18);
SWA_ASSERT_SIZEOF(CPixelShaderPermutationData, 0x1C);
class CShaderListData : public Database::CDatabaseData
{
public:
hh::map<Base::CStringSymbol, CPixelShaderPermutationData> m_PixelShaderPermutations;
};
SWA_ASSERT_OFFSETOF(CShaderListData, m_PixelShaderPermutations, 0xC);
SWA_ASSERT_SIZEOF(CShaderListData, 0x18);
}

View file

@ -1,29 +0,0 @@
#pragma once
#include <Hedgehog/Base/Container/hhVector.h>
#include <Hedgehog/Database/System/hhDatabaseData.h>
namespace Hedgehog::Mirage
{
class CSphereData;
class CNodeGroupModelData;
class CMeshData;
class CTerrainModelData : public Database::CDatabaseData
{
public:
SWA_INSERT_PADDING(0x4);
hh::vector<boost::shared_ptr<CNodeGroupModelData>> m_NodeGroupModels;
hh::vector<boost::shared_ptr<CMeshData>> m_OpaqueMeshes;
hh::vector<boost::shared_ptr<CMeshData>> m_TransparentMeshes;
hh::vector<boost::shared_ptr<CMeshData>> m_PunchThroughMeshes;
boost::shared_ptr<CSphereData> m_spSphere;
};
SWA_ASSERT_OFFSETOF(CTerrainModelData, m_NodeGroupModels, 0x10);
SWA_ASSERT_OFFSETOF(CTerrainModelData, m_OpaqueMeshes, 0x20);
SWA_ASSERT_OFFSETOF(CTerrainModelData, m_TransparentMeshes, 0x30);
SWA_ASSERT_OFFSETOF(CTerrainModelData, m_PunchThroughMeshes, 0x40);
SWA_ASSERT_OFFSETOF(CTerrainModelData, m_spSphere, 0x50);
SWA_ASSERT_SIZEOF(CTerrainModelData, 0x58);
}

View file

@ -1,24 +0,0 @@
#pragma once
#include <boost/smart_ptr/shared_ptr.h>
#include <Hedgehog/Base/Container/hhVector.h>
#include <Hedgehog/Database/System/hhDatabaseData.h>
namespace Hedgehog::Mirage
{
class CTextureData;
class CTexsetData : public Database::CDatabaseData
{
public:
hh::vector<boost::shared_ptr<CTextureData>> m_TextureList;
hh::vector<Base::CSharedString> m_TextureNameList;
bool m_ConstTexCoord;
};
SWA_ASSERT_OFFSETOF(CTexsetData, m_TextureList, 0xC);
SWA_ASSERT_OFFSETOF(CTexsetData, m_TextureNameList, 0x1C);
SWA_ASSERT_OFFSETOF(CTexsetData, m_ConstTexCoord, 0x2C);
SWA_ASSERT_SIZEOF(CTexsetData, 0x30);
}

View file

@ -1,17 +0,0 @@
#pragma once
#include <Hedgehog/Database/System/hhDatabaseData.h>
namespace Hedgehog::Mirage
{
class CTextureData : public Database::CDatabaseData
{
public:
SWA_INSERT_PADDING(0x8);
uint8_t m_TexcoordIndex;
SWA_INSERT_PADDING(0x1B);
};
SWA_ASSERT_OFFSETOF(CTextureData, m_TexcoordIndex, 0x14);
SWA_ASSERT_SIZEOF(CTextureData, 0x30);
}

View file

@ -1,30 +0,0 @@
#pragma once
#include <boost/smart_ptr/shared_ptr.h>
#include <Hedgehog/Database/System/hhDatabaseData.h>
namespace Hedgehog::Base
{
class CCriticalSectionD3D9;
}
namespace Hedgehog::Mirage
{
class CRenderingInfrastructure;
class CVertexShaderCodeData : public Database::CDatabaseData
{
public:
xpointer<void> m_pD3DVertexShader;
xpointer<uint8_t> m_spFunction;
boost::shared_ptr<Base::CCriticalSectionD3D9> m_spCriticalSection;
xpointer<CRenderingInfrastructure> m_pRenderingInfrastructure;
};
SWA_ASSERT_OFFSETOF(CVertexShaderCodeData, m_pD3DVertexShader, 0xC);
SWA_ASSERT_OFFSETOF(CVertexShaderCodeData, m_spFunction, 0x10);
SWA_ASSERT_OFFSETOF(CVertexShaderCodeData, m_spCriticalSection, 0x14);
SWA_ASSERT_OFFSETOF(CVertexShaderCodeData, m_pRenderingInfrastructure, 0x1C);
SWA_ASSERT_SIZEOF(CVertexShaderCodeData, 0x20);
}

View file

@ -1,22 +0,0 @@
#pragma once
#include <Hedgehog/Base/Container/hhVector.h>
#include <Hedgehog/Database/System/hhDatabaseData.h>
namespace Hedgehog::Mirage
{
class CVertexShaderCodeData;
class CVertexShaderParameterData;
class CVertexShaderData : public Hedgehog::Database::CDatabaseData
{
public:
boost::shared_ptr<CVertexShaderCodeData> m_spCode;
SWA_INSERT_PADDING(0x4);
hh::vector<boost::shared_ptr<CVertexShaderParameterData>> m_ParameterList;
};
SWA_ASSERT_OFFSETOF(CVertexShaderData, m_spCode, 0xC);
SWA_ASSERT_OFFSETOF(CVertexShaderData, m_ParameterList, 0x18);
SWA_ASSERT_SIZEOF(CVertexShaderData, 0x28);
}

View file

@ -1,14 +0,0 @@
#pragma once
#include "SWA.inl"
#include "Hedgehog/Base/hhObject.h"
namespace Hedgehog::Mirage
{
class CRenderable : public Base::CObject
{
public:
xpointer<void> m_pVftable;
bool m_Enabled;
};
}

View file

@ -1,41 +0,0 @@
#pragma once
#include <boost/smart_ptr/shared_ptr.h>
#include <Hedgehog/Base/Container/hhVector.h>
#include <Hedgehog/Database/System/hhDatabaseData.h>
namespace Hedgehog::Mirage
{
class CShaderListData;
}
namespace Hedgehog::Sparkle
{
class CParticleMaterial : public Hedgehog::Database::CDatabaseData
{
public:
enum EBlendMode
{
eBlendMode_Zero,
eBlendMode_Typical,
eBlendMode_Add,
eBlendMode_Subtract
};
hh::vector<boost::anonymous_shared_ptr> m_spFieldC;
boost::shared_ptr<Hedgehog::Mirage::CShaderListData> m_spDefaultShaderListData; // BillboardParticle_d[v]
boost::shared_ptr<Hedgehog::Mirage::CShaderListData> m_spShaderListData;
bool m_Field2C;
be<uint32_t> m_BlendMode;
be<uint32_t> m_AddressMode;
Hedgehog::Base::CSharedString m_MaterialName;
Hedgehog::Base::CSharedString m_TextureName;
Hedgehog::Base::CSharedString m_DeflectionTextureName;
Hedgehog::Base::CSharedString m_ShaderName;
be<float> m_Field48;
be<float> m_Field4C;
};
SWA_ASSERT_SIZEOF(CParticleMaterial, 0x50);
}

View file

@ -1,14 +0,0 @@
#pragma once
#include "SWA.inl"
#include "Hedgehog/Universe/Engine/hhMessageProcess.h"
#include "Hedgehog/Universe/Thread/hhParallelJob.h"
namespace Hedgehog::Universe
{
class CMessageActor : public IMessageProcess, public IParallelJob
{
public:
SWA_INSERT_PADDING(0x88);
};
}

View file

@ -1,14 +0,0 @@
#pragma once
#include "SWA.inl"
#include "Hedgehog/Base/hhObject.h"
namespace Hedgehog::Universe
{
class IMessageProcess : public Base::CObject
{
public:
IMessageProcess() {}
IMessageProcess(const swa_null_ctor& nil) : CObject(nil) {}
};
}

View file

@ -1,32 +0,0 @@
#pragma once
#include <SWA.inl>
#include <Hedgehog/Base/hhObject.h>
#include <Hedgehog/Universe/Engine/hhMessageProcess.h>
#include <Hedgehog/Universe/Engine/hhStateMachineMessageReceiver.h>
namespace Hedgehog::Universe
{
class CStateMachineBase : public IStateMachineMessageReceiver, public Base::CObject
{
public:
class CStateBase : public IMessageProcess
{
public:
SWA_INSERT_PADDING(0x08);
xpointer<void> m_pContext;
xpointer<CStateMachineBase> m_pStateMachine;
be<float> m_Time;
SWA_INSERT_PADDING(0x4C);
void* GetContextBase() const;
template<typename T>
T* GetContextBase() const;
};
SWA_INSERT_PADDING(0x60);
};
}
#include <Hedgehog/Universe/Engine/hhStateMachineBase.inl>

View file

@ -1,13 +0,0 @@
namespace Hedgehog::Universe
{
inline void* CStateMachineBase::CStateBase::GetContextBase() const
{
return m_pContext;
}
template<typename T>
inline T* CStateMachineBase::CStateBase::GetContextBase() const
{
return (T*)m_pContext.get();
}
}

View file

@ -1,12 +0,0 @@
#pragma once
#include <SWA.inl>
namespace Hedgehog::Universe
{
class IStateMachineMessageReceiver
{
public:
IStateMachineMessageReceiver(const swa_null_ctor&) {}
};
}

View file

@ -1,13 +0,0 @@
#pragma once
#include "SWA.inl"
namespace Hedgehog::Universe
{
struct SUpdateInfo
{
be<float> DeltaTime;
be<uint32_t> Frame;
Base::CSharedString Category;
};
}

View file

@ -1,25 +0,0 @@
#pragma once
#include "SWA.inl"
#include "Hedgehog/Universe/Thread/hhParallelJob.h"
namespace Hedgehog::Universe
{
class CUpdateUnit : public Base::CObject, public IParallelJob
{
public:
xpointer<void> m_pVftable;
SWA_INSERT_PADDING(0x20);
CUpdateUnit(const swa_null_ctor& nil) : CObject(nil), IParallelJob(nil) {}
CUpdateUnit();
// TODO: implement virtual functions.
// virtual ~CUpdateUnit();
//
// virtual void ExecuteParallelJob(const SUpdateInfo& in_rUpdateInfo) override;
//
// virtual void UpdateParallel(const SUpdateInfo& in_rUpdateInfo) {}
// virtual void UpdateSerial(const SUpdateInfo& in_rUpdateInfo) {}
};
}

View file

@ -1,21 +0,0 @@
#pragma once
#include "SWA.inl"
#include "Hedgehog/Universe/Engine/hhUpdateInfo.h"
namespace Hedgehog::Universe
{
class IParallelJob
{
public:
xpointer<void> m_pVftable;
IParallelJob() {}
IParallelJob(const swa_null_ctor&) {}
// TODO: implement virtual functions.
// virtual ~IParallelJob() = default;
//
// virtual void ExecuteParallelJob(const SUpdateInfo& in_rUpdateInfo) = 0;
};
}

View file

@ -1,47 +0,0 @@
# SWA
## Contribution Guide
### Naming Conventions
- Use `camelCase` for local variables, `SNAKE_CASE` for preprocessor macros, and `PascalCase` for everything else. SWA-specific types that don't exist in the game should use `snake_case` for better differentiation.
- Class names should be prefixed with `C`, e.g., `CSonicContext`.
- Struct names should be prefixed with `S`, e.g., `SUpdateInfo`.
- Class members should be prefixed with `m_`, e.g., `m_Time`. Do not use this prefix for struct members.
- Enum names should be prefixed with `E`, e.g., `ELightType`.
- Enum members should start with `e`, followed by the enum name and an underscore, e.g., `eLightType_Point`.
- For enum members indicating the count of elements, prefix with `n`, followed by the name, e.g., `nLightType`.
- Pointers should be prefixed with `p`, e.g., `pSonicContext`.
- Shared pointers should be prefixed with `sp`, e.g., `spDatabase`.
- References should be prefixed with `r`, e.g., `rMessage`.
- Input function arguments should be prefixed with `in_`, e.g., `in_Name`.
- Output function arguments should be prefixed with `out_`, e.g., `out_Value`.
- Static class members should be prefixed with `ms_`, e.g., `ms_Instance`.
- Static members outside a class should be prefixed with `g_`, e.g., `g_AllocationTracker`.
- SWA-specific preprocessor macros should start with `SWA_`, e.g., `SWA_INSERT_PADDING`.
- Hedgehog namespace-specific preprocessor macros should start with `HH_` along with the library's shorthand, e.g., `HH_FND_MSG_MAKE_TYPE`.
- Function pointers should be prefixed with `fp`, e.g., `fpCGameObjectConstructor`.
Combine prefixes as necessary, e.g., `m_sp` for a shared pointer as a class member or `in_r` for a const reference as a function argument.
### Coding Style
- Always place curly brackets on a new line.
- Prefer forward declaring types over including their respective headers.
- Use <> includes relative to the project's root directory path.
- Use C++17's nested namespace feature instead of defining multiple namespaces on separate lines.
- Enum classes are prohibited as they were not available when the game was developed.
- Avoid placing function definitions in .h files, instead, implement functions in the header's respective .inl file, similar to a .cpp file.
- Ensure that all class members are declared as public. Even if you suspect that a class member was private in the original code, having it public is more convenient in a modding API.
- Avoid placing multiple class definitions in a single header file unless you have a good reason to do so.
- Keep function pointers or addresses outside functions, define them as global variables in the corresponding .inl file. Mark these global variables as `inline` and never nest them within class definitions. You do not need to use the `g_` prefix for function pointers, `fp` is sufficient.
- Use primitive types defined in `cstdint` instead of using types that come with the language, e.g., use `uint32_t` instead of `unsigned int`. Using `float`, `double` and `bool` is okay.
### Mapping Rules
- Always include the corresponding `offsetof`/`sizeof` assertions for mapped classes/structs. If you are uncertain about the type's size, you can omit the `sizeof` assertion.
- Use the exact type name from the game if it's available through RTTI, otherwise, you can look for shared pointers that may reveal the original type name.
- If you are unsure about the name of a class/struct member, use `Field` followed by the hexadecimal byte offset (e.g., `m_Field194`). Avoid names like `m_StoresThisThingMaybe`, you can write comments next to the definition for speculations.
- If a portion of the byte range is irrelevant to your research or not mapped yet, use the `SWA_INSERT_PADDING` macro to align class/struct members correctly.
- When the class has a virtual function table, if you don't want to map every function in it, you can map only the virtual destructor.
- The original file locations are likely available in the executable file as assertion file paths. If you cannot find the file path, use your intuition to place the file in a sensible place.

View file

@ -1,129 +0,0 @@
#pragma once
#include "CSD/Manager/csdmBase.h"
#include "CSD/Manager/csdmMotionPattern.h"
#include "CSD/Manager/csdmNode.h"
#include "CSD/Manager/csdmNodeObserver.h"
#include "CSD/Manager/csdmObserverBase.h"
#include "CSD/Manager/csdmProject.h"
#include "CSD/Manager/csdmRCObject.h"
#include "CSD/Manager/csdmRCObjectImp.h"
#include "CSD/Manager/csdmRCPtr.h"
#include "CSD/Manager/csdmRCPtrAbs.h"
#include "CSD/Manager/csdmResourceBase.h"
#include "CSD/Manager/csdmScene.h"
#include "CSD/Manager/csdmSceneObserver.h"
#include "CSD/Manager/csdmSubjectBase.h"
#include "CSD/Platform/csdTexList.h"
#include "Hedgehog/Base/Container/hhMap.h"
#include "Hedgehog/Base/Container/hhVector.h"
#include "Hedgehog/Base/System/hhAllocator.h"
#include "Hedgehog/Base/System/hhSymbol.h"
#include "Hedgehog/Base/Thread/hhHolder.h"
#include "Hedgehog/Base/Thread/hhHolderBase.h"
#include "Hedgehog/Base/Thread/hhSynchronizedObject.h"
#include "Hedgehog/Base/Thread/hhSynchronizedPtr.h"
#include "Hedgehog/Base/Type/detail/hhStringHolder.h"
#include "Hedgehog/Base/Type/hhSharedString.h"
#include "Hedgehog/Base/hhObject.h"
#include "Hedgehog/Database/System/hhDatabaseData.h"
#include "Hedgehog/Math/Matrix.h"
#include "Hedgehog/Math/Quaternion.h"
#include "Hedgehog/Math/Vector.h"
#include "Hedgehog/MirageCore/MatrixNode/hhMatrixNode.h"
#include "Hedgehog/MirageCore/Misc/hhTransform.h"
#include "Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h"
#include "Hedgehog/MirageCore/RenderData/hhMaterialData.h"
#include "Hedgehog/MirageCore/RenderData/hhMeshData.h"
#include "Hedgehog/MirageCore/RenderData/hhMeshIndexData.h"
#include "Hedgehog/MirageCore/RenderData/hhModelData.h"
#include "Hedgehog/MirageCore/RenderData/hhMorphModelData.h"
#include "Hedgehog/MirageCore/RenderData/hhNodeGroupModelData.h"
#include "Hedgehog/MirageCore/RenderData/hhPixelShaderCodeData.h"
#include "Hedgehog/MirageCore/RenderData/hhPixelShaderData.h"
#include "Hedgehog/MirageCore/RenderData/hhShaderListData.h"
#include "Hedgehog/MirageCore/RenderData/hhTerrainModelData.h"
#include "Hedgehog/MirageCore/RenderData/hhTexsetData.h"
#include "Hedgehog/MirageCore/RenderData/hhTextureData.h"
#include "Hedgehog/MirageCore/RenderData/hhVertexShaderCodeData.h"
#include "Hedgehog/MirageCore/RenderData/hhVertexShaderData.h"
#include "Hedgehog/MirageCore/Renderable/hhRenderable.h"
#include "Hedgehog/Sparkle/hhParticleMaterial.h"
#include "Hedgehog/Universe/Engine/hhMessageActor.h"
#include "Hedgehog/Universe/Engine/hhMessageProcess.h"
#include "Hedgehog/Universe/Engine/hhStateMachineBase.h"
#include "Hedgehog/Universe/Engine/hhStateMachineMessageReceiver.h"
#include "Hedgehog/Universe/Engine/hhUpdateInfo.h"
#include "Hedgehog/Universe/Engine/hhUpdateUnit.h"
#include "Hedgehog/Universe/Thread/hhParallelJob.h"
#include "SWA/Achievement/AchievementID.h"
#include "SWA/Achievement/AchievementManager.h"
#include "SWA/Achievement/AchievementTest.h"
#include "SWA/Boss/EggDragoon/Object/BossEggDragoonDrillMissile.h"
#include "SWA/CSD/CsdDatabaseWrapper.h"
#include "SWA/CSD/CsdProject.h"
#include "SWA/CSD/CsdTexListMirage.h"
#include "SWA/CSD/GameObjectCSD.h"
#include "SWA/Camera/Camera.h"
#include "SWA/Camera/CameraController.h"
#include "SWA/CharacterUtility/CharacterProxy.h"
#include "SWA/ExtraStage/Tails/Enemy/Boss/ExStageBoss.h"
#include "SWA/ExtraStage/Tails/Enemy/Boss/State/StateBase.h"
#include "SWA/ExtraStage/Tails/Enemy/Boss/State/StateBattle.h"
#include "SWA/ExtraStage/Tails/Player/ExPlayerTails.h"
#include "SWA/Globals.h"
#include "SWA/HUD/GeneralWindow/GeneralWindow.h"
#include "SWA/HUD/Loading/Loading.h"
#include "SWA/HUD/Pause/HudPause.h"
#include "SWA/HUD/SaveIcon/SaveIcon.h"
#include "SWA/HUD/Sonic/HudSonicStage.h"
#include "SWA/Inspire/InspireMovieOverlay.h"
#include "SWA/Inspire/InspireMovieOverlayInfo.h"
#include "SWA/Inspire/InspireOpacityAnimationInfo.h"
#include "SWA/Inspire/InspireScene.h"
#include "SWA/Inspire/InspireSceneData.h"
#include "SWA/Inspire/InspireSceneInfo.h"
#include "SWA/Inspire/InspireTextureAnimationInfo.h"
#include "SWA/Inspire/InspireTextureOverlay.h"
#include "SWA/Inspire/InspireTextureOverlayInfo.h"
#include "SWA/Menu/MenuWindowBase.h"
#include "SWA/Message/MsgRequestHelp.h"
#include "SWA/Movie/MovieDisplayer.h"
#include "SWA/Movie/MovieManager.h"
#include "SWA/Object/Common/DashPanel/ObjDashPanel.h"
#include "SWA/Object/SonicStage/EU/RollingBarrel/ObjRollingBarrel.h"
#include "SWA/Player/Character/EvilSonic/EvilSonic.h"
#include "SWA/Player/Character/EvilSonic/EvilSonicContext.h"
#include "SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.h"
#include "SWA/Sequence/Unit/SequenceUnitBase.h"
#include "SWA/Sequence/Unit/SequenceUnitPlayMovie.h"
#include "SWA/Sequence/Utility/SequencePlayMovieWrapper.h"
#include "SWA/Sound/Sound.h"
#include "SWA/Sound/SoundBGMActSonic.h"
#include "SWA/Sound/SoundBGMBase.h"
#include "SWA/System/Application.h"
#include "SWA/System/ApplicationD3D9.h"
#include "SWA/System/ApplicationDocument.h"
#include "SWA/System/ApplicationXenon.h"
#include "SWA/System/Game.h"
#include "SWA/System/GameDocument.h"
#include "SWA/System/GameMode/GameMode.h"
#include "SWA/System/GameMode/GameModeStage.h"
#include "SWA/System/GameMode/GameModeStageMovie.h"
#include "SWA/System/GameMode/GameModeStageTitle.h"
#include "SWA/System/GameMode/Title/TitleMenu.h"
#include "SWA/System/GameMode/Title/TitleStateBase.h"
#include "SWA/System/GameMode/Title/TitleStateIntro.h"
#include "SWA/System/GameMode/Title/TitleStateMenu.h"
#include "SWA/System/GameMode/Title/TitleStateWorldMap.h"
#include "SWA/System/GameMode/WorldMap/WorldMapCamera.h"
#include "SWA/System/GameMode/WorldMap/WorldMapCursor.h"
#include "SWA/System/GameObject.h"
#include "SWA/System/GameParameter.h"
#include "SWA/System/GammaController.h"
#include "SWA/System/InputState.h"
#include "SWA/System/MatrixNodeTransform.h"
#include "SWA/System/PadState.h"
#include "SWA/System/World.h"
#include "boost/smart_ptr/make_shared_object.h"
#include "boost/smart_ptr/shared_ptr.h"

View file

@ -1,21 +0,0 @@
#pragma once
#include <cpu/guest_stack_var.h>
#include <kernel/function.h>
#define SWA_CONCAT2(x, y) x##y
#define SWA_CONCAT(x, y) SWA_CONCAT2(x, y)
#define SWA_INSERT_PADDING(length) \
uint8_t SWA_CONCAT(pad, __LINE__)[length]
#define SWA_ASSERT_OFFSETOF(type, field, offset) \
static_assert(offsetof(type, field) == offset)
#define SWA_ASSERT_SIZEOF(type, size) \
static_assert(sizeof(type) == size)
#define SWA_VIRTUAL_FUNCTION(returnType, virtualIndex, ...) \
GuestToHostFunction<returnType>(*(be<uint32_t>*)(g_memory.Translate(*(be<uint32_t>*)(this) + (4 * virtualIndex))), __VA_ARGS__)
struct swa_null_ctor {};

View file

@ -1,55 +0,0 @@
#pragma once
enum EAchievementID : uint32_t
{
eAchievementID_StillBroken = 24,
eAchievementID_LookingBetter,
eAchievementID_StillAJigsawPuzzle,
eAchievementID_PickingUpThePieces,
eAchievementID_AlmostThere,
eAchievementID_OneMoreToGo,
eAchievementID_WorldSavior = 31,
eAchievementID_PartlyCloudy,
eAchievementID_Sunny,
eAchievementID_HalfMoon,
eAchievementID_FullMoon,
eAchievementID_BlueStreak,
eAchievementID_PowerOverwhelming,
eAchievementID_GettingTheHangOfThings,
eAchievementID_CreatureOfTheNight,
eAchievementID_HelpingHand,
eAchievementID_LayTheSmackdown,
eAchievementID_WallCrawler,
eAchievementID_Airdevil,
eAchievementID_Hyperdrive,
eAchievementID_Basher,
eAchievementID_Smasher,
eAchievementID_Crasher,
eAchievementID_Thrasher,
eAchievementID_SocialButterfly,
eAchievementID_HungryHungryHedgehog,
eAchievementID_AcePilot,
eAchievementID_DayTripper,
eAchievementID_HardDaysNight,
eAchievementID_GetOnTheExorciseBandwagon,
eAchievementID_GyroWithRelish = 64,
eAchievementID_PigInABlanket,
eAchievementID_ExoticToppings,
eAchievementID_SausageFriedRice,
eAchievementID_IcedHotdog,
eAchievementID_KebabOnABun,
eAchievementID_KetchupAndMustard,
eAchievementID_HardBoiled,
eAchievementID_FriedClamRoll,
eAchievementID_FirstTimeCustomer,
eAchievementID_OhYouShouldntHave,
eAchievementID_ThatsEnoughSeriously,
eAchievementID_Hedgehunk,
eAchievementID_IAintAfraidOfNoGhost,
eAchievementID_BFFs,
eAchievementID_SpeedingTicket,
eAchievementID_ComboKing,
eAchievementID_RingLeader,
eAchievementID_KnockoutBrawler,
eAchievementID_BlueMeteor
};

View file

@ -1,23 +0,0 @@
#pragma once
#include <SWA.inl>
#include <SWA/Achievement/AchievementID.h>
namespace SWA::Achievement
{
class CManager : public Hedgehog::Universe::CUpdateUnit
{
public:
class CMember
{
public:
SWA_INSERT_PADDING(0x08);
be<EAchievementID> m_AchievementID;
};
SWA_INSERT_PADDING(0x98);
xpointer<CMember> m_pMember;
be<uint32_t> m_IsUnlocked;
SWA_INSERT_PADDING(0x10);
};
}

View file

@ -1,16 +0,0 @@
#pragma once
#include <SWA.inl>
#include <SWA/Achievement/AchievementID.h>
namespace SWA
{
class CAchievementTest
{
public:
SWA_INSERT_PADDING(0x38);
be<uint32_t> m_Unk1;
be<EAchievementID> m_AchievementID;
uint8_t m_Unk2;
};
}

View file

@ -1,16 +0,0 @@
#pragma once
#include <SWA.inl>
#include "SWA/System/MatrixNodeTransform.h"
namespace SWA::Boss::EggDragoon::DrillMissile
{
class CMissile
{
public:
SWA_INSERT_PADDING(0xC4);
xpointer<CMatrixNodeTransform> m_pMatrixNodeTransform;
SWA_INSERT_PADDING(0x68);
be<float> m_Speed;
};
}

View file

@ -1,25 +0,0 @@
#pragma once
#include "boost/smart_ptr/shared_ptr.h"
namespace Hedgehog::Database
{
class CDatabase;
}
namespace SWA
{
class CCsdProject;
class CCsdDatabaseWrapper
{
public:
Hedgehog::Database::CDatabase* m_pDatabase;
CCsdDatabaseWrapper(Hedgehog::Database::CDatabase* in_pDatabase) : m_pDatabase(in_pDatabase) {}
boost::shared_ptr<CCsdProject> GetCsdProject(const Hedgehog::Base::CSharedString& in_rName);
};
}
#include "SWA/CSD/CsdDatabaseWrapper.inl"

View file

@ -1,9 +0,0 @@
namespace SWA
{
inline boost::shared_ptr<CCsdProject> CCsdDatabaseWrapper::GetCsdProject(const Hedgehog::Base::CSharedString& in_rName)
{
boost::shared_ptr<CCsdProject> spCsdProject;
GuestToHostFunction<void>(sub_825E2B40, &in_rName, this, &spCsdProject, 0);
return spCsdProject;
}
}

View file

@ -1,18 +0,0 @@
#pragma once
#include "CSD/Manager/csdmRCPtr.h"
#include "Hedgehog/Database/System/hhDatabaseData.h"
namespace Chao::CSD
{
class CProject;
}
namespace SWA
{
class CCsdProject : public Hedgehog::Database::CDatabaseData
{
public:
Chao::CSD::RCPtr<Chao::CSD::CProject> m_rcProject;
};
}

View file

@ -1,18 +0,0 @@
#pragma once
#include "CSD/Platform/csdTexList.h"
namespace Hedgehog::Mirage
{
class CTexsetData;
}
namespace SWA
{
class CCsdTexListMirage : public Chao::CSD::CTexList
{
public:
boost::shared_ptr<Hedgehog::Mirage::CTexsetData> m_spTexsetData;
SWA_INSERT_PADDING(0x04);
};
}

View file

@ -1,20 +0,0 @@
#pragma once
#include "SWA.inl"
#include "CSD/Manager/csdmRCPtr.h"
#include "SWA/System/GameObject.h"
namespace Chao::CSD
{
class CProject;
}
namespace SWA
{
class CGameObjectCSD : public CGameObject
{
public:
xpointer<void> m_pVftable;
Chao::CSD::RCPtr<Chao::CSD::CProject> m_rcProject;
};
}

View file

@ -1,24 +0,0 @@
#pragma once
#include <SWA.inl>
#include <SWA/System/GameObject.h>
namespace SWA
{
class CCamera : public CGameObject // , public Hedgehog::Universe::TStateMachine<CCamera>
{
public:
xpointer<void> m_pVftable;
SWA_INSERT_PADDING(0xC4);
be<float> m_VertAspectRatio;
SWA_INSERT_PADDING(0x48);
be<float> m_HorzAspectRatio;
SWA_INSERT_PADDING(0x178);
be<float> m_FieldOfView;
be<float> m_VertFieldOfView;
be<float> m_HorzFieldOfView;
SWA_INSERT_PADDING(0x18);
bool m_InvertY;
bool m_InvertX;
};
}

View file

@ -1,17 +0,0 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CCameraController : public Hedgehog::Universe::CStateMachineBase::CStateBase
{
public:
SWA_INSERT_PADDING(0x04);
be<float> m_FieldOfView;
SWA_INSERT_PADDING(0x68);
};
SWA_ASSERT_OFFSETOF(CCameraController, m_FieldOfView, 0x64);
SWA_ASSERT_SIZEOF(CCameraController, 0xD0);
}

View file

@ -1,14 +0,0 @@
#pragma once
#include <Hedgehog/Math/Vector.h>
namespace SWA
{
class CCharacterProxy
{
public:
SWA_INSERT_PADDING(0x120);
Hedgehog::Math::CVector m_Position;
Hedgehog::Math::CVector m_Velocity;
};
}

View file

@ -1,36 +0,0 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CExStageBoss
{
public:
class CStateBase;
class CStateBattle;
class CExStageBossStateContext
{
public:
SWA_INSERT_PADDING(0x14C);
be<float> m_SplineProgress;
SWA_INSERT_PADDING(0x0C);
be<float> m_SplineSpeed;
SWA_INSERT_PADDING(0x28);
be<float> m_Field188;
be<float> m_Field18C;
SWA_INSERT_PADDING(0x21);
bool m_IsBattleStart;
SWA_INSERT_PADDING(0x36E);
be<float> m_Field520;
};
};
SWA_ASSERT_OFFSETOF(CExStageBoss::CExStageBossStateContext, m_SplineProgress, 0x14C);
SWA_ASSERT_OFFSETOF(CExStageBoss::CExStageBossStateContext, m_SplineSpeed, 0x15C);
SWA_ASSERT_OFFSETOF(CExStageBoss::CExStageBossStateContext, m_Field188, 0x188);
SWA_ASSERT_OFFSETOF(CExStageBoss::CExStageBossStateContext, m_Field18C, 0x18C);
SWA_ASSERT_OFFSETOF(CExStageBoss::CExStageBossStateContext, m_IsBattleStart, 0x1B1);
SWA_ASSERT_OFFSETOF(CExStageBoss::CExStageBossStateContext, m_Field520, 0x520);
}

View file

@ -1,9 +0,0 @@
#pragma once
#include <SWA.inl>
#include "SWA/ExtraStage/Tails/Enemy/Boss/ExStageBoss.h"
namespace SWA
{
class CExStageBoss::CStateBase : public Hedgehog::Universe::CStateMachineBase::CStateBase {};
}

View file

@ -1,18 +0,0 @@
#pragma once
#include <SWA.inl>
#include "SWA/ExtraStage/Tails/Enemy/Boss/ExStageBoss.h"
namespace SWA
{
class CExStageBoss::CStateBattle : public CExStageBoss::CStateBase
{
public:
SWA_INSERT_PADDING(0x08);
be<float> m_Field68;
be<float> m_FramesSinceLastMissile;
};
SWA_ASSERT_OFFSETOF(CExStageBoss::CStateBattle, m_Field68, 0x68);
SWA_ASSERT_OFFSETOF(CExStageBoss::CStateBattle, m_FramesSinceLastMissile, 0x6C);
}

View file

@ -1,35 +0,0 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CExPlayerTails
{
public:
class CExPlayerTailsStateContext
{
public:
SWA_INSERT_PADDING(0x1F8);
be<float> m_SplineBossStart;
be<float> m_SplineEnd;
SWA_INSERT_PADDING(0x30);
be<float> m_SplineProgress;
SWA_INSERT_PADDING(0x10);
xpointer<void> m_Field244;
SWA_INSERT_PADDING(0x18);
be<float> m_SplineSpeed;
SWA_INSERT_PADDING(0x0C);
be<uint32_t> m_State; // 0 - Intro; 1 - Boss Intro; 3 - Boss
};
class CStateBase : public Hedgehog::Universe::CStateMachineBase::CStateBase {};
};
SWA_ASSERT_OFFSETOF(CExPlayerTails::CExPlayerTailsStateContext, m_SplineBossStart, 0x1F8);
SWA_ASSERT_OFFSETOF(CExPlayerTails::CExPlayerTailsStateContext, m_SplineEnd, 0x1FC);
SWA_ASSERT_OFFSETOF(CExPlayerTails::CExPlayerTailsStateContext, m_SplineProgress, 0x230);
SWA_ASSERT_OFFSETOF(CExPlayerTails::CExPlayerTailsStateContext, m_Field244, 0x244);
SWA_ASSERT_OFFSETOF(CExPlayerTails::CExPlayerTailsStateContext, m_SplineSpeed, 0x260);
SWA_ASSERT_OFFSETOF(CExPlayerTails::CExPlayerTailsStateContext, m_State, 0x270);
}

Some files were not shown because too many files have changed in this diff Show more