Compare commits
164 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cf7c4674d6 | |||
| 4de23561b0 | |||
| fa9b4d7f61 | |||
| 2ee6119c93 | |||
| 02839d8a77 | |||
| 2af926b461 | |||
| 23d4b7d905 | |||
| ef40007720 | |||
| 05dcc0edfc | |||
| 28f896faae | |||
| d7bdbf19d1 | |||
| cf0588afc8 | |||
| 0a4527340d | |||
| e35c0c82a5 | |||
| b0b51b425a | |||
| 98bd54b98f | |||
| 30cf74ee87 | |||
| 522c1848e1 | |||
| d7978aa99e | |||
| 61e696d87c | |||
| b17dd5b196 | |||
| 40c0953ebc | |||
| 82aaf4cd34 | |||
| f048a4f5fb | |||
| 2ee4249f89 | |||
| c68181e8c0 | |||
| f2f72b537d | |||
| 3284e5ddc1 | |||
| 1299cc345b | |||
| b7604eb643 | |||
| e3315822de | |||
| 592b013f65 | |||
| 0ec685cbd0 | |||
| 12f5b52680 | |||
| 73815e1520 | |||
| 49c947b352 | |||
| be6d0e58cf | |||
| 58fa32b95b | |||
| e8431225d0 | |||
| 7581c8e175 | |||
| 30b97df4f1 | |||
| ec1337712f | |||
| 3f9cad1ca5 | |||
| a6c4217875 | |||
| de5547ff68 | |||
| da26fb0d14 | |||
| 29e2ad10c3 | |||
| af06741788 | |||
| d64c9621af | |||
| 8b0f62f71e | |||
| 7a34fb0f7a | |||
| f14f7dd93b | |||
| 74604788c9 | |||
| 9fa25d6337 | |||
| 209ccd6726 | |||
| 1edc40724f | |||
| 367c4e77c1 | |||
| 81af488e26 | |||
| a9afab9717 | |||
| 66d7594a36 | |||
| 2bd43391a6 | |||
| 974269187b | |||
| 3551b9abc3 | |||
| bbef5e329f | |||
| 7cb0ef9f3e | |||
| 0429638cf0 | |||
| a85e161020 | |||
| d34f47405c | |||
| 179e688cf6 | |||
| c4827bafdb | |||
| d2133aae3d | |||
| 196f2de616 | |||
| d9cdf9804f | |||
| bc017578e3 | |||
| aa27c579f6 | |||
| 6a6943e0df | |||
| 2dc2f85b1a | |||
| 6ef5b59724 | |||
| 2f32e8ab7d | |||
| 60c1aa71dc | |||
| a315f6d011 | |||
| a42594afd3 | |||
| 04445dabd0 | |||
| 16cddd28b2 | |||
| b53bde9046 | |||
| afd63ca1dd | |||
| 8ae7696b51 | |||
| 81d03738da | |||
| beb87b546f | |||
| 12572ed2d4 | |||
| bb3d4ac847 | |||
| 0ded423c84 | |||
| 414ef0d825 | |||
| b54b32b461 | |||
| 67e2428daa | |||
| 8654555777 | |||
| 83166f1eff | |||
| fbf170ef12 | |||
| b7bc148e09 | |||
| 009a0fc93d | |||
| 5a98b48521 | |||
| bf17ec0943 | |||
| e901f5e681 | |||
| 6136f8dfb3 | |||
| 0c18656e03 | |||
| 317c9fd616 | |||
| 6d16f8095a | |||
| 072ebe81bf | |||
| 7db761f181 | |||
| 7211205e55 | |||
| 85d0bac5cb | |||
| 713327b0ae | |||
| 0ce5210c22 | |||
| 4ccbb2f683 | |||
| 3075370975 | |||
| 9dfdbc624b | |||
| 027956876d | |||
| cd1cc43cb3 | |||
| 77798e09be | |||
| da0ffea7e0 | |||
| 330dbecada | |||
| 2360beb77b | |||
| 33bbb15bf0 | |||
| c25569c688 | |||
| 01b83044dc | |||
| e05dcb6e70 | |||
| 501a048af0 | |||
| f605a21c1a | |||
| 8e1edbc34e | |||
| 83549fe8e4 | |||
| fbda7a2a48 | |||
| b8d4ab589e | |||
| e49e159eee | |||
| 0442f6e579 | |||
| 3160d86eaa | |||
| 4cd82caa5f | |||
| d943364c29 | |||
| cddd8007c7 | |||
| 039786b2f8 | |||
| 5de53391db | |||
| 5f8e0bd6bd | |||
| 3e83669138 | |||
| 5593dc0ecd | |||
| 956e890ad6 | |||
| c833b575e4 | |||
| 4b3be7eee3 | |||
| f7b6f602cd | |||
| 695f14e3fb | |||
| 77906b7a57 | |||
| 14fc0996bd | |||
| 3743d0a156 | |||
| 3d2d96eb7e | |||
| ba8917e50d | |||
| b09269eabc | |||
| d1ce010d06 | |||
| 1e3ca4111a | |||
| 6a052722c9 | |||
| acb9c656c5 | |||
| f5ebf6fdcd | |||
| 9ea84d7101 | |||
| 556360c993 | |||
| 4008d7f4ff | |||
| e47b72dd72 | |||
| 613d0c6d36 |
+32
-32
@@ -2,9 +2,9 @@ name: CMake
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
branches: [master]
|
||||
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
@@ -16,42 +16,42 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
with_resource_file: ['true', 'false']
|
||||
with_resource_file: ["true", "false"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install libraries (Linux)
|
||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||
run: sudo apt-get install -y libevent-dev
|
||||
- name: Install libraries (Linux)
|
||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||
run: sudo apt-get install -y libevent-dev
|
||||
|
||||
- name: Install libraries (macOS)
|
||||
if: ${{ matrix.os == 'macos-latest' }}
|
||||
run: brew install libevent
|
||||
- name: Install libraries (macOS)
|
||||
if: ${{ matrix.os == 'macos-latest' }}
|
||||
run: brew install libevent
|
||||
|
||||
- name: Install phosg
|
||||
run: |
|
||||
git clone https://github.com/fuzziqersoftware/phosg.git
|
||||
cd phosg
|
||||
cmake .
|
||||
make
|
||||
sudo make install
|
||||
- name: Install phosg
|
||||
run: |
|
||||
git clone https://github.com/fuzziqersoftware/phosg.git
|
||||
cd phosg
|
||||
cmake .
|
||||
make
|
||||
sudo make install
|
||||
|
||||
- name: Install resource_file
|
||||
if: ${{ matrix.with_resource_file == 'true' }}
|
||||
run: |
|
||||
git clone https://github.com/fuzziqersoftware/resource_dasm.git
|
||||
cd resource_dasm
|
||||
cmake .
|
||||
make
|
||||
sudo make install
|
||||
- name: Install resource_file
|
||||
if: ${{ matrix.with_resource_file == 'true' }}
|
||||
run: |
|
||||
git clone https://github.com/fuzziqersoftware/resource_dasm.git
|
||||
cd resource_dasm
|
||||
cmake .
|
||||
make
|
||||
sudo make install
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
- name: Configure CMake
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
|
||||
|
||||
@@ -9,6 +9,7 @@ cmake_install.cmake
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CTestTestFile.cmake
|
||||
CTestTestfile.cmake
|
||||
install_manifest.txt
|
||||
Makefile
|
||||
Testing
|
||||
@@ -24,6 +25,7 @@ system/players/*.psosys
|
||||
system/players/*.psocard
|
||||
system/players/*.nsc
|
||||
system/players/*.nsa
|
||||
system/teams/*.json
|
||||
system/patch-pc/.metadata-cache.json
|
||||
system/patch-bb/.metadata-cache.json
|
||||
|
||||
|
||||
+3
-1
@@ -47,6 +47,7 @@ set(SOURCES
|
||||
src/CatSession.cc
|
||||
src/Channel.cc
|
||||
src/ChatCommands.cc
|
||||
src/ChoiceSearch.cc
|
||||
src/Client.cc
|
||||
src/CommonItemSet.cc
|
||||
src/Compression.cc
|
||||
@@ -85,7 +86,7 @@ set(SOURCES
|
||||
src/Menu.cc
|
||||
src/NetworkAddresses.cc
|
||||
src/PatchFileIndex.cc
|
||||
src/Player.cc
|
||||
src/PlayerFilesManager.cc
|
||||
src/PlayerSubordinates.cc
|
||||
src/ProxyCommands.cc
|
||||
src/ProxyServer.cc
|
||||
@@ -93,6 +94,7 @@ set(SOURCES
|
||||
src/PSOGCObjectGraph.cc
|
||||
src/PSOProtocol.cc
|
||||
src/Quest.cc
|
||||
src/QuestAvailabilityExpression.cc
|
||||
src/QuestScript.cc
|
||||
src/RareItemSet.cc
|
||||
src/ReceiveCommands.cc
|
||||
|
||||
@@ -4,13 +4,17 @@ newserv is a game server, proxy, and reverse-engineering tool for Phantasy Star
|
||||
|
||||
This project includes code that was reverse-engineered by the community in ages long past, and has been included in many projects since then. It also includes some game data from Phantasy Star Online itself, which was originally created by Sega.
|
||||
|
||||
* Background
|
||||
* [History](#history)
|
||||
* [Future (and to-do list)](#future)
|
||||
Feel free to submit GitHub issues if you find bugs or have feature requests. I'd like to make the server as stable and complete as possible, but I can't promise that I'll respond to issues in a timely manner, because this is a personal project undertaken primarily for the fun of reverse-engineering. If you want to contribute to newserv yourself, pull requests are welcome as well.
|
||||
|
||||
See TODO.md for a list of known issues and future work I've curated, or go to the GitHub issue tracker for issues and requests submitted by the community.
|
||||
|
||||
**Table of contents**
|
||||
* [Compatibility](#compatibility)
|
||||
* Setup
|
||||
* [Configuration](#configuration)
|
||||
* [Installing quests](#installing-quests)
|
||||
* [Item tables and drop modes](#item-tables-and-drop-modes)
|
||||
* [Cross-version play](#cross-version-play)
|
||||
* [Episode 3 features](#episode-3-features)
|
||||
* [Client patch directories for PC and BB](#client-patch-directories)
|
||||
* [Memory patches and DOL files for GC](#memory-patches-and-dol-files)
|
||||
@@ -23,61 +27,37 @@ This project includes code that was reverse-engineered by the community in ages
|
||||
* [PSO PC](#pso-pc)
|
||||
* [PSO GC on a real GameCube](#pso-gc-on-a-real-gamecube)
|
||||
* [PSO GC on Dolphin](#pso-gc-on-dolphin)
|
||||
* [PSO BB](#pso-bb)
|
||||
* [Connecting external clients](#connecting-external-clients)
|
||||
* [Non-server features](#non-server-features)
|
||||
|
||||
## History
|
||||
|
||||
The history of this project essentially mirrors my development as a software engineer from the beginning of my hobby until now. If you don't care about the story, skip to the "Compatibility" or "Setup" sections below.
|
||||
|
||||
I originally purchased PSO GC when I heard about PSUL, and wanted to play around with running homebrew on my GameCube. This pathway eventually led to [GCARS-CS](https://github.com/fuzziqersoftware/gcars-cs), but that's another story.
|
||||
|
||||
<img align="left" src="s-khyps.png" /> After playing PSO for a while, both offline and online, I wrote a proxy called Khyps sometime in 2003. This was back in the days of the official Sega servers, where vulnerabilities weren't addressed in a timely manner or at all. It was common for malicious players using their own proxies or Action Replay codes (a story for another time) to send invalid commands that the servers would blindly forward, and cause the receiving clients to crash. These crashes were more than simply inconvenient; they could also corrupt your save data, destroying the hours of work you may have put into hunting items and leveling up your character.
|
||||
|
||||
For a while it was essentially necessary to use a proxy to go online at all, so the proxy could block these invalid commands. Khyps was designed primarily with this function in mind, though it also implemented some convenient cheats, like the ability to give yourself or other players infinite HP and allow you to teleport to different places without using an in-game teleporter.
|
||||
|
||||
<img align="left" src="s-khyller.png" /> After Khyps I took on the larger challenge of writing a server, which resulted in Khyller sometime in 2005. This was the first server of any type I had ever written. This project eventually evolved into a full-featured environment supporting all versions of the game that I had access to - at the time, PC, GC, and BB. (However, I suspect from reading the ancient source files that Khyller's BB support was very buggy.) As Khyller evolved, the code became increasingly cumbersome, littered with debugging filth that I never cleaned up and odd coding patterns I had picked up over the years. My understanding of the C++ language was woefully incomplete as well (as opposed to now, when it is still incomplete but not woefully so), which resulted in Khyller being essentially a C project that had a couple of classes in it.
|
||||
|
||||
<img align="left" src="s-aeon.png" /> Sometime in 2006 or 2007, I abandoned Khyller and rebuilt the entire thing from scratch, resulting in Aeon. Aeon was substantially cleaner in code than Khyller but still fairly hard to work with, and it lacked a few of the more arcane features I had originally written (for example, the ability to convert any quest into a download quest). In addition, the code still had some stability problems... it turns out that Aeon's concurrency primitives were simply incorrect. I had derived the concept of a mutex myself, before taking any real computer engineering classes, but had implemented it incorrectly. I made the race window as small as possible, but Aeon would still randomly crash after running seemingly fine for a few days.
|
||||
|
||||
At the time of its inception, Aeon was also called newserv, and you may find some beta releases floating around the Internet with filenames like `newserv-b3.zip`. I had released betas 1, 2, and 3 before I released the entire source of beta 5 and stopped working on the project when I went to college. This was around the time when I switched from writing software primarily on Windows to primarily on macOS and Linux, so Aeon beta 5 was the last server I wrote that specifically targeted Windows. (newserv, which you're looking at now, is a bit tedious to compile on Windows but does work.)
|
||||
|
||||
<img align="left" src="s-newserv.png" /> After a long hiatus from PSO and much professional and personal development in my technical abilities, I was reminiscing sometime in October 2018 by reading my old code archives. Somehow inspired when I came across Aeon, I spent a weekend and a couple more evenings rewriting the entire project again, cleaning up ancient patterns I had used eleven years ago, replacing entire modules with simple STL containers, and eliminating even more support files in favor of configuration autodetection. The code is now suitably modern and stable, and I'm not embarrassed by its existence, as I am by Aeon beta 5's source code and my archive of Khyller (which, thankfully, no one else ever saw).
|
||||
|
||||
## Future
|
||||
|
||||
newserv is many things - a server, a proxy, an encryption and decryption tool, a decoder of various PSO-related formats, and more. Primarily, it's a reverse-engineering project in which I try to unravel the secrets of a 20-year-old video game, for honestly no reason. Solving these problems and documenting them in code has been fun, and I'll continue to do it when my time allows.
|
||||
|
||||
With that said, I offer no guarantees on how or when this project will advance. Feel free to submit GitHub issues if you find bugs or have feature requests; I'd like to make the server as stable and complete as possible, but I can't promise that I'll respond to issues in a timely manner. If you feel like contributing to newserv yourself, pull requests are welcome as well.
|
||||
|
||||
See TODO.md for a list of known issues and future work.
|
||||
|
||||
## Compatibility
|
||||
|
||||
newserv supports several versions of PSO. Specifically:
|
||||
| Version | Login | Lobbies | Games | Proxy |
|
||||
|----------------|--------------|--------------|--------------|--------------|
|
||||
| DC Trial | Yes | Yes | Yes | No |
|
||||
| DC 11/2000 | Yes | Yes | Yes | No |
|
||||
| DC 12/2000 | Yes | Yes | Yes | Yes |
|
||||
| DC 01/2001 | Yes | Yes | Yes | Yes |
|
||||
| DC V1 | Yes | Yes | Yes | Yes |
|
||||
| DC 08/2001 | Untested (1) | Untested (1) | Untested (1) | Untested (1) |
|
||||
| DC V2 | Yes | Yes | Yes | Yes |
|
||||
| PC | Yes | Yes | Yes | Yes |
|
||||
| GC Ep1&2 Trial | Untested (1) | Untested (1) | Untested (1) | Untested (1) |
|
||||
| GC Ep1&2 | Yes | Yes | Yes | Yes |
|
||||
| GC Ep1&2 Plus | Yes | Yes | Yes | Yes |
|
||||
| GC Ep3 Trial | Yes | Yes | Partial (3) | Yes |
|
||||
| GC Ep3 | Yes | Yes | Yes | Yes |
|
||||
| Xbox Ep1&2 | Yes | Yes | Yes | Yes |
|
||||
| BB (vanilla) | Yes | Yes | Yes (2) | Yes |
|
||||
| BB (Tethealla) | Yes | Yes | Yes (2) | Yes |
|
||||
newserv supports several versions of PSO, including various development prototypes. Specifically:
|
||||
| Version | Lobbies | Games | Proxy |
|
||||
|----------------|--------------|--------------|--------------|
|
||||
| DC NTE | Yes | Yes | No |
|
||||
| DC 11/2000 | Yes | Yes | No |
|
||||
| DC 12/2000 | Yes | Yes | Yes |
|
||||
| DC 01/2001 | Yes | Yes | Yes |
|
||||
| DC V1 | Yes | Yes | Yes |
|
||||
| DC 08/2001 | Yes | Yes | Yes |
|
||||
| DC V2 | Yes | Yes | Yes |
|
||||
| PC NTE | Yes (3) | Yes | No |
|
||||
| PC | Yes | Yes | Yes |
|
||||
| GC Ep1&2 NTE | Yes | Yes | Yes |
|
||||
| GC Ep1&2 | Yes | Yes | Yes |
|
||||
| GC Ep1&2 Plus | Yes | Yes | Yes |
|
||||
| GC Ep3 NTE | Yes | Partial (1) | Yes |
|
||||
| GC Ep3 | Yes | Yes | Yes |
|
||||
| Xbox Ep1&2 | Yes | Yes | Yes |
|
||||
| BB (vanilla) | Yes | Yes (2) | Yes |
|
||||
| BB (Tethealla) | Yes | Yes (2) | Yes |
|
||||
|
||||
*Notes:*
|
||||
1. *newserv's implementations of these versions are based on disassembly of the client executables and have never been tested.*
|
||||
2. *BB games are mostly playable, but there are still some unimplemented features (for example, some quests that use rare commands may not work). Please submit a GitHub issue if you find something that doesn't work.*
|
||||
3. *Creating a game works and battle setup behaves mostly normally, but starting a battle doesn't work.*
|
||||
1. *Players can create games, edit decks, trade cards, and participate in auctions, but CARD battles don't work on Episode 3 Trial Edition on newserv.*
|
||||
2. *Some BB-specific features are not well-tested (for example, some quests that use rare commands may not work properly). Please submit a GitHub issue if you find something that doesn't work.*
|
||||
3. *This is the only version of PSO that doesn't have any way to identify the player's account - there is no serial number or username. For this reason, AllowUnregisteredUsers must be enabled in config.json to support PC NTE, and PC NTE players receive a random Guild Card number every time they connect. To prevent abuse, PC NTE support can be disabled in config.json.*
|
||||
|
||||
## Setup
|
||||
|
||||
@@ -90,7 +70,7 @@ There is a fairly recent macOS ARM64 release on the newserv GitHub repository. Y
|
||||
There is a fairly recent Windows release on the newserv GitHub repository also. It's built with Cygwin, and all the necessary DLL files should be included. That said, I've only tested it on my own machine and there is no CI for Windows builds like there is for macOS and Linux, so if it doesn't work for you, please open a GitHub issue to let me know.
|
||||
|
||||
If you're not using a release from the GitHub repository, do this to build newserv:
|
||||
1. If you're on Windows, install Cygwin. While doing so, install the `cmake`, `gcc-core`, `gcc-g++`, `git`, `libevent2.1_7`, `make`, `libiconv`, and `zlib` packages. Do the rest of these steps inside a Cygwin shell (not a Windows cmd shell or PowerShell).
|
||||
1. If you're on Windows, install Cygwin. While doing so, install the `cmake`, `gcc-core`, `gcc-g++`, `git`, `libevent2.1_7`, `make`, `libiconv-devel`, and `zlib` packages. Do the rest of these steps inside a Cygwin shell (not a Windows cmd shell or PowerShell).
|
||||
2. Make sure you have CMake, libevent, and libiconv installed. (On macOS, `brew install cmake libevent libiconv`; on most Linuxes, `sudo apt-get install cmake libevent-dev`; on Windows, you already did this in step 1.)
|
||||
3. Build and install phosg (https://github.com/fuzziqersoftware/phosg).
|
||||
4. Optionally, install resource_dasm (https://github.com/fuzziqersoftware/resource_dasm). This will enable newserv to send memory patches and load DOL files on PSO GC clients. PSO GC clients can play PSO normally on newserv without this.
|
||||
@@ -111,13 +91,13 @@ newserv automatically finds quests in the subdirectories of the system/quests/ d
|
||||
|
||||
Within the category directories, quest files should be named like `q###-VERSION-LANGUAGE.EXT` (although the `q` is ignored, and can be any letter). The fields in each filename are:
|
||||
- `###`: quest number (this doesn't really matter; it should just be unique across the PSO version)
|
||||
- `VERSION`: dn = Dreamcast NTE, dp = Dreamcast 11/2000 prototype, d1 = Dreamcast v1, dc = Dreamcast v2, pc = PC, gcn = GameCube Trial Edition, gc = GameCube Episodes 1 & 2, gc3 = Episode 3 (see below), xb = Xbox, bb = Blue Burst
|
||||
- `VERSION`: dn = Dreamcast NTE, dp = Dreamcast 11/2000 prototype, d1 = Dreamcast v1, dc = Dreamcast v2, pcn = PC NTE, pc = PC, gcn = GameCube NTE, gc = GameCube Episodes 1 & 2, gc3 = Episode 3 (see below), xb = Xbox, bb = Blue Burst
|
||||
- `LANGUAGE`: j = Japanese, e = English, g = German, f = French, s = Spanish
|
||||
- `EXT`: file extension (see table below)
|
||||
|
||||
For .dat files, the `LANGUAGE` token may be omitted. If it's present, then that .dat file will only be used for that language of the quest; if omitted, then that .dat file will be used for all languages of the quest.
|
||||
|
||||
Some quests (mostly battle and challenge mode quests) have additional JSON metadata files that describe how the server should handle them. These metadata files are generally named similarly to their .bin and .dat counterparts, except the `VERSION` token may also be omitted if the metadata applies to all versions of the quest on all PSO versions.
|
||||
Some quests (mostly battle and challenge mode quests) have additional JSON metadata files that describe how the server should handle them. This includes flags that can be used to hide the quest unless a preceding quest has been cleared, or to hide the quest unless purchased as a team reward. These metadata files are generally named similarly to their .bin and .dat counterparts, except the `VERSION` token may also be omitted if the metadata applies to all languages of the quest on all PSO versions. See system/quests/battle/b88001.json for documentation on the exact format of the JSON file.
|
||||
|
||||
Some quests may also include a .pvr file, which contains an image used in the quest. These files are named similarly to their .bin and .dat counterparts.
|
||||
|
||||
@@ -133,13 +113,14 @@ There are multiple PSO quest formats out there; newserv supports all of them. It
|
||||
| Compressed Ep3 | .bin or .mnm | Yes (4) | None (1) |
|
||||
| Uncompressed | .bind and .datd | Yes | compress-prs (2) |
|
||||
| Uncompressed Ep3 | .bind or .mnmd | Yes (4) | compress-prs (2) |
|
||||
| Source | .bin.txt and .dat | Yes | None (5) |
|
||||
| VMS (DCv1) | .bin.vms and .dat.vms | Yes | decode-vms |
|
||||
| VMS (DCv2) | .bin.vms and .dat.vms | Decode (3) | decode-vms (3) |
|
||||
| GCI (decrypted) | .bin.gci and .dat.gci | Yes | decode-gci |
|
||||
| GCI (with key) | .bin.gci and .dat.gci | Yes | decode-gci |
|
||||
| GCI (no key) | .bin.gci and .dat.gci | Decode (3) | decode-gci (3) |
|
||||
| GCI (Ep3 NTE) | .bin.gci or .mnm.gci | Decode (3) | decode-gci (3) |
|
||||
| GCI (Ep3) | .bin.gci or .mnm.gci | Yes | decode-gci |
|
||||
| GCI (Ep3 Trial) | .bin.gci or .mnm.gci | Decode (3) | decode-gci (3) |
|
||||
| DLQ | .bin.dlq and .dat.dlq | Yes | decode-dlq |
|
||||
| DLQ (Ep3) | .bin.dlq or .mnm.dlq | Yes | decode-dlq |
|
||||
| QST (online) | .qst | Yes | decode-qst |
|
||||
@@ -150,6 +131,7 @@ There are multiple PSO quest formats out there; newserv supports all of them. It
|
||||
2. *Similar to (1), to compress an uncompressed quest file: `newserv compress-prs FILENAME.bind FILENAME.bin` (and likewise for .datd -> .dat)*
|
||||
3. *Use the decode action to convert these quests to .bin/.dat format before putting them into the server's quests directory. If you know the encryption seed (serial number), pass it in as a hex string with the `--seed=` option. If you don't know the encryption seed, newserv will find it for you, which will likely take a long time.*
|
||||
4. *Episode 3 quests don't go in the system/quests directory. See the Episode 3 section below.*
|
||||
5. *Quest source can be assembled into a .bin or .bind file with `newserv assemble-quest-script FILENAME.txt`. See system/quests/retrieval/q058-gc-e.bin.txt for an annotated example; this is the English GameCube version of Lost HEAT SWORD.*
|
||||
|
||||
Episode 3 download quests consist only of a .bin file - there is no corresponding .dat file. Episode 3 download quest files may be named with the .mnm extension instead of .bin, since the format is the same as the standard map files (in system/ep3/). These files can be encoded in any of the formats described above, except .qst.
|
||||
|
||||
@@ -157,7 +139,32 @@ When newserv indexes the quests during startup, it will warn (but not fail) if a
|
||||
|
||||
Quest contents are cached in memory, but if you've changed the contents of the quests directory, you can re-index the quests without restarting the server by running `reload quests` in the interactive shell. The new quests will be available immediately, but any games with quests already in progress will continue using the old versions of the quests until those quests end.
|
||||
|
||||
All quests, including those originally in GCI or DLQ format, are treated as online quests unless their filenames specify the dl category. newserv allows players to download all quests, even those in non-download categories.
|
||||
### Item tables and drop modes
|
||||
|
||||
newserv supports server-side item generation on all game versions, except for the earliest DC prototypes (NTE and 11/2000). By default, the game behaves as it did on the original servers - on all versions except BB, item drops are controlled by the leader client in each game, and on BB, item drops are controlled by the server.
|
||||
|
||||
There are five different available behaviors for item drops:
|
||||
* `DISABLED` (or `NONE`): No items will drop from boxes or enemies.
|
||||
* `CLIENT`: The game leader generates items, all items are visible to all players, and any player may pick up any item. This is the default mode for all game versions, except this mode cannot be used on BB.
|
||||
* `SERVER_SHARED`: The server generates items, all items are visible to all players, and any player may pick up any item. This is the default mode for BB.
|
||||
* `SERVER_PRIVATE`: The server generates items, but each player may get a different item from any box or enemy. If a player isn't in the same area as an enemy at the time it's defeated, they won't get any item from it. Items dropped by players are visible to everyone.
|
||||
* `SERVER_DUPLICATE`: The server generates items, and each player will get the same item from any box or enemy, but there is one copy of each item for each player (and each player only sees their own copy of the item). If a player isn't in the same area as an enemy at the time it's defeated, they won't get any item from it. Items dropped by players are not duplicated and are visible to everyone.
|
||||
|
||||
In the `SERVER_PRIVATE` and `SERVER_DUPLICATE` modes, there is no incentive to pick up items before another player, since other players cannot pick up the items you see dropped from boxes and enemies. However, if you pick up an item and drop it later, it can then be seen and picked up by any player.
|
||||
|
||||
The drop mode can be changed at any time during a game with the `$dropmode` chat command. If the mode is changed after some items have already been dropped, the existing items retain their visibility (that is, they still can't be picked up by other players since they were dropped before the mode was changed). You can configure which drop modes are used by default, and which modes players are allowed to choose, in config.json. See the comments above the AllowedDropModes and DefaultDropMode keys.
|
||||
|
||||
In the server drop modes, the item tables used to generate common items are in the `system/item-tables/ItemPT-*` files. (The V2 files are used for V1 as well.) The rare item tables are in the `rare-table-*.json` files. Unlike the original formats, it's possible to make each enemy drop multiple different rare items at different rates, though the default tables never do this.
|
||||
|
||||
### Cross-version play
|
||||
|
||||
All versions of PSO can see and interact with each other in the lobby. newserv also allows some versions to play in-game with each other:
|
||||
* DC V1 players can join DC V2 games if the difficulty level isn't set to Ultimate and the creator chose to allow V1 players.
|
||||
* DC V2 players can join DC V1 games.
|
||||
* If AllowDCPCGames is enabled in config.json, PC and DC players can join each other's games. DC V1 players cannot join PC games with the Ultimate difficulty level.
|
||||
* If AllowGCXBGames is enabled in config.json, GC and Xbox players can join each other's games.
|
||||
|
||||
In V1/V2 cross-version play, when any of the server drop modes are used, the server uses the drop table corresponding to the version the game was created with. (For example, if a DC V1 player created the game, rare-table-v1.json will be used, even after V2 players join.)
|
||||
|
||||
### Episode 3 features
|
||||
|
||||
@@ -172,7 +179,7 @@ newserv supports many features unique to Episode 3:
|
||||
|
||||
#### Battle records
|
||||
|
||||
After playing a battle, you can save the record of the battle with the $saverec command. You can then replay the battle later by using the $playrec command in a lobby - this will create a spectator team and play the recording of the battle as if it were happening in realtime. Note that there is a bug in older versions of Dolphin that seems to be frequently triggered when playing battle records, which causes the emulator to crash with the message `QObject::~QObject: Timers cannot be stopped from another thread`. To avoid this, use the latest version of Dolphin.
|
||||
After playing a battle, you can save the record of the battle with the `$saverec` command. You can then replay the battle later by using the `$playrec` command in a lobby - this will create a spectator team and play the recording of the battle as if it were happening in realtime. Note that there is a bug in older versions of Dolphin that seems to be frequently triggered when playing battle records, which causes the emulator to crash with the message `QObject::~QObject: Timers cannot be stopped from another thread`. To avoid this, use the latest version of Dolphin.
|
||||
|
||||
#### Tournaments
|
||||
|
||||
@@ -225,6 +232,8 @@ In addition, these features are only supported for the following game versions:
|
||||
|
||||
You can put memory patches in the system/ppc directory with filenames like PatchName.patch.s and they will appear in the Patches menu for PSO GC clients that support patching. Memory patches are written in PowerPC assembly and are compiled when newserv is started. The PowerPC assembly system's features are documented in the comments in system/ppc/WriteMemory.s - this file is not a memory patch itself, but it describes how memory patches may be written and the restrictions that apply to them.
|
||||
|
||||
newserv comes with a set of patches for Episodes 1&2 based on AR codes originally made by Ralf at GC-Forever. Many of them were originally posted in [this thread](https://www.gc-forever.com/forums/viewtopic.php?f=38&t=2050).
|
||||
|
||||
You can also put DOL files in the system/dol directory, and they will appear in the Programs menu. Selecting a DOL file there will load the file into the GameCube's memory and run it, just like the old homebrew loaders (PSUL and PSOload) did. For this to work, ReadMemoryWord.s, WriteMemory.s, and RunDOL.s must be present in the system/ppc directory. This has been tested on Dolphin but not on a real GameCube, so results may vary.
|
||||
|
||||
Like other kinds of data, functions and DOL files are cached in memory. If you've changed any of these files, you can run `reload functions` or `reload dol-files` in the interactive shell to make the changes take effect without restarting the server.
|
||||
@@ -262,30 +271,32 @@ There are many options available when starting a proxy session. All options are
|
||||
* Episode 3 card definitions (saved as .mnr files)
|
||||
* Episode 3 media updates (saved as .gvm, .bml, or .bin files)
|
||||
|
||||
The remote server will probably try to assign you a Guild Card number that doesn't match the one you have on newserv. On PSO DC, PC and GC, the proxy server rewrites the commands in transit to make it look like the remote server assigned you the same Guild Card number as you have on newserv, but if the remote server has some external integrations (e.g. forum or Discord bots), they will use the Guild Card number that the remote server believes it has assigned to you. The number assigned by the remote server is shown to you when you first connect to the remote server, and you can retrieve it in lobbies or during games with the $li command.
|
||||
The remote server will probably try to assign you a Guild Card number that doesn't match the one you have on newserv. On PSO DC, PC and GC, the proxy server rewrites the commands in transit to make it look like the remote server assigned you the same Guild Card number as you have on newserv, but if the remote server has some external integrations (e.g. forum or Discord bots), they will use the Guild Card number that the remote server believes it has assigned to you. The number assigned by the remote server is shown to you when you first connect to the remote server, and you can retrieve it in lobbies or during games with the `$li` command.
|
||||
|
||||
Some chat commands (see below) have the same basic function on the proxy server but have different effects or conditions. In addition, there are some server shell commands that affect clients on the proxy (run `help` in the shell to see what they are). If there's only one proxy session open, the shell's proxy commands will affect that session. Otherwise, you'll have to specify which session to affect with the `on` prefix - to send a chat message in LinkedSession:17205AE4, for example, you would run `on 17205AE4 chat ...`.
|
||||
|
||||
### Chat commands
|
||||
|
||||
newserv supports a variety of commands players can use by chatting in-game. Any chat message that begins with `$` is treated as a chat command. (If you actually want to send a chat message starting with `$`, type `$$` instead.)
|
||||
newserv supports a variety of commands players can use by chatting in-game. Any chat message that begins with `$` is treated as a chat command. (If you actually want to send a chat message starting with `$`, type `$$` instead.) On the DC 11/2000 prototype, `@` is used instead of `$` for all chat commands, since `$` does not appear on the English virtual keyboard.
|
||||
|
||||
Some commands only work on the game server and not on the proxy server. The chat commands are:
|
||||
|
||||
* Information commands
|
||||
* `$li`: Shows basic information about the lobby or game you're in. If you're on the proxy server, shows information about your connection instead (remote Guild Card number, client ID, etc.).
|
||||
* `$ping` (game server only): Shows round-trip ping time from the server to you.
|
||||
* `$what` (game server only): Shows the type, name, and stats of the nearest item on the ground.
|
||||
* `$ping`: Shows round-trip ping time from the server to you. On the proxy server, shows the ping time from you to the proxy and from the proxy to the server.
|
||||
* `$matcount` (game server only): Shows how many of each type of material you've used.
|
||||
* `$what` (game server only): Shows the type, name, and stats of the nearest item on the ground.
|
||||
* `$where` (game server only): Shows your current floor number and coordinates. Mainly useful for debugging.
|
||||
|
||||
* Debugging commands
|
||||
* `$debug` (game server only): Enable or disable debug. You need the DEBUG permission in your user license to use this command. When debug is enabled, you'll see in-game messages from the server when you take certain actions. You'll also be placed into the highest available slot in lobbies and games instead of the lowest, which is useful for finding commands for which newserv doesn't handle client IDs properly. This setting also disables certain safeguards and allows you to do some things that might crash your client.
|
||||
* `$quest <number>`: Load a quest by quest number. Can be used to load battle or challenge quests with only one player present.
|
||||
* `$qcall <function-id>`: Call a quest function on your client.
|
||||
* `$qcheck <flag-num>`: Show the value of a quest flag.
|
||||
* `$qset <flag-num>` or `$qclear <flag-num>`: Set or clear a global quest flag for everyone in the game.
|
||||
* `$qsync <reg-num> <value>`: Set a quest register's value on your client. `<reg-num>` should be either rXX (e.g. r60) or fXX (e.g. f60); if the latter, `<value>` is parsed as a floating-point value instead of as an integer.
|
||||
* `$gc` (game server only): Send your own Guild Card to yourself.
|
||||
* `$persist` (game server only): Enable or disable persistence for the current lobby or game. This determines whether the lobby/game is deleted when the last player leaves. You need the DEBUG permission in your user license to use this command because there are no game state checks when you do this. For example, if you make a game persistent, start a quest, then leave the game, the game can't be joined by anyone but also can't be deleted.
|
||||
* `$persist` (game server only): Enable or disable persistence for the current game. When persistence is on, the game will not be deleted when the last player leaves. The state of enemies and objects on the map will be reset when the last player leaves.
|
||||
* `$sc <data>`: Send a command to yourself.
|
||||
* `$ss <data>` (proxy server only): Send a command to the remote server.
|
||||
|
||||
@@ -297,17 +308,21 @@ Some commands only work on the game server and not on the proxy server. The chat
|
||||
* `$exit`: If you're in a lobby, sends you to the main menu (which ends your proxy session, if you're in one). If you're in a game or spectator team, sends you to the lobby (but does not end your proxy session if you're in one). Does nothing if you're in a non-Episode 3 game and no quest is in progress.
|
||||
* `$patch <name>`: Run a patch on your client. `<name>` must exactly match the name of a patch on the server.
|
||||
|
||||
* Character data commands
|
||||
* `$savechar <slot>`: Saves your current character data on the server in the specified slot (each serial number has 4 slots, numbered 1-4). These slots are separate from BB character slots; using this command does not affect BB characters.
|
||||
* `$loadchar <slot>` (v1 and v2 only): Loads your character data from the specified slot. The changes will be undone if you join a game - to save your changes, disconnect from the lobby.
|
||||
* `$bbchar <username> <password> <slot>`: Use this command when playing on a non-BB version of PSO. If the username and password are correct, this command converts your current character to BB format and saves it on the server in the given slot (1-4). Any character already in that slot is overwritten. (This command is similar to `$savechar`, except it overwrites a BB character slot, and can transfer characters across accounts.) Note that the character's chat data, quick menu config, and bank contents are not copied, since there is no way for the server to request those types of data.
|
||||
* `$edit <stat> <value>`: Modifies your character data. If you are on V3 (GameCube/Xbox), or if the server does not allow cheat mode anywhere (that is, "CheatModeBehavior" is "Off" in config.json), this command does nothing. If you are on V1 or V2 (DC or PC, not BB), your changes will be undone if you join a game - to save your changes, disconnect from the lobby.
|
||||
|
||||
* Blue Burst player commands (game server only)
|
||||
* `$bbchar <username> <password> <1-4>`: Use this command when playing on a non-BB version of PSO. If the username and password are correct, this command converts your current character to BB format and saves it on the server in the given slot. Any character already in that slot is overwritten.
|
||||
* `$edit <stat> <value>`: Modifies your character data. If the server does not allow cheat mode anywhere (that is, "CheatModeBehavior" is "Off" in config.json), this command does nothing.
|
||||
* `$bank [number]`: Switches your current bank, so you can access your other character's banks (if `number` is 1-4) or your shared account bank (if `number` is 0). If `number` is not given, switches back to your current character's bank.
|
||||
* `$save`: Saves your character, system, and Guild Card data immediately. (By default, your character is saved every 60 seconds while online, and your account and Guild Card data are saved whenever they change.)
|
||||
|
||||
* Game state commands (game server only)
|
||||
* `$maxlevel <level>`: Sets the maximum level for players to join the current game. (This only applies when joining; if a player joins and then levels up past this level during the game, they are not kicked out, but won't be able to rejoin if they leave.)
|
||||
* `$minlevel <level>`: Sets the minimum level for players to join the current game.
|
||||
* `$password <password>`: Sets the game's join password. To unlock the game, run `$password` with nothing after it.
|
||||
* `$itemtable`: Switches between using the client's or the server's drop table. No effect on BB (the server's drop table is always used). The server's rare tables are defined in JSON files in the system/item-tables directory.
|
||||
* `$drop`: Enables or disables all item drops from boxes and enemies in the current game.
|
||||
* `$dropmode [mode]`: Changes the way item drops behave in the current game. `mode` can be `none`, `client`, `shared`, `private`, or `duplicate`. If `mode` is not given, tells you the current drop mode without changing it. See the "Item tables and drop modes" section for more information.
|
||||
|
||||
* Episode 3 commands (game server only)
|
||||
* `$spec`: Toggles the allow spectators flag for Episode 3 games. If any players are spectating when this flag is disabled, they will be sent back to the lobby.
|
||||
@@ -389,6 +404,14 @@ If you're using a version of Dolphin with tapserver support, you can make it con
|
||||
3. In PSO's network settings, enable DHCP ("Automatically obtain an IP address"), set DNS server address to "Automatic", and leave DHCP Hostname as "Not set". Leave the proxy server settings blank.
|
||||
4. Start an online game.
|
||||
|
||||
#### PSO BB
|
||||
|
||||
The PSO BB client has been modified and distributed in many different forms. newserv supports most, but not all, of the common distributions. Unlike other versions, it's important that the client and server have the same map files, so make sure to set up the patch directory based on the client you'll be using with newserv. (See the "Client patch directories" section for instructions on setting this up.)
|
||||
|
||||
The original Japanese and US versions of PSO BB should work, but you'll have to modify your hosts file or edit psobb.exe to point to your newserv instance. The original versions are packed, so this is a more involved process than simply opening the executable in a hex editor and finding/replacing some strings.
|
||||
|
||||
Alternatively, you can use the Tethealla client (https://archive.org/details/psobb-tethealla-client); you can find the connection addresses starting at 0x56D724 in psobb.exe. Overwrite these addresses with your server's hostname or IP address, and you should be able to connect.
|
||||
|
||||
### Connecting external clients
|
||||
|
||||
If you want to accept connections from outside your local network, you'll need to set ExternalAddress to your public IP address in the configuration file, and you'll likely need to open some ports in your router's NAT configuration - specifically, all the TCP ports listed in PortConfiguration in config.json.
|
||||
@@ -411,7 +434,7 @@ newserv has many CLI options, which can be used to access functionality other th
|
||||
* Convert quests in .gci, .vms, .dlq, or .qst format to .bin/.dat format (`decode-gci`, `decode-vms`, `decode-dlq`, `decode-qst`)
|
||||
* Convert quests in .bin/.dat to .qst format (`encode-qst`)
|
||||
* Convert text archives (e.g. TextEnglish.pr2) to JSON and vice versa (`decode-text-archive`, `encode-text-archive`)
|
||||
* Disassemble quest scripts (`disassemble-quest-script`)
|
||||
* Compile or disassemble quest scripts (`assemble-quest-script`, `disassemble-quest-script`)
|
||||
* Format Episode 3 game data in a human-readable manner (`show-ep3-maps`, `show-ep3-cards`)
|
||||
* Convert item data to a human-readable description, or vice versa (`describe-item`, `encode-item`)
|
||||
* Connect to another PSO server and pretend to be a client (`cat-client`)
|
||||
|
||||
@@ -1,41 +1,29 @@
|
||||
## General
|
||||
|
||||
- Find a way to silence audio in RunDOL.s
|
||||
- Encapsulate BB server-side random state and make replays deterministic
|
||||
- Implement choice search
|
||||
- Write a simple status API
|
||||
- Implement per-game logging
|
||||
- Build an exception-handling abstraction in ChatCommands that shows formatted error messages in all cases
|
||||
- Make reloading happen on separate threads so compression doesn't block active clients
|
||||
- Implement decrypt/encrypt actions for VMS files
|
||||
- Make UI strings localizable (e.g. entries in menus, welcome message, etc.)
|
||||
- Figure out what causes the corruption message on PC proxy sessions and fix it
|
||||
- Make $edit for DC/PC
|
||||
- Add an idle connection timeout for proxy sessions
|
||||
- Look into JP heart symbol bug on Linux
|
||||
|
||||
## Episode 3
|
||||
|
||||
- Make disconnecting during a tournament match cause you to forfeit the match
|
||||
- Enforce tournament deck restrictions (e.g. rank checks, No Assist option) when populating COMs at tournament start time
|
||||
- It may be possible to send spectators back to the waiting room after a non-tournament battle by sending 6xB4x05 with environment 0x19, then 6xB4x3B again; try this
|
||||
- Add support for recording battles on the proxy server (both in primary and spectator teams)
|
||||
- When `reload ep3` happens and the defs file is changed, send the new defs file to all connected players who aren't in a game (if this even works - when exactly does the client decompress the defs file from the server?)
|
||||
- Make `reload licenses` not vulnerable to online players' licenses overwriting licenses on disk somehow
|
||||
- Implement ranks (based on total Meseta earned)
|
||||
|
||||
## PSO XBOX
|
||||
|
||||
- Fix receiving Guild Cards from non-Xbox players
|
||||
- Make the Guild Card description field in SavedPlayerDataBB longer to accommodate XB descriptions (0x200 bytes)
|
||||
- Research the F94D quest opcode
|
||||
|
||||
## PSOBB
|
||||
|
||||
- Find any remaining mismatches in enemy indexes / experience
|
||||
- Fix some edge cases on the BB proxy server (e.g. Change Ship)
|
||||
- Implement less-common subcommands
|
||||
- 6xD8: Add S-rank weapon special
|
||||
- Test team commands
|
||||
- Test all EA subcommands (a few are still not implemented)
|
||||
- 6xC1, 6xC2, 6xCD, 6xCE: Team invites/administration (not implemented)
|
||||
- Fix invite member menu
|
||||
- Implement story progress flags for unlocking quests
|
||||
- Test all quest item subcommands
|
||||
- Check if Commander Blade effect works and implement it if not
|
||||
- Figure out why Pouilly Slime EXP doesn't work
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,4 +2,4 @@ DC NTE: pso02.dricas.ne.jp
|
||||
Nov 2000 proto: test1.st-pso.games.sega.net
|
||||
Dec 2000 proto: sg107634.csrd.sega.co.jp OR master.pso.dream-key.com
|
||||
Jan 2001 proto: master.pso.dream-key.com
|
||||
Aug 2001 proto (v2): ???
|
||||
Aug 2001 proto (v2): game01.st-pso.games.sega.net
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
import collections
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
version_tokens = ("JP12", "JP13", "JP14", "JP15", "US10", "US11", "US12", "EU")
|
||||
version_to_specific_version = {
|
||||
"JP12": "3OJ2",
|
||||
"JP13": "3OJ3",
|
||||
"JP14": "3OJ4",
|
||||
"JP15": "3OJ5",
|
||||
"US10": "3OE0",
|
||||
"US11": "3OE1",
|
||||
"US12": "3OE2",
|
||||
"EU": "3OP0",
|
||||
}
|
||||
|
||||
|
||||
@dataclass
|
||||
class WriteRegion:
|
||||
address: int
|
||||
data: list[int]
|
||||
|
||||
|
||||
def disassemble_opcode(opcode: int, start_address: int) -> str:
|
||||
try:
|
||||
result = subprocess.check_output(
|
||||
[
|
||||
"m68kdasm",
|
||||
f"--start-address={hex(start_address)}",
|
||||
"--ppc32",
|
||||
"--parse-data",
|
||||
],
|
||||
input=f"{opcode:08X}".encode("ascii"),
|
||||
)
|
||||
return result.decode("ascii").strip().split(None, 2)[2]
|
||||
except Exception:
|
||||
return ""
|
||||
|
||||
|
||||
def write_patches_for_code(
|
||||
out_dir: str,
|
||||
name: str,
|
||||
version_to_lines: dict[str, dict[int, int]],
|
||||
long_name: str | None,
|
||||
desc: str | None,
|
||||
) -> None:
|
||||
for v, lines in version_to_lines.items():
|
||||
write_regions: list[WriteRegion] = []
|
||||
for addr, value in sorted(lines.items()):
|
||||
if write_regions and (
|
||||
write_regions[-1].address + len(write_regions[-1].data) * 4 == addr
|
||||
):
|
||||
write_regions[-1].data.append(value)
|
||||
else:
|
||||
write_regions.append(WriteRegion(address=addr, data=[value]))
|
||||
|
||||
if write_regions:
|
||||
filename = os.path.join(
|
||||
out_dir,
|
||||
f'{name.replace(" ", "")}.{version_to_specific_version[v]}.patch.s',
|
||||
)
|
||||
with open(filename, "wt") as f:
|
||||
if long_name is not None:
|
||||
f.write(f'.meta name="{long_name}"\n')
|
||||
if desc is not None:
|
||||
f.write(f'.meta description="{desc}"\n')
|
||||
f.write("\n")
|
||||
f.write("entry_ptr:\n")
|
||||
f.write("reloc0:\n")
|
||||
f.write(" .offsetof start\n")
|
||||
f.write("start:\n")
|
||||
f.write(" .include WriteCodeBlocks\n")
|
||||
for region in write_regions:
|
||||
f.write(
|
||||
f" # region @ {region.address:08X} ({len(region.data) * 4} bytes)\n"
|
||||
)
|
||||
f.write(f" .data 0x{region.address:08X} # address\n")
|
||||
f.write(f" .data 0x{(len(region.data) * 4):08X} # size\n")
|
||||
for z, value in enumerate(region.data):
|
||||
addr = region.address + (z * 4)
|
||||
disassembly = disassemble_opcode(value, addr)
|
||||
f.write(
|
||||
f" .data 0x{value:08X} # {addr:08X} => {disassembly}\n"
|
||||
)
|
||||
f.write(" # end sentinel\n")
|
||||
f.write(" .data 0x00000000 # address\n")
|
||||
f.write(" .data 0x00000000 # size\n")
|
||||
print(f"... {filename}")
|
||||
else:
|
||||
print(f"*** {filename} (no data to write)")
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 3:
|
||||
raise RuntimeError(
|
||||
"Usage: python3 generate-patches.py <source-filename> <out-dir>"
|
||||
)
|
||||
src_file = sys.argv[1]
|
||||
out_dir = sys.argv[2]
|
||||
|
||||
with open(src_file, "rt") as f:
|
||||
lines = f.read().splitlines()
|
||||
|
||||
reading_code = False
|
||||
reading_patch = False
|
||||
code_name = ""
|
||||
version_name = ""
|
||||
name_to_version_to_lines = collections.defaultdict(
|
||||
lambda: collections.defaultdict(dict)
|
||||
) # {name:{version: {addr: value}}}
|
||||
name_to_long_name = {}
|
||||
name_to_description = {}
|
||||
for line in lines:
|
||||
if not line:
|
||||
reading_code = False
|
||||
reading_patch = False
|
||||
elif reading_code:
|
||||
for z, v in enumerate(version_tokens):
|
||||
addr_str = line[18 * z : 18 * z + 8]
|
||||
value_str = line[18 * z + 9 : 18 * z + 17]
|
||||
if addr_str != " " and value_str != " ":
|
||||
addr = int(addr_str, 16)
|
||||
if addr in name_to_version_to_lines[code_name][v]:
|
||||
raise ValueError(f"duplicate write to address {addr:08X}")
|
||||
name_to_version_to_lines[code_name][v][addr] = int(value_str, 16)
|
||||
elif line.startswith("*** name="):
|
||||
name_to_long_name[code_name] = line[9:]
|
||||
elif line.startswith("*** desc="):
|
||||
name_to_description[code_name] = line[9:]
|
||||
elif line.startswith("======== PsoV3-"):
|
||||
reading_patch = True
|
||||
version_name = line[15:].split(".")[0]
|
||||
elif reading_patch:
|
||||
addr_str, data_str = line.split()
|
||||
addr = int(addr_str, 16)
|
||||
data = bytes.fromhex(data_str)
|
||||
for z in range(0, len(data), 4):
|
||||
name_to_version_to_lines[code_name][version_name][addr + z] = (
|
||||
(data[z] << 24)
|
||||
| (data[z + 1] << 16)
|
||||
| (data[z + 2] << 8)
|
||||
| (data[z + 3] << 0)
|
||||
)
|
||||
elif line.startswith("JP12------------"):
|
||||
reading_code = True
|
||||
else:
|
||||
code_name = line
|
||||
|
||||
for name, version_to_lines in name_to_version_to_lines.items():
|
||||
write_patches_for_code(
|
||||
out_dir,
|
||||
name,
|
||||
version_to_lines,
|
||||
name_to_long_name.get(name),
|
||||
name_to_description.get(name),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+908
-908
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,933 @@
|
||||
GameCube patch ports
|
||||
|
||||
|
||||
NOTES
|
||||
|
||||
check_controller_button + pad1 + fixup addr
|
||||
PsoV3-JP12 => 801A688C 80508A88 80508AD0
|
||||
PsoV3-JP13 => 801A6C70 8050C548 8050C590
|
||||
PsoV3-JP14 => 801A6DDC 8050EB88 8050EBD0
|
||||
PsoV3-JP15 => 801A6D3C 8050E928 8050E970
|
||||
PsoV3-US10 => 801A6C68 80509368 805093B0
|
||||
PsoV3-US11 => 801A6C68 80509848 80509890
|
||||
PsoV3-US12 => 801A6DA0 8050E228 8050E270
|
||||
PsoV3-EU => 801A725C 8050F248 8050F290
|
||||
|
||||
|
||||
|
||||
CODES
|
||||
|
||||
Common Bank Patch
|
||||
CommonBank
|
||||
*** name=Common bank
|
||||
*** desc=Hold L and open\nthe bank to use a\ncommon bank stored\nin temp character\n3's data
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000BAB4 281B0002 8000BAB4 281B0002 8000BAB4 281B0002 8000BAB4 281B0002 8000BAB4 281B0002 8000BAB4 281B0002 8000BAB4 281B0002 8000BAB4 281B0002 cmplwi r27, 2
|
||||
8000BAB8 40820018 8000BAB8 40820018 8000BAB8 40820018 8000BAB8 40820018 8000BAB8 40820018 8000BAB8 40820018 8000BAB8 40820018 8000BAB8 40820018 bne +0x00000018 /* 8000BAD0 */
|
||||
8000BABC 3C008000 8000BABC 3C008000 8000BABC 3C008000 8000BABC 3C008000 8000BABC 3C008000 8000BABC 3C008000 8000BABC 3C008000 8000BABC 3C008000 lis r0, 0x8000
|
||||
8000BAC0 6000BAD8 8000BAC0 6000BAD8 8000BAC0 6000BAD8 8000BAC0 6000BAD8 8000BAC0 6000BAD8 8000BAC0 6000BAD8 8000BAC0 6000BAD8 8000BAC0 6000BAD8 ori r0, r0, 0xBAD8
|
||||
8000BAC4 90030004 8000BAC4 90030004 8000BAC4 90030004 8000BAC4 90030004 8000BAC4 90030004 8000BAC4 90030004 8000BAC4 90030004 8000BAC4 90030004 stw [r3 + 0x0004], r0
|
||||
8000BAC8 38000000 8000BAC8 38000000 8000BAC8 38000000 8000BAC8 38000000 8000BAC8 38000000 8000BAC8 38000000 8000BAC8 38000000 8000BAC8 38000000 li r0, 0x0000
|
||||
8000BACC 90030008 8000BACC 90030008 8000BACC 90030008 8000BACC 90030008 8000BACC 90030008 8000BACC 90030008 8000BACC 90030008 8000BACC 90030008 stw [r3 + 0x0008], r0
|
||||
8000BAD0 807F0040 8000BAD0 807F0040 8000BAD0 807F0040 8000BAD0 807F0040 8000BAD0 807F0040 8000BAD0 807F0040 8000BAD0 807F0040 8000BAD0 807F0040 lwz r3, [r31 + 0x0040]
|
||||
8000BAD4 4E800020 8000BAD4 4E800020 8000BAD4 4E800020 8000BAD4 4E800020 8000BAD4 4E800020 8000BAD4 4E800020 8000BAD4 4E800020 8000BAD4 4E800020 blr
|
||||
8000BAD8 434F4D4D 8000BAD8 434F4D4D 8000BAD8 434F4D4D 8000BAD8 434F4D4D 8000BAD8 434F4D4D 8000BAD8 434F4D4D 8000BAD8 434F4D4D 8000BAD8 434F4D4D bdzl cr3, +0x00004D4C /* 80010824 */
|
||||
8000BADC 4F4E2042 8000BADC 4F4E2042 8000BADC 4F4E2042 8000BADC 4F4E2042 8000BADC 4F4E2042 8000BADC 4F4E2042 8000BADC 4F4E2042 8000BADC 4F4E2042 crnor crb26, crb14, crb4
|
||||
8000BAE0 414E4B00 8000BAE0 414E4B00 8000BAE0 414E4B00 8000BAE0 414E4B00 8000BAE0 414E4B00 8000BAE0 414E4B00 8000BAE0 414E4B00 8000BAE0 414E4B00 bc 10, 14, +0x00004B00 /* 800105E0 */
|
||||
8000BAE4 800D8EB0 8000BAE4 800D8EB0 8000BAE4 800D8EB0 8000BAE4 800D8EB0 8000BAE4 800D8EB8 8000BAE4 800D8EB8 8000BAE4 800D8EB8 8000BAE4 800D8EB8 lwz r0, [r13 - 0x7148]
|
||||
8000BAE8 28000001 8000BAE8 28000001 8000BAE8 28000001 8000BAE8 28000001 8000BAE8 28000001 8000BAE8 28000001 8000BAE8 28000001 8000BAE8 28000001 cmplwi r0, 1
|
||||
8000BAEC 40820040 8000BAEC 40820040 8000BAEC 40820040 8000BAEC 40820040 8000BAEC 40820040 8000BAEC 40820040 8000BAEC 40820040 8000BAEC 40820040 bne +0x00000040 /* 8000BB2C */
|
||||
8000BAF0 3C808051 8000BAF0 3C808051 8000BAF0 3C808051 8000BAF0 3C808051 8000BAF0 3C808051 8000BAF0 3C808051 8000BAF0 3C808051 8000BAF0 3C808051 lis r4, 0x8051
|
||||
8000BAF4 A0848AD0 8000BAF4 A084C590 8000BAF4 A084EBD0 8000BAF4 A084E970 8000BAF4 A08493B0 8000BAF4 A0849890 8000BAF4 A084E270 8000BAF4 A084F290 lhz r4, [r4 - 0x6C50]
|
||||
8000BAF8 70800002 8000BAF8 70800002 8000BAF8 70800002 8000BAF8 70800002 8000BAF8 70800002 8000BAF8 70800002 8000BAF8 70800002 8000BAF8 70800002 andi. r0, r4, 0x0002
|
||||
8000BAFC 41820028 8000BAFC 41820028 8000BAFC 41820028 8000BAFC 41820028 8000BAFC 41820028 8000BAFC 41820028 8000BAFC 41820028 8000BAFC 41820028 beq +0x00000028 /* 8000BB24 */
|
||||
8000BB00 800DB93C 8000BB00 800DB944 8000BB00 800DB964 8000BB00 800DB964 8000BB00 800DB954 8000BB00 800DB954 8000BB00 800DB974 8000BB00 800DB9B4 lwz r0, [r13 - 0x46AC]
|
||||
8000BB04 28000006 8000BB04 28000006 8000BB04 28000006 8000BB04 28000006 8000BB04 28000006 8000BB04 28000006 8000BB04 28000006 8000BB04 28000006 cmplwi r0, 6
|
||||
8000BB08 4182001C 8000BB08 4182001C 8000BB08 4182001C 8000BB08 4182001C 8000BB08 4182001C 8000BB08 4182001C 8000BB08 4182001C 8000BB08 4182001C beq +0x0000001C /* 8000BB24 */
|
||||
8000BB0C 806DB920 8000BB0C 806DB928 8000BB0C 806DB948 8000BB0C 806DB948 8000BB0C 806DB938 8000BB0C 806DB938 8000BB0C 806DB958 8000BB0C 806DB998 lwz r3, [r13 - 0x46C8]
|
||||
8000BB10 28030000 8000BB10 28030000 8000BB10 28030000 8000BB10 28030000 8000BB10 28030000 8000BB10 28030000 8000BB10 28030000 8000BB10 28030000 cmplwi r3, 0
|
||||
8000BB14 41820010 8000BB14 41820010 8000BB14 41820010 8000BB14 41820010 8000BB14 41820010 8000BB14 41820010 8000BB14 41820010 8000BB14 41820010 beq +0x00000010 /* 8000BB24 */
|
||||
8000BB18 38000000 8000BB18 38000000 8000BB18 38000000 8000BB18 38000000 8000BB18 38000000 8000BB18 38000000 8000BB18 38000000 8000BB18 38000000 li r0, 0x0000
|
||||
8000BB1C 6000F1B0 8000BB1C 6000F1B0 8000BB1C 6000F1B0 8000BB1C 6000F1B0 8000BB1C 6000F1B0 8000BB1C 6000F1B0 8000BB1C 6000F1B0 8000BB1C 6000F1B0 ori r0, r0, 0xF1B0
|
||||
8000BB20 7C630214 8000BB20 7C630214 8000BB20 7C630214 8000BB20 7C630214 8000BB20 7C630214 8000BB20 7C630214 8000BB20 7C630214 8000BB20 7C630214 add r3, r3, r0
|
||||
8000BB24 3C808001 8000BB24 3C808001 8000BB24 3C808001 8000BB24 3C808001 8000BB24 3C808001 8000BB24 3C808001 8000BB24 3C808001 8000BB24 3C808001 lis r4, 0x8001
|
||||
8000BB28 9064C32C 8000BB28 9064C32C 8000BB28 9064C32C 8000BB28 9064C32C 8000BB28 9064C32C 8000BB28 9064C32C 8000BB28 9064C32C 8000BB28 9064C32C stw [r4 - 0x3CD4], r3
|
||||
8000BB2C 28030000 8000BB2C 28030000 8000BB2C 28030000 8000BB2C 28030000 8000BB2C 28030000 8000BB2C 28030000 8000BB2C 28030000 8000BB2C 28030000 cmplwi r3, 0
|
||||
8000BB30 48203FB8 8000BB30 48204894 8000BB30 48205674 8000BB30 482053D0 8000BB30 482047B4 8000BB30 482047B4 8000BB30 48205704 8000BB30 48205100 b +0x002047B4 /* 802102E4 */
|
||||
8000BB34 800D8EB0 8000BB34 800D8EB0 8000BB34 800D8EB0 8000BB34 800D8EB0 8000BB34 800D8EB8 8000BB34 800D8EB8 8000BB34 800D8EB8 8000BB34 800D8EB8 lwz r0, [r13 - 0x7148]
|
||||
8000BB38 28000001 8000BB38 28000001 8000BB38 28000001 8000BB38 28000001 8000BB38 28000001 8000BB38 28000001 8000BB38 28000001 8000BB38 28000001 cmplwi r0, 1
|
||||
8000BB3C 4082000C 8000BB3C 4082000C 8000BB3C 4082000C 8000BB3C 4082000C 8000BB3C 4082000C 8000BB3C 4082000C 8000BB3C 4082000C 8000BB3C 4082000C bne +0x0000000C /* 8000BB48 */
|
||||
8000BB40 3C608001 8000BB40 3C608001 8000BB40 3C608001 8000BB40 3C608001 8000BB40 3C608001 8000BB40 3C608001 8000BB40 3C608001 8000BB40 3C608001 lis r3, 0x8001
|
||||
8000BB44 8063C32C 8000BB44 8063C32C 8000BB44 8063C32C 8000BB44 8063C32C 8000BB44 8063C32C 8000BB44 8063C32C 8000BB44 8063C32C 8000BB44 8063C32C lwz r3, [r3 - 0x3CD4]
|
||||
8000BB48 7C681B79 8000BB48 7C681B79 8000BB48 7C681B79 8000BB48 7C681B79 8000BB48 7C681B79 8000BB48 7C681B79 8000BB48 7C681B79 8000BB48 7C681B79 mr. r8, r3
|
||||
8000BB4C 48203EB0 8000BB4C 48204804 8000BB4C 482055E4 8000BB4C 48205340 8000BB4C 48204724 8000BB4C 48204724 8000BB4C 48205674 8000BB4C 48205070 b +0x00204724 /* 80210270 */
|
||||
8020F9F8 4BDFC13C 8021034C 4BDFB7E8 8021112C 4BDFAA08 80210E88 4BDFACAC 8021026C 4BDFB8C8 8021026C 4BDFB8C8 802111BC 4BDFA978 80210BB8 4BDFAF7C b -0x00204738 /* 8000BB34 */
|
||||
8020FAE4 4BDFC000 802103C0 4BDFB724 802111A0 4BDFA944 80210EFC 4BDFABE8 802102E0 4BDFB804 802102E0 4BDFB804 80211230 4BDFA8B4 80210C2C 4BDFAEB8 b -0x002047FC /* 8000BAE4 */
|
||||
8030AA54 4BD01061 8030BAA4 4BD00011 8030CEF0 4BCFEBC5 8030CCA4 4BCFEE11 8030B414 4BD006A1 8030B458 4BD0065D 8030CE60 4BCFEC55 8030C228 4BCFF88D bl -0x002FF960 /* 8000BAB4 */
|
||||
8030AAAC 4BD01009 8030BAFC 4BCFFFB9 8030CF48 4BCFEB6D 8030CCFC 4BCFEDB9 8030B46C 4BD00649 8030B4B0 4BD00605 8030CEB8 4BCFEBFD 8030C280 4BCFF835 bl -0x002FF9B8 /* 8000BAB4 */
|
||||
8046CECC FFFFFFFF 8046FCEC FFFFFFFF 80471E4C FFFFFFFF 80471C14 FFFFFFFF 8046DC5C FFFFFFFF 8046E0DC FFFFFFFF 80471ACC FFFFFFFF 80471804 FFFFFFFF fnmadd. f31, f31, f31, f31
|
||||
|
||||
Item Loss Prevention
|
||||
ItemLossPrevention
|
||||
*** name=No item loss
|
||||
*** desc=Don't lose items if\nyou don't log off\nnormally
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
801D33E4 4800004C 801D38EC 4800004C 801D3CC4 4800004C 801D39B8 4800004C 801D381C 4800004C 801D381C 4800004C 801D3A1C 4800004C 801D3ED8 4800004C b +0x0000004C /* 801D3868 */
|
||||
8020010C 60000000 801FF710 60000000 801FF0FC 60000000 801FF0FC 60000000 801FFA44 60000000 801FF9E0 60000000 nop
|
||||
802016CC 60000000 80200C9C 60000000 80200658 60000000 80200658 60000000 80200FD0 60000000 80200F3C 60000000 nop
|
||||
801FD944 38000000 80202860 38000000 802021C4 38000000 802021C4 38000000 80202B94 38000000 80202AA8 38000000 li r0, 0x0000
|
||||
802C2060 4800004C 802C2F98 4800004C 802C42E4 4800004C 802C3E78 4800004C 802C2A40 4800004C 802C2A84 4800004C 802C402C 4800004C 802C37C0 4800004C b +0x0000004C /* 802C2A8C */
|
||||
802D0AA0 48000020 802D1A58 48000020 802D2C10 48000020 802D2938 48000020 802D1480 48000020 802D14C4 48000020 802D2AEC 48000020 802D2280 48000020 b +0x00000020 /* 802D14A0 */
|
||||
|
||||
"Palette Patch" Part 1
|
||||
Palette
|
||||
*** name=Palette
|
||||
*** desc=Press Z to cycle\nthrough 4 customize\nconfigs instead of of\njust one
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000CD00 3C808000 8000CD00 3C808000 8000CD00 3C808000 8000CD00 3C808000 8000CD00 3C808000 8000CD00 3C808000 8000CD00 3C808000 8000CD00 3C808000 lis r4, 0x8000
|
||||
8000CD04 6084CF3E 8000CD04 6084CF3E 8000CD04 6084CF3E 8000CD04 6084CF3E 8000CD04 6084CF3E 8000CD04 6084CF3E 8000CD04 6084CF3E 8000CD04 6084CF3E ori r4, r4, 0xCF3E
|
||||
8000CD08 3BE00000 8000CD08 3BE00000 8000CD08 3BE00000 8000CD08 3BE00000 8000CD08 3BE00000 8000CD08 3BE00000 8000CD08 3BE00000 8000CD08 3BE00000 li r31, 0x0000
|
||||
8000CD0C A0C4003A 8000CD0C A0C4003A 8000CD0C A0C4003A 8000CD0C A0C4003A 8000CD0C A0C4003A 8000CD0C A0C4003A 8000CD0C A0C4003A 8000CD0C A0C4003A lhz r6, [r4 + 0x003A]
|
||||
8000CD10 2C060000 8000CD10 2C060000 8000CD10 2C060000 8000CD10 2C060000 8000CD10 2C060000 8000CD10 2C060000 8000CD10 2C060000 8000CD10 2C060000 cmpwi r6, 0
|
||||
8000CD14 41820074 8000CD14 41820074 8000CD14 41820074 8000CD14 41820074 8000CD14 41820074 8000CD14 41820074 8000CD14 41820074 8000CD14 41820074 beq +0x00000074 /* 8000CD88 */
|
||||
8000CD18 B3E4003A 8000CD18 B3E4003A 8000CD18 B3E4003A 8000CD18 B3E4003A 8000CD18 B3E4003A 8000CD18 B3E4003A 8000CD18 B3E4003A 8000CD18 B3E4003A sth [r4 + 0x003A], r31
|
||||
8000CD1C 3C608051 8000CD1C 3C608051 8000CD1C 3C608051 8000CD1C 3C608051 8000CD1C 3C608051 8000CD1C 3C608051 8000CD1C 3C608051 8000CD1C 3C608051 lis r3, 0x8051 NEEDS FIXUP
|
||||
8000CD20 A003E274 8000CD20 A003E274 8000CD20 A003E274 8000CD20 A003E274 8000CD20 A003E274 8000CD20 A003E274 8000CD20 A003E274 8000CD20 A003E274 lhz r0, [r3 - 0x1D8C]
|
||||
8000CD24 A0A3E270 8000CD24 A0A3E270 8000CD24 A0A3E270 8000CD24 A0A3E270 8000CD24 A0A3E270 8000CD24 A0A3E270 8000CD24 A0A3E270 8000CD24 A0A3E270 lhz r5, [r3 - 0x1D90]
|
||||
8000CD28 7CA53038 8000CD28 7CA53038 8000CD28 7CA53038 8000CD28 7CA53038 8000CD28 7CA53038 8000CD28 7CA53038 8000CD28 7CA53038 8000CD28 7CA53038 and r5, r5, r6
|
||||
8000CD2C 70003C00 8000CD2C 70003C00 8000CD2C 70003C00 8000CD2C 70003C00 8000CD2C 70003C00 8000CD2C 70003C00 8000CD2C 70003C00 8000CD2C 70003C00 andi. r0, r0, 0x3C00
|
||||
8000CD30 41820058 8000CD30 41820058 8000CD30 41820058 8000CD30 41820058 8000CD30 41820058 8000CD30 41820058 8000CD30 41820058 8000CD30 41820058 beq +0x00000058 /* 8000CD88 */
|
||||
8000CD34 5403056B 8000CD34 5403056B 8000CD34 5403056B 8000CD34 5403056B 8000CD34 5403056B 8000CD34 5403056B 8000CD34 5403056B 8000CD34 5403056B rlwinm. r3, r0, 0, 21, 21
|
||||
8000CD38 41820008 8000CD38 41820008 8000CD38 41820008 8000CD38 41820008 8000CD38 41820008 8000CD38 41820008 8000CD38 41820008 8000CD38 41820008 beq +0x00000008 /* 8000CD40 */
|
||||
8000CD3C 3BC0002A 8000CD3C 3BC0002A 8000CD3C 3BC0002A 8000CD3C 3BC0002A 8000CD3C 3BC0002A 8000CD3C 3BC0002A 8000CD3C 3BC0002A 8000CD3C 3BC0002A li r30, 0x002A
|
||||
8000CD40 540304A5 8000CD40 540304A5 8000CD40 540304A5 8000CD40 540304A5 8000CD40 540304A5 8000CD40 540304A5 8000CD40 540304A5 8000CD40 540304A5 rlwinm. r3, r0, 0, 18, 18
|
||||
8000CD44 41820008 8000CD44 41820008 8000CD44 41820008 8000CD44 41820008 8000CD44 41820008 8000CD44 41820008 8000CD44 41820008 8000CD44 41820008 beq +0x00000008 /* 8000CD4C */
|
||||
8000CD48 3BC0001C 8000CD48 3BC0001C 8000CD48 3BC0001C 8000CD48 3BC0001C 8000CD48 3BC0001C 8000CD48 3BC0001C 8000CD48 3BC0001C 8000CD48 3BC0001C li r30, 0x001C
|
||||
8000CD4C 54030529 8000CD4C 54030529 8000CD4C 54030529 8000CD4C 54030529 8000CD4C 54030529 8000CD4C 54030529 8000CD4C 54030529 8000CD4C 54030529 rlwinm. r3, r0, 0, 20, 20
|
||||
8000CD50 41820008 8000CD50 41820008 8000CD50 41820008 8000CD50 41820008 8000CD50 41820008 8000CD50 41820008 8000CD50 41820008 8000CD50 41820008 beq +0x00000008 /* 8000CD58 */
|
||||
8000CD54 3BC0000E 8000CD54 3BC0000E 8000CD54 3BC0000E 8000CD54 3BC0000E 8000CD54 3BC0000E 8000CD54 3BC0000E 8000CD54 3BC0000E 8000CD54 3BC0000E li r30, 0x000E
|
||||
8000CD58 7C84F214 8000CD58 7C84F214 8000CD58 7C84F214 8000CD58 7C84F214 8000CD58 7C84F214 8000CD58 7C84F214 8000CD58 7C84F214 8000CD58 7C84F214 add r4, r4, r30
|
||||
8000CD5C 38000007 8000CD5C 38000007 8000CD5C 38000007 8000CD5C 38000007 8000CD5C 38000007 8000CD5C 38000007 8000CD5C 38000007 8000CD5C 38000007 li r0, 0x0007
|
||||
8000CD60 7C0903A6 8000CD60 7C0903A6 8000CD60 7C0903A6 8000CD60 7C0903A6 8000CD60 7C0903A6 8000CD60 7C0903A6 8000CD60 7C0903A6 8000CD60 7C0903A6 mtctr r0
|
||||
8000CD64 387C0504 8000CD64 387C0504 8000CD64 387C0504 8000CD64 387C0504 8000CD64 387C0504 8000CD64 387C0504 8000CD64 387C0504 8000CD64 387C0504 addi r3, r28, 0x0504
|
||||
8000CD68 2C050003 8000CD68 2C050003 8000CD68 2C050003 8000CD68 2C050003 8000CD68 2C050003 8000CD68 2C050003 8000CD68 2C050003 8000CD68 2C050003 cmpwi r5, 3
|
||||
8000CD6C 4082000C 8000CD6C 4082000C 8000CD6C 4082000C 8000CD6C 4082000C 8000CD6C 4082000C 8000CD6C 4082000C 8000CD6C 4082000C 8000CD6C 4082000C bne +0x0000000C /* 8000CD78 */
|
||||
8000CD70 A0030004 8000CD70 A0030004 8000CD70 A0030004 8000CD70 A0030004 8000CD70 A0030004 8000CD70 A0030004 8000CD70 A0030004 8000CD70 A0030004 lhz r0, [r3 + 0x0004]
|
||||
8000CD74 B0040002 8000CD74 B0040002 8000CD74 B0040002 8000CD74 B0040002 8000CD74 B0040002 8000CD74 B0040002 8000CD74 B0040002 8000CD74 B0040002 sth [r4 + 0x0002], r0
|
||||
8000CD78 A4040002 8000CD78 A4040002 8000CD78 A4040002 8000CD78 A4040002 8000CD78 A4040002 8000CD78 A4040002 8000CD78 A4040002 8000CD78 A4040002 lhzu r0, [r4 + 0x0002]
|
||||
8000CD7C B4030004 8000CD7C B4030004 8000CD7C B4030004 8000CD7C B4030004 8000CD7C B4030004 8000CD7C B4030004 8000CD7C B4030004 8000CD7C B4030004 sthu [r3 + 0x0004], r0
|
||||
8000CD80 4200FFE8 8000CD80 4200FFE8 8000CD80 4200FFE8 8000CD80 4200FFE8 8000CD80 4200FFE8 8000CD80 4200FFE8 8000CD80 4200FFE8 8000CD80 4200FFE8 bdnz -0x00000018 /* 8000CD68 */
|
||||
8000CD84 3BC00000 8000CD84 3BC00000 8000CD84 3BC00000 8000CD84 3BC00000 8000CD84 3BC00000 8000CD84 3BC00000 8000CD84 3BC00000 8000CD84 3BC00000 li r30, 0x0000
|
||||
8000CD88 481CAABC 8000CD88 481CAFC4 8000CD88 481CB180 8000CD88 481CB090 8000CD88 481CAEF4 8000CD88 481CAEF4 8000CD88 481CB0F4 8000CD88 481CB5B0 b +0x001CAEF4 /* 801D7C7C */
|
||||
801D7840 4BE354C0 801D7D48 4BE34FB8 801D7F04 4BE34DFC 801D7E14 4BE34EEC 801D7C78 4BE35088 801D7C78 4BE35088 801D7E78 4BE34E88 801D8334 4BE349CC b -0x001CAF78 /* 8000CD00 */
|
||||
|
||||
"Palette Patch" Part 2
|
||||
Palette
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000CD8C 38600003 8000CD8C 38600003 8000CD8C 38600003 8000CD8C 38600003 8000CD8C 38600003 8000CD8C 38600003 8000CD8C 38600003 8000CD8C 38600003 li r3, 0x0003
|
||||
8000CD90 3C808001 8000CD90 3C808001 8000CD90 3C808001 8000CD90 3C808001 8000CD90 3C808001 8000CD90 3C808001 8000CD90 3C808001 8000CD90 3C808001 lis r4, 0x8001
|
||||
8000CD94 B064CF78 8000CD94 B064CF78 8000CD94 B064CF78 8000CD94 B064CF78 8000CD94 B064CF78 8000CD94 B064CF78 8000CD94 B064CF78 8000CD94 B064CF78 sth [r4 - 0x3088], r3
|
||||
8000CD98 7FC3F378 8000CD98 7FC3F378 8000CD98 7FC3F378 8000CD98 7FC3F378 8000CD98 7FC3F378 8000CD98 7FC3F378 8000CD98 7FC3F378 8000CD98 7FC3F378 mr r3, r30
|
||||
8000CD9C 48269718 8000CD9C 4826A454 8000CD9C 4826B4C0 8000CD9C 4826B274 8000CD9C 48269FAC 8000CD9C 48269FF0 8000CD9C 4826B428 8000CD9C 4826AC70 b +0x00269FAC /* 80276D48 */
|
||||
8000CDA0 3D808044 8000CDA0 3D808045 8000CDA0 3D808045 8000CDA0 3D808045 8000CDA0 3D808044 8000CDA0 3D808044 8000CDA0 3D808045 8000CDA0 3D808045 lis r12, 0x8044
|
||||
8000CDA4 618CD840 8000CDA4 618C0660 8000CDA4 618C27C0 8000CDA4 618C2588 8000CDA4 618CE5D0 8000CDA4 618CEA50 8000CDA4 618C2440 8000CDA4 618C2148 ori r12, r12, 0xE5D0
|
||||
8000CDA8 80030000 8000CDA8 80030000 8000CDA8 80030000 8000CDA8 80030000 8000CDA8 80030000 8000CDA8 80030000 8000CDA8 80030000 8000CDA8 80030000 lwz r0, [r3]
|
||||
8000CDAC 7C006000 8000CDAC 7C006000 8000CDAC 7C006000 8000CDAC 7C006000 8000CDAC 7C006000 8000CDAC 7C006000 8000CDAC 7C006000 8000CDAC 7C006000 cmp r0, r12
|
||||
8000CDB0 A0030004 8000CDB0 A0030004 8000CDB0 A0030004 8000CDB0 A0030004 8000CDB0 A0030004 8000CDB0 A0030004 8000CDB0 A0030004 8000CDB0 A0030004 lhz r0, [r3 + 0x0004]
|
||||
8000CDB4 40820018 8000CDB4 40820018 8000CDB4 40820018 8000CDB4 40820018 8000CDB4 40820018 8000CDB4 40820018 8000CDB4 40820018 8000CDB4 40820018 bne +0x00000018 /* 8000CDCC */
|
||||
8000CDB8 2C000000 8000CDB8 2C000000 8000CDB8 2C000000 8000CDB8 2C000000 8000CDB8 2C000000 8000CDB8 2C000000 8000CDB8 2C000000 8000CDB8 2C000000 cmpwi r0, 0
|
||||
8000CDBC 40820010 8000CDBC 40820010 8000CDBC 40820010 8000CDBC 40820010 8000CDBC 40820010 8000CDBC 40820010 8000CDBC 40820010 8000CDBC 40820010 bne +0x00000010 /* 8000CDCC */
|
||||
8000CDC0 38600001 8000CDC0 38600001 8000CDC0 38600001 8000CDC0 38600001 8000CDC0 38600001 8000CDC0 38600001 8000CDC0 38600001 8000CDC0 38600001 li r3, 0x0001
|
||||
8000CDC4 3D808001 8000CDC4 3D808001 8000CDC4 3D808001 8000CDC4 3D808001 8000CDC4 3D808001 8000CDC4 3D808001 8000CDC4 3D808001 8000CDC4 3D808001 lis r12, 0x8001
|
||||
8000CDC8 B06CCF78 8000CDC8 B06CCF78 8000CDC8 B06CCF78 8000CDC8 B06CCF78 8000CDC8 B06CCF78 8000CDC8 B06CCF78 8000CDC8 B06CCF78 8000CDC8 B06CCF78 sth [r12 - 0x3088], r3
|
||||
8000CDCC 4823EF48 8000CDCC 4823F994 8000CDCC 482408D4 8000CDCC 48240688 8000CDCC 4823F7D0 8000CDCC 4823F7D0 8000CDCC 4824094C 8000CDCC 48240194 b +0x0023F7D0 /* 8024C59C */
|
||||
8000CDD0 3C608000 8000CDD0 3C608000 8000CDD0 3C608000 8000CDD0 3C608000 8000CDD0 3C608000 8000CDD0 3C608000 8000CDD0 3C608000 8000CDD0 3C608000 lis r3, 0x8000
|
||||
8000CDD4 6063CF3E 8000CDD4 6063CF3E 8000CDD4 6063CF3E 8000CDD4 6063CF3E 8000CDD4 6063CF3E 8000CDD4 6063CF3E 8000CDD4 6063CF3E 8000CDD4 6063CF3E ori r3, r3, 0xCF3E
|
||||
8000CDD8 3800001C 8000CDD8 3800001C 8000CDD8 3800001C 8000CDD8 3800001C 8000CDD8 3800001C 8000CDD8 3800001C 8000CDD8 3800001C 8000CDD8 3800001C li r0, 0x001C
|
||||
8000CDDC 7C0903A6 8000CDDC 7C0903A6 8000CDDC 7C0903A6 8000CDDC 7C0903A6 8000CDDC 7C0903A6 8000CDDC 7C0903A6 8000CDDC 7C0903A6 8000CDDC 7C0903A6 mtctr r0
|
||||
8000CDE0 38000000 8000CDE0 38000000 8000CDE0 38000000 8000CDE0 38000000 8000CDE0 38000000 8000CDE0 38000000 8000CDE0 38000000 8000CDE0 38000000 li r0, 0x0000
|
||||
8000CDE4 B4030002 8000CDE4 B4030002 8000CDE4 B4030002 8000CDE4 B4030002 8000CDE4 B4030002 8000CDE4 B4030002 8000CDE4 B4030002 8000CDE4 B4030002 sthu [r3 + 0x0002], r0
|
||||
8000CDE8 4200FFFC 8000CDE8 4200FFFC 8000CDE8 4200FFFC 8000CDE8 4200FFFC 8000CDE8 4200FFFC 8000CDE8 4200FFFC 8000CDE8 4200FFFC 8000CDE8 4200FFFC bdnz -0x00000004 /* 8000CDE4 */
|
||||
8000CDEC 48328F74 8000CDEC 48329FF0 8000CDEC 4832B50C 8000CDEC 4832B2C0 8000CDEC 48329974 8000CDEC 483299B8 8000CDEC 4832B494 8000CDEC 4832A8D8 b +0x00329974 /* 80336760 */
|
||||
80246BA8 A01F004A 80247568 A01F004A 802484A8 A01F004A 8024825C A01F004A 802473F4 A01F004A 802473F4 A01F004A 80248520 A01F004A 80247D68 A01F004A lhz r0, [r31 + 0x004A]
|
||||
80246BAC 54030637 8024756C 54030637 802484AC 54030637 80248260 54030637 802473F8 54030637 802473F8 54030637 80248524 54030637 80247D6C 54030637 rlwinm. r3, r0, 0, 24, 27
|
||||
8024BD10 4BDC1090 8024C75C 4BDC0644 8024D69C 4BDBF704 8024D450 4BDBF950 8024C598 4BDC0808 8024C598 4BDC0808 8024D714 4BDBF68C 8024CF5C 4BDBFE44 b -0x0023F7F8 /* 8000CDA0 */
|
||||
802764B0 4BD968DC 802771EC 4BD95BA0 80278258 4BD94B34 8027800C 4BD94D80 80276D44 4BD96048 80276D88 4BD96004 802781C0 4BD94BCC 80277A08 4BD95384 b -0x00269FB8 /* 8000CD8C */
|
||||
80276510 A01F004A 8027724C A01F004A 802782B8 A01F004A 8027806C A01F004A 80276DA4 A01F004A 80276DE8 A01F004A 80278220 A01F004A 80277A68 A01F004A lhz r0, [r31 + 0x004A]
|
||||
80276514 54030637 80277250 54030637 802782BC 54030637 80278070 54030637 80276DA8 54030637 80276DEC 54030637 80278224 54030637 80277A6C 54030637 rlwinm. r3, r0, 0, 24, 27
|
||||
80335D5C 4BCD7074 80336DD8 4BCD5FF8 803382F4 4BCD4ADC 803380A8 4BCD4D28 8033675C 4BCD6674 803367A0 4BCD6630 8033827C 4BCD4B54 803376C0 4BCD5710 b -0x0032998C /* 8000CDD0 */
|
||||
|
||||
"Palette Patch" Part 3 (this part adds PBs to the customize list)
|
||||
Palette
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000CA40 28030000 8000CA40 28030000 8000CA40 28030000 8000CA40 28030000 8000CA40 28030000 8000CA40 28030000 8000CA40 28030000 8000CA40 28030000 cmplwi r3, 0
|
||||
8000CA44 40820008 8000CA44 40820008 8000CA44 40820008 8000CA44 40820008 8000CA44 40820008 8000CA44 40820008 8000CA44 40820008 8000CA44 40820008 bne +0x00000008 /* 8000CA4C */
|
||||
8000CA48 3BE00000 8000CA48 3BE00000 8000CA48 3BE00000 8000CA48 3BE00000 8000CA48 3BE00000 8000CA48 3BE00000 8000CA48 3BE00000 8000CA48 3BE00000 li r31, 0x0000
|
||||
8000CA4C 7C00F800 8000CA4C 7C00F800 8000CA4C 7C00F800 8000CA4C 7C00F800 8000CA4C 7C00F800 8000CA4C 7C00F800 8000CA4C 7C00F800 8000CA4C 7C00F800 cmp r0, r31
|
||||
8000CA50 481CB3AC 8000CA50 481CB8B4 8000CA50 481CBA70 8000CA50 481CB980 8000CA50 481CB7E4 8000CA50 481CB7E4 8000CA50 481CB9E4 8000CA50 481CBEA0 b +0x001CB7E4 /* 801D8234 */
|
||||
8000CA54 38000003 8000CA54 38000003 8000CA54 38000003 8000CA54 38000003 8000CA54 38000003 8000CA54 38000003 8000CA54 38000003 8000CA54 38000003 li r0, 0x0003
|
||||
8000CA58 7C0903A6 8000CA58 7C0903A6 8000CA58 7C0903A6 8000CA58 7C0903A6 8000CA58 7C0903A6 8000CA58 7C0903A6 8000CA58 7C0903A6 8000CA58 7C0903A6 mtctr r0
|
||||
8000CA5C 63C40500 8000CA5C 63C40500 8000CA5C 63C40500 8000CA5C 63C40500 8000CA5C 63C40500 8000CA5C 63C40500 8000CA5C 63C40500 8000CA5C 63C40500 ori r4, r30, 0x0500
|
||||
8000CA60 38BF0538 8000CA60 38BF0538 8000CA60 38BF0538 8000CA60 38BF0538 8000CA60 38BF0538 8000CA60 38BF0538 8000CA60 38BF0538 8000CA60 38BF0538 addi r5, r31, 0x0538
|
||||
8000CA64 A4050004 8000CA64 A4050004 8000CA64 A4050004 8000CA64 A4050004 8000CA64 A4050004 8000CA64 A4050004 8000CA64 A4050004 8000CA64 A4050004 lhzu r0, [r5 + 0x0004]
|
||||
8000CA68 7C040000 8000CA68 7C040000 8000CA68 7C040000 8000CA68 7C040000 8000CA68 7C040000 8000CA68 7C040000 8000CA68 7C040000 8000CA68 7C040000 cmp r4, r0
|
||||
8000CA6C 4182000C 8000CA6C 4182000C 8000CA6C 4182000C 8000CA6C 4182000C 8000CA6C 4182000C 8000CA6C 4182000C 8000CA6C 4182000C 8000CA6C 4182000C beq +0x0000000C /* 8000CA78 */
|
||||
8000CA70 4200FFF4 8000CA70 4200FFF4 8000CA70 4200FFF4 8000CA70 4200FFF4 8000CA70 4200FFF4 8000CA70 4200FFF4 8000CA70 4200FFF4 8000CA70 4200FFF4 bdnz -0x0000000C /* 8000CA64 */
|
||||
8000CA74 38600000 8000CA74 38600000 8000CA74 38600000 8000CA74 38600000 8000CA74 38600000 8000CA74 38600000 8000CA74 38600000 8000CA74 38600000 li r3, 0x0000
|
||||
8000CA78 2C030000 8000CA78 2C030000 8000CA78 2C030000 8000CA78 2C030000 8000CA78 2C030000 8000CA78 2C030000 8000CA78 2C030000 8000CA78 2C030000 cmpwi r3, 0
|
||||
8000CA7C 481BF1A4 8000CA7C 481BF690 8000CA7C 481C0B84 8000CA7C 481BF75C 8000CA7C 481BF5C0 8000CA7C 481BF5C0 8000CA7C 481BF7C0 8000CA7C 481BFC7C b +0x001BF5C0 /* 801CC03C */
|
||||
801CBC1C 4BE40E38 801CC108 4BE4094C 801CD5FC 4BE3F458 801CC1D4 4BE40880 801CC038 4BE40A1C 801CC038 4BE40A1C 801CC238 4BE4081C 801CC6F4 4BE40360 b -0x001BF5E4 /* 8000CA54 */
|
||||
801D7DF8 4BE34C48 801D8300 4BE34740 801D84BC 4BE34584 801D83CC 4BE34674 801D8230 4BE34810 801D8230 4BE34810 801D8430 4BE34610 801D88EC 4BE34154 b -0x001CB7F0 /* 8000CA40 */
|
||||
80275E64 3803BAA0 80276BA0 3803BAA0 80277C0C 3803BAA0 802779C0 3803BAA0 802766F8 3803BAA0 8027673C 3803BAA0 80277B74 3803BAA0 802773BC 3803BAA0 subi r0, r3, 0x4560
|
||||
8044ADAC 0004000D 8044DBCC 0004000D 8044FC34 0004000D 8044F9FC 0004000D 8044BB3C 0004000D 8044BFBC 0004000D 8044F8B4 0004000D 8044F6B4 0004000D .invalid
|
||||
8044ADB0 0004000E 8044DBD0 0004000E 8044FC38 0004000E 8044FA00 0004000E 8044BB40 0004000E 8044BFC0 0004000E 8044F8B8 0004000E 8044F6B8 0004000E .invalid
|
||||
8044ADB4 00000000 8044DBD4 00000000 8044FC3C 00000000 8044FA04 00000000 8044BB44 00000000 8044BFC4 00000000 8044F8BC 00000000 8044F6BC 00000000 .invalid
|
||||
8044ADB8 0004000F 8044DBD8 0004000F 8044FC40 0004000F 8044FA08 0004000F 8044BB48 0004000F 8044BFC8 0004000F 8044F8C0 0004000F 8044F6C0 0004000F .invalid
|
||||
8044ADBC 00040010 8044DBDC 00040010 8044FC44 00040010 8044FA0C 00040010 8044BB4C 00040010 8044BFCC 00040010 8044F8C4 00040010 8044F6C4 00040010 .invalid
|
||||
8044ADC0 00000000 8044DBE0 00000000 8044FC48 00000000 8044FA10 00000000 8044BB50 00000000 8044BFD0 00000000 8044F8C8 00000000 8044F6C8 00000000 .invalid
|
||||
8044ADDC 00080000 8044DBFC 00080000 8044FC64 00080000 8044FA2C 00080000 8044BB6C 00080000 8044BFEC 00080000 8044F8E4 00080000 8044F6E4 00080000 .invalid
|
||||
8044ADC4 00050000 8044DBE4 00050000 8044FC4C 00050000 8044FA14 00050000 8044BB54 00050000 8044BFD4 00050000 8044F8CC 00050000 8044F6CC 00050000 .invalid
|
||||
8044ADC8 00050001 8044DBE8 00050001 8044FC50 00050001 8044FA18 00050001 8044BB58 00050001 8044BFD8 00050001 8044F8D0 00050001 8044F6D0 00050001 .invalid
|
||||
8044ADCC 00050002 8044DBEC 00050002 8044FC54 00050002 8044FA1C 00050002 8044BB5C 00050002 8044BFDC 00050002 8044F8D4 00050002 8044F6D4 00050002 .invalid
|
||||
8044ADD0 00050003 8044DBF0 00050003 8044FC58 00050003 8044FA20 00050003 8044BB60 00050003 8044BFE0 00050003 8044F8D8 00050003 8044F6D8 00050003 .invalid
|
||||
8044ADD4 00050004 8044DBF4 00050004 8044FC5C 00050004 8044FA24 00050004 8044BB64 00050004 8044BFE4 00050004 8044F8DC 00050004 8044F6DC 00050004 .invalid
|
||||
8044ADD8 00050005 8044DBF8 00050005 8044FC60 00050005 8044FA28 00050005 8044BB68 00050005 8044BFE8 00050005 8044F8E0 00050005 8044F6E0 00050005 .invalid
|
||||
|
||||
"Palette Patch" Part 4 (this disables PBs from overtaking the back palette)
|
||||
Palette
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
801B55F8 38600000 801B5A4C 38600000 801B7BB8 38600000 801B5B18 38600000 801B59E4 38600000 801B59E4 38600000 801B5B7C 38600000 801B6038 38600000 li r3, 0x0000
|
||||
|
||||
"Palette Patch" Part 5 (saves palettes to temp slot 3)
|
||||
Palette
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000B958 906DB93C 8000B958 906DB944 8000B958 906DB964 8000B958 906DB964 8000B958 906DB954 8000B958 906DB954 8000B958 906DB974 8000B958 906DB9B4 stw [r13 - 0x46AC], r3
|
||||
8000B95C 1C63003C 8000B95C 1C63003C 8000B95C 1C63003C 8000B95C 1C63003C 8000B95C 1C63003C 8000B95C 1C63003C 8000B95C 1C63003C 8000B95C 1C63003C mulli r3, r3, 60
|
||||
8000B960 808DB920 8000B960 808DB928 8000B960 808DB948 8000B960 808DB948 8000B960 808DB938 8000B960 808DB938 8000B960 808DB958 8000B960 808DB998 lwz r4, [r13 - 0x46C8]
|
||||
8000B964 3C840001 8000B964 3C840001 8000B964 3C840001 8000B964 3C840001 8000B964 3C840001 8000B964 3C840001 8000B964 3C840001 8000B964 3C840001 addis r4, r4, 0x0001
|
||||
8000B968 38840B80 8000B968 38840B80 8000B968 38840B80 8000B968 38840B80 8000B968 38840B80 8000B968 38840B80 8000B968 38840B80 8000B968 38840B80 addi r4, r4, 0x0B80
|
||||
8000B96C 7C841A14 8000B96C 7C841A14 8000B96C 7C841A14 8000B96C 7C841A14 8000B96C 7C841A14 8000B96C 7C841A14 8000B96C 7C841A14 8000B96C 7C841A14 add r4, r4, r3
|
||||
8000B970 3C608000 8000B970 3C608000 8000B970 3C608000 8000B970 3C608000 8000B970 3C608000 8000B970 3C608000 8000B970 3C608000 8000B970 3C608000 lis r3, 0x8000
|
||||
8000B974 6063CF40 8000B974 6063CF40 8000B974 6063CF40 8000B974 6063CF40 8000B974 6063CF40 8000B974 6063CF40 8000B974 6063CF40 8000B974 6063CF40 ori r3, r3, 0xCF40
|
||||
8000B978 38A0003C 8000B978 38A0003C 8000B978 38A0003C 8000B978 38A0003C 8000B978 38A0003C 8000B978 38A0003C 8000B978 38A0003C 8000B978 38A0003C li r5, 0x003C
|
||||
8000B97C 48002AA1 8000B97C 48002AA1 8000B97C 48002AA1 8000B97C 48002AA1 8000B97C 48002AA1 8000B97C 48002AA1 8000B97C 48002AA1 8000B97C 48002AA1 bl +0x00002AA0 /* 8000E41C */
|
||||
8000B980 481F02F8 8000B980 481F0A04 8000B980 481F18EC 8000B980 481F0F70 8000B980 481F095C 8000B980 481F095C 8000B980 481F11DC 8000B980 481F10D8 b +0x001F095C /* 801FC2DC */
|
||||
8000B984 806DB93C 8000B984 806DB944 8000B984 806DB964 8000B984 806DB964 8000B984 806DB954 8000B984 806DB954 8000B984 806DB974 8000B984 806DB9B4 lwz r3, [r13 - 0x46AC]
|
||||
8000B988 1C63003C 8000B988 1C63003C 8000B988 1C63003C 8000B988 1C63003C 8000B988 1C63003C 8000B988 1C63003C 8000B988 1C63003C 8000B988 1C63003C mulli r3, r3, 60
|
||||
8000B98C 808DB920 8000B98C 808DB928 8000B98C 808DB948 8000B98C 808DB948 8000B98C 808DB938 8000B98C 808DB938 8000B98C 808DB958 8000B98C 808DB998 lwz r4, [r13 - 0x46C8]
|
||||
8000B990 3C840001 8000B990 3C840001 8000B990 3C840001 8000B990 3C840001 8000B990 3C840001 8000B990 3C840001 8000B990 3C840001 8000B990 3C840001 addis r4, r4, 0x0001
|
||||
8000B994 38840B80 8000B994 38840B80 8000B994 38840B80 8000B994 38840B80 8000B994 38840B80 8000B994 38840B80 8000B994 38840B80 8000B994 38840B80 addi r4, r4, 0x0B80
|
||||
8000B998 7C641A14 8000B998 7C641A14 8000B998 7C641A14 8000B998 7C641A14 8000B998 7C641A14 8000B998 7C641A14 8000B998 7C641A14 8000B998 7C641A14 add r3, r4, r3
|
||||
8000B99C 3C808000 8000B99C 3C808000 8000B99C 3C808000 8000B99C 3C808000 8000B99C 3C808000 8000B99C 3C808000 8000B99C 3C808000 8000B99C 3C808000 lis r4, 0x8000
|
||||
8000B9A0 6084CF40 8000B9A0 6084CF40 8000B9A0 6084CF40 8000B9A0 6084CF40 8000B9A0 6084CF40 8000B9A0 6084CF40 8000B9A0 6084CF40 8000B9A0 6084CF40 ori r4, r4, 0xCF40
|
||||
8000B9A4 38A0003C 8000B9A4 38A0003C 8000B9A4 38A0003C 8000B9A4 38A0003C 8000B9A4 38A0003C 8000B9A4 38A0003C 8000B9A4 38A0003C 8000B9A4 38A0003C li r5, 0x003C
|
||||
8000B9A8 48002A75 8000B9A8 48002A75 8000B9A8 48002A75 8000B9A8 48002A75 8000B9A8 48002A75 8000B9A8 48002A75 8000B9A8 48002A75 8000B9A8 48002A75 bl +0x00002A74 /* 8000E41C */
|
||||
8000B9AC 806DB920 8000B9AC 806DB928 8000B9AC 806DB948 8000B9AC 806DB948 8000B9AC 806DB938 8000B9AC 806DB938 8000B9AC 806DB958 8000B9AC 806DB998 lwz r3, [r13 - 0x46C8]
|
||||
8000B9B0 481F3970 8000B9B0 481F41E4 8000B9B0 481F51E0 8000B9B0 481F47B0 8000B9B0 481F416C 8000B9B0 481F416C 8000B9B0 481F4AE4 8000B9B0 481F4A50 b +0x001F416C /* 801FFB1C */
|
||||
8000B9B4 806DB93C 8000B9B4 806DB944 8000B9B4 806DB964 8000B9B4 806DB964 8000B9B4 806DB954 8000B9B4 806DB954 8000B9B4 806DB974 8000B9B4 806DB9B4 lwz r3, [r13 - 0x46AC]
|
||||
8000B9B8 1C63003C 8000B9B8 1C63003C 8000B9B8 1C63003C 8000B9B8 1C63003C 8000B9B8 1C63003C 8000B9B8 1C63003C 8000B9B8 1C63003C 8000B9B8 1C63003C mulli r3, r3, 60
|
||||
8000B9BC 808DB920 8000B9BC 808DB928 8000B9BC 808DB948 8000B9BC 808DB948 8000B9BC 808DB938 8000B9BC 808DB938 8000B9BC 808DB958 8000B9BC 808DB998 lwz r4, [r13 - 0x46C8]
|
||||
8000B9C0 3C840001 8000B9C0 3C840001 8000B9C0 3C840001 8000B9C0 3C840001 8000B9C0 3C840001 8000B9C0 3C840001 8000B9C0 3C840001 8000B9C0 3C840001 addis r4, r4, 0x0001
|
||||
8000B9C4 38840B80 8000B9C4 38840B80 8000B9C4 38840B80 8000B9C4 38840B80 8000B9C4 38840B80 8000B9C4 38840B80 8000B9C4 38840B80 8000B9C4 38840B80 addi r4, r4, 0x0B80
|
||||
8000B9C8 7C641A14 8000B9C8 7C641A14 8000B9C8 7C641A14 8000B9C8 7C641A14 8000B9C8 7C641A14 8000B9C8 7C641A14 8000B9C8 7C641A14 8000B9C8 7C641A14 add r3, r4, r3
|
||||
8000B9CC 38800000 8000B9CC 38800000 8000B9CC 38800000 8000B9CC 38800000 8000B9CC 38800000 8000B9CC 38800000 8000B9CC 38800000 8000B9CC 38800000 li r4, 0x0000
|
||||
8000B9D0 38A0003C 8000B9D0 38A0003C 8000B9D0 38A0003C 8000B9D0 38A0003C 8000B9D0 38A0003C 8000B9D0 38A0003C 8000B9D0 38A0003C 8000B9D0 38A0003C li r5, 0x003C
|
||||
8000B9D4 48002961 8000B9D4 48002961 8000B9D4 48002961 8000B9D4 48002961 8000B9D4 48002961 8000B9D4 48002961 8000B9D4 48002961 8000B9D4 48002961 bl +0x00002960 /* 8000E334 */
|
||||
8000B9D8 48003F71 8000B9D8 48003F75 8000B9D8 48003F75 8000B9D8 48003F25 8000B9D8 48003F71 8000B9D8 48003F71 8000B9D8 48003F25 8000B9D8 48003F99 bl +0x00003F70 /* 8000F948 */
|
||||
8000B9DC 481F2E5C 8000B9DC 481F36D0 8000B9DC 481F4668 8000B9DC 481F3C6C 8000B9DC 481F3658 8000B9DC 481F3658 8000B9DC 481F3FA0 8000B9DC 481F3F3C b +0x001F3658 /* 801FF034 */
|
||||
801FBC74 4BE0FCE4 801FC380 4BE0F5D8 801FD268 4BE0E6F0 801FC8EC 4BE0F06C 801FC2D8 4BE0F680 801FC2D8 4BE0F680 801FCB58 4BE0EE00 801FCA54 4BE0EF04 b -0x001F0980 /* 8000B958 */
|
||||
801FE834 4BE0D180 801FF0A8 4BE0C90C 80200040 4BE0B974 801FF644 4BE0C370 801FF030 4BE0C984 801FF030 4BE0C984 801FF978 4BE0C03C 801FF914 4BE0C0A0 b -0x001F367C /* 8000B9B4 */
|
||||
801FF31C 4BE0C668 801FFB90 4BE0BDF4 80200B8C 4BE0ADF8 8020015C 4BE0B828 801FFB18 4BE0BE6C 801FFB18 4BE0BE6C 80200490 4BE0B4F4 802003FC 4BE0B588 b -0x001F4194 /* 8000B984 */
|
||||
8046CECC FFFFFFFF 8046FCEC FFFFFFFF 80471E4C FFFFFFFF 80471C14 FFFFFFFF 8046DC5C FFFFFFFF 8046E0DC FFFFFFFF 80471ACC FFFFFFFF 80471804 FFFFFFFF fnmadd. f31, f31, f31, f31
|
||||
|
||||
Decoction Patch (makes the Decoction item wipe non-HP/TP materials)
|
||||
Decoction
|
||||
*** name=Decoction
|
||||
*** desc=Make the Decoction\nitem reset your\nmaterial usage
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80350740 880300EE 80351B44 880300EE 803530A0 880300EE 80352E54 880300EE 803515F4 880300EE 80351638 880300EE 80353220 880300EE 80352614 880300EE lbz r0, [r3 + 0x00EE]
|
||||
80350744 2800000B 80351B48 2800000B 803530A4 2800000B 80352E58 2800000B 803515F8 2800000B 8035163C 2800000B 80353224 2800000B 80352618 2800000B cmplwi r0, 11
|
||||
80350748 40820144 80351B4C 40820144 803530A8 40820144 80352E5C 40820144 803515FC 40820144 80351640 40820144 80353228 40820144 8035261C 40820144 bne +0x00000144 /* 80351740 */
|
||||
8035074C 83E300F0 80351B50 83E300F0 803530AC 83E300F0 80352E60 83E300F0 80351600 83E300F0 80351644 83E300F0 8035322C 83E300F0 80352620 83E300F0 lwz r31, [r3 + 0x00F0]
|
||||
80350750 38000000 80351B54 38000000 803530B0 38000000 80352E64 38000000 80351604 38000000 80351648 38000000 80353230 38000000 80352624 38000000 li r0, 0x0000
|
||||
80350754 60000000 80351B58 60000000 803530B4 60000000 80352E68 60000000 80351608 60000000 8035164C 60000000 80353234 60000000 80352628 60000000 nop
|
||||
80350758 38800374 80351B5C 38800374 803530B8 38800374 80352E6C 38800374 8035160C 38800374 80351650 38800374 80353238 38800374 8035262C 38800374 li r4, 0x0374
|
||||
8035075C 38A00D38 80351B60 38A00D38 803530BC 38A00D38 80352E70 38A00D38 80351610 38A00D38 80351654 38A00D38 8035323C 38A00D38 80352630 38A00D38 li r5, 0x0D38
|
||||
80350760 48000059 80351B64 48000059 803530C0 48000059 80352E74 48000059 80351614 48000059 80351658 48000059 80353240 48000059 80352634 48000059 bl +0x00000058 /* 8035166C */
|
||||
80350764 38A00D3A 80351B68 38A00D3A 803530C4 38A00D3A 80352E78 38A00D3A 80351618 38A00D3A 8035165C 38A00D3A 80353244 38A00D3A 80352638 38A00D3A li r5, 0x0D3A
|
||||
80350768 48000051 80351B6C 48000051 803530C8 48000051 80352E7C 48000051 8035161C 48000051 80351660 48000051 80353248 48000051 8035263C 48000051 bl +0x00000050 /* 8035166C */
|
||||
8035076C 38A00D3C 80351B70 38A00D3C 803530CC 38A00D3C 80352E80 38A00D3C 80351620 38A00D3C 80351664 38A00D3C 8035324C 38A00D3C 80352640 38A00D3C li r5, 0x0D3C
|
||||
80350770 48000049 80351B74 48000049 803530D0 48000049 80352E84 48000049 80351624 48000049 80351668 48000049 80353250 48000049 80352644 48000049 bl +0x00000048 /* 8035166C */
|
||||
80350774 38A00D40 80351B78 38A00D40 803530D4 38A00D40 80352E88 38A00D40 80351628 38A00D40 8035166C 38A00D40 80353254 38A00D40 80352648 38A00D40 li r5, 0x0D40
|
||||
80350778 48000041 80351B7C 48000041 803530D8 48000041 80352E8C 48000041 8035162C 48000041 80351670 48000041 80353258 48000041 8035264C 48000041 bl +0x00000040 /* 8035166C */
|
||||
8035077C 38A00D44 80351B80 38A00D44 803530DC 38A00D44 80352E90 38A00D44 80351630 38A00D44 80351674 38A00D44 8035325C 38A00D44 80352650 38A00D44 li r5, 0x0D44
|
||||
80350780 48000039 80351B84 48000039 803530E0 48000039 80352E94 48000039 80351634 48000039 80351678 48000039 80353260 48000039 80352654 48000039 bl +0x00000038 /* 8035166C */
|
||||
80350784 7FE3FB78 80351B88 7FE3FB78 803530E4 7FE3FB78 80352E98 7FE3FB78 80351638 7FE3FB78 8035167C 7FE3FB78 80353264 7FE3FB78 80352658 7FE3FB78 mr r3, r31
|
||||
80350788 4BE656A1 80351B8C 4BE646F1 803530E8 4BE654CD 80352E9C 4BE634AD 8035163C 4BE64BD9 80351680 4BE64B95 80353268 4BE63145 8035265C 4BE6420D bl -0x0019B428 /* 801B6214 */
|
||||
8035078C A01F032C 80351B90 A01F032C 803530EC A01F032C 80352EA0 A01F032C 80351640 A01F032C 80351684 A01F032C 8035326C A01F032C 80352660 A01F032C lhz r0, [r31 + 0x032C]
|
||||
80350790 A07F02B8 80351B94 A07F02B8 803530F0 A07F02B8 80352EA4 A07F02B8 80351644 A07F02B8 80351688 A07F02B8 80353270 A07F02B8 80352664 A07F02B8 lhz r3, [r31 + 0x02B8]
|
||||
80350794 7C001840 80351B98 7C001840 803530F4 7C001840 80352EA8 7C001840 80351648 7C001840 8035168C 7C001840 80353274 7C001840 80352668 7C001840 cmpl r0, r3
|
||||
80350798 40810008 80351B9C 40810008 803530F8 40810008 80352EAC 40810008 8035164C 40810008 80351690 40810008 80353278 40810008 8035266C 40810008 ble +0x00000008 /* 80351654 */
|
||||
8035079C B07F032C 80351BA0 B07F032C 803530FC B07F032C 80352EB0 B07F032C 80351650 B07F032C 80351694 B07F032C 8035327C B07F032C 80352670 B07F032C sth [r31 + 0x032C], r3
|
||||
803507A0 A01F032E 80351BA4 A01F032E 80353100 A01F032E 80352EB4 A01F032E 80351654 A01F032E 80351698 A01F032E 80353280 A01F032E 80352674 A01F032E lhz r0, [r31 + 0x032E]
|
||||
803507A4 A07F02BA 80351BA8 A07F02BA 80353104 A07F02BA 80352EB8 A07F02BA 80351658 A07F02BA 8035169C A07F02BA 80353284 A07F02BA 80352678 A07F02BA lhz r3, [r31 + 0x02BA]
|
||||
803507A8 7C001840 80351BAC 7C001840 80353108 7C001840 80352EBC 7C001840 8035165C 7C001840 803516A0 7C001840 80353288 7C001840 8035267C 7C001840 cmpl r0, r3
|
||||
803507AC 40810008 80351BB0 40810008 8035310C 40810008 80352EC0 40810008 80351660 40810008 803516A4 40810008 8035328C 40810008 80352680 40810008 ble +0x00000008 /* 80351668 */
|
||||
803507B0 B07F032E 80351BB4 B07F032E 80353110 B07F032E 80352EC4 B07F032E 80351664 B07F032E 803516A8 B07F032E 80353290 B07F032E 80352684 B07F032E sth [r31 + 0x032E], r3
|
||||
803507B4 480000D8 80351BB8 480000D8 80353114 480000D8 80352EC8 480000D8 80351668 480000D8 803516AC 480000D8 80353294 480000D8 80352688 480000D8 b +0x000000D8 /* 80351740 */
|
||||
803507B8 7CDF20AE 80351BBC 7CDF20AE 80353118 7CDF20AE 80352ECC 7CDF20AE 8035166C 7CDF20AE 803516B0 7CDF20AE 80353298 7CDF20AE 8035268C 7CDF20AE lbzx r6, [r31 + r4]
|
||||
803507BC 7CFF2A2E 80351BC0 7CFF2A2E 8035311C 7CFF2A2E 80352ED0 7CFF2A2E 80351670 7CFF2A2E 803516B4 7CFF2A2E 8035329C 7CFF2A2E 80352690 7CFF2A2E lhzx r7, [r31 + r5]
|
||||
803507C0 54C6083C 80351BC4 54C6083C 80353120 54C6083C 80352ED4 54C6083C 80351674 54C6083C 803516B8 54C6083C 803532A0 54C6083C 80352694 54C6083C rlwinm r6, r6, 1, 0, 30
|
||||
803507C4 7CE63850 80351BC8 7CE63850 80353124 7CE63850 80352ED8 7CE63850 80351678 7CE63850 803516BC 7CE63850 803532A4 7CE63850 80352698 7CE63850 subf r7, r6, r7
|
||||
803507C8 7CFF2B2E 80351BCC 7CFF2B2E 80353128 7CFF2B2E 80352EDC 7CFF2B2E 8035167C 7CFF2B2E 803516C0 7CFF2B2E 803532A8 7CFF2B2E 8035269C 7CFF2B2E sthx [r31 + r5], r7
|
||||
803507CC 7C1F21AE 80351BD0 7C1F21AE 8035312C 7C1F21AE 80352EE0 7C1F21AE 80351680 7C1F21AE 803516C4 7C1F21AE 803532AC 7C1F21AE 803526A0 7C1F21AE stbx [r31 + r4], r0
|
||||
803507D0 38840001 80351BD4 38840001 80353130 38840001 80352EE4 38840001 80351684 38840001 803516C8 38840001 803532B0 38840001 803526A4 38840001 addi r4, r4, 0x0001
|
||||
803507D4 4E800020 80351BD8 4E800020 80353134 4E800020 80352EE8 4E800020 80351688 4E800020 803516CC 4E800020 803532B4 4E800020 803526A8 4E800020 blr
|
||||
|
||||
"Movement Patch" Part 1 (allows players to move when near objects)
|
||||
Movement
|
||||
*** name=Movement
|
||||
*** desc=Allow backsteps and\nmovement when\nenemies are\nnearby
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
801CF69C 48000014 801CFBB0 48000014 801D1CEC 48000014 801CFC7C 48000014 801CFAE0 48000014 801CFAE0 48000014 801CFCE0 48000014 801D019C 48000014 b +0x00000014 /* 801CFAF4 */
|
||||
|
||||
"Movement Patch" Part 2 (restores backstep functionality on certain movements)
|
||||
Movement
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
801CE7AC 4800000C 801CECC0 4800000C 801D0D10 4800000C 801CED8C 4800000C 801CEBF0 4800000C 801CEBF0 4800000C 801CEDF0 4800000C 801CF2AC 4800000C b +0x0000000C /* 801CEBFC */
|
||||
|
||||
Olga Flow Barta Bug Fix (makes barta work on ice weakness Olga Flow instead of damaging player)
|
||||
BugFixes
|
||||
*** name=Bug fixes
|
||||
*** desc=Fix many minor\ngameplay, sound,\nand graphical bugs
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000D980 807C0000 8000D980 807C0000 8000D980 807C0000 8000D980 807C0000 8000D980 807C0000 8000D980 807C0000 8000D980 807C0000 8000D980 807C0000 lwz r3, [r28]
|
||||
8000D984 2C030013 8000D984 2C030013 8000D984 2C030013 8000D984 2C030013 8000D984 2C030013 8000D984 2C030013 8000D984 2C030013 8000D984 2C030013 cmpwi r3, 19
|
||||
8000D988 40820008 8000D988 40820008 8000D988 40820008 8000D988 40820008 8000D988 40820008 8000D988 40820008 8000D988 40820008 8000D988 40820008 bne +0x00000008 /* 8000D990 */
|
||||
8000D98C 38600002 8000D98C 38600002 8000D98C 38600002 8000D98C 38600002 8000D98C 38600002 8000D98C 38600002 8000D98C 38600002 8000D98C 38600002 li r3, 0x0002
|
||||
8000D990 482ADB24 8000D990 482AEA54 8000D990 482AFB9C 8000D990 482AF934 8000D990 482AE568 8000D990 482AE5AC 8000D990 482AFAE8 8000D990 482AF27C b +0x002AE568 /* 802BBEF8 */
|
||||
802BB4B0 4BD524D0 802BC3E0 4BD515A0 802BD528 4BD50458 802BD2C0 4BD506C0 802BBEF4 4BD51A8C 802BBF38 4BD51A48 802BD474 4BD5050C 802BCC08 4BD50D78 b -0x002AE574 /* 8000D980 */
|
||||
|
||||
Morfos Frozen Player Bug Fix (stops Morfos Laser multi-hitting when player is frozen)
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000D9A0 C042FC78 8000D9A0 C042FC80 8000D9A0 C042FC80 8000D9A0 C042FC80 8000D9A0 C042FC88 8000D9A0 C042FC88 8000D9A0 C042FC88 8000D9A0 C042FC88 lfs f2, [r2 - 0x0378]
|
||||
8000D9A4 807E0030 8000D9A4 807E0030 8000D9A4 807E0030 8000D9A4 807E0030 8000D9A4 807E0030 8000D9A4 807E0030 8000D9A4 807E0030 8000D9A4 807E0030 lwz r3, [r30 + 0x0030]
|
||||
8000D9A8 70630020 8000D9A8 70630020 8000D9A8 70630020 8000D9A8 70630020 8000D9A8 70630020 8000D9A8 70630020 8000D9A8 70630020 8000D9A8 70630020 andi. r3, r3, 0x0020
|
||||
8000D9AC 41820008 8000D9AC 41820008 8000D9AC 41820008 8000D9AC 41820008 8000D9AC 41820008 8000D9AC 41820008 8000D9AC 41820008 8000D9AC 41820008 beq +0x00000008 /* 8000D9B4 */
|
||||
8000D9B0 C042FC90 8000D9B0 C042FC98 8000D9B0 C042FC98 8000D9B0 C042FC98 8000D9B0 C042FCA0 8000D9B0 C042FCA0 8000D9B0 C042FCA0 8000D9B0 C042FCA0 lfs f2, [r2 - 0x0360]
|
||||
8000D9B4 483276B0 8000D9B4 4832871C 8000D9B4 48329C38 8000D9B4 483299EC 8000D9B4 483280A0 8000D9B4 483280E4 8000D9B4 48329BC0 8000D9B4 48329004 b +0x003280A0 /* 80335A54 */
|
||||
80335060 4BCD8940 803360CC 4BCD78D4 803375E8 4BCD63B8 8033739C 4BCD6604 80335A50 4BCD7F50 80335A94 4BCD7F0C 80337570 4BCD6430 803369B4 4BCD6FEC b -0x003280B0 /* 8000D9A0 */
|
||||
|
||||
Tiny Grass Assassins Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
800BC750 48000010 800BCA58 48000010 800BCBD0 48000010 800BCB80 48000010 800BC9E8 48000010 800BC9E8 48000010 800BCB90 48000010 800BCB58 48000010 b +0x00000010 /* 800BC9F8 */
|
||||
|
||||
Bulclaw HP Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80091528 4800024D 80091814 4800024D 8009198C 4800024D 8009193C 4800024D 800917B4 4800024D 800917B4 4800024D 8009194C 4800024D 80091914 4800024D bl +0x0000024C /* 80091A00 */
|
||||
8009152C B3C3032C 80091818 B3C3032C 80091990 B3C3032C 80091940 B3C3032C 800917B8 B3C3032C 800917B8 B3C3032C 80091950 B3C3032C 80091918 B3C3032C sth [r3 + 0x032C], r30
|
||||
|
||||
Control Tower: Delbiter Death SFX Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80301600 48000020 803025CC 48000020 80303A1C 48000020 803037D0 48000020 80301F58 48000020 80301F9C 48000020 8030398C 48000020 80302D64 48000020 b +0x00000020 /* 80301F78 */
|
||||
80301604 3863A830 803025D0 3863A830 80303A20 3863A830 803037D4 3863A830 80301F5C 3863A830 80301FA0 3863A830 80303990 3863A830 80302D68 3863A830 subi r3, r3, 0x57D0
|
||||
80301608 800DB98C 803025D4 800DB994 80303A24 800DB9B4 803037D8 800DB9B4 80301F60 800DB9A4 80301FA4 800DB9A4 80303994 800DB9C4 80302D6C 800DBA04 lwz r0, [r13 - 0x465C]
|
||||
8030160C 2C000023 803025D8 2C000023 80303A28 2C000023 803037DC 2C000023 80301F64 2C000023 80301FA8 2C000023 80303998 2C000023 80302D70 2C000023 cmpwi r0, 35
|
||||
80301610 40820008 803025DC 40820008 80303A2C 40820008 803037E0 40820008 80301F68 40820008 80301FAC 40820008 8030399C 40820008 80302D74 40820008 bne +0x00000008 /* 80301F70 */
|
||||
80301614 3863FB28 803025E0 3863FB28 80303A30 3863FB28 803037E4 3863FB28 80301F6C 3863FB28 80301FB0 3863FB28 803039A0 3863FB28 80302D78 3863FB28 subi r3, r3, 0x04D8
|
||||
80301618 4800008C 803025E4 4800008C 80303A34 4800008C 803037E8 4800008C 80301F70 4800008C 80301FB4 4800008C 803039A4 4800008C 80302D7C 4800008C b +0x0000008C /* 80301FFC */
|
||||
803016A0 4BFFFF64 8030266C 4BFFFF64 80303ABC 4BFFFF64 80303870 4BFFFF64 80301FF8 4BFFFF64 8030203C 4BFFFF64 80303A2C 4BFFFF64 80302E04 4BFFFF64 b -0x0000009C /* 80301F5C */
|
||||
|
||||
Weapon Attributes Patch (allows attributes to work on minibosses and Olga Flow)
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000C8C0 7000000F 8000C8C0 7000000F 8000C8C0 7000000F 8000C8C0 7000000F 8000C8C0 7000000F 8000C8C0 7000000F 8000C8C0 7000000F 8000C8C0 7000000F andi. r0, r0, 0x000F
|
||||
8000C8C4 7000004F 8000C8C4 7000004F 8000C8C4 7000004F 8000C8C4 7000004F 8000C8C4 7000004F 8000C8C4 7000004F 8000C8C4 7000004F 8000C8C4 7000004F andi. r0, r0, 0x004F
|
||||
8000C8C8 2C000004 8000C8C8 2C000004 8000C8C8 2C000004 8000C8C8 2C000004 8000C8C8 2C000004 8000C8C8 2C000004 8000C8C8 2C000004 8000C8C8 2C000004 cmpwi r0, 4
|
||||
8000C8CC 4E800020 8000C8CC 4E800020 8000C8CC 4E800020 8000C8CC 4E800020 8000C8CC 4E800020 8000C8CC 4E800020 8000C8CC 4E800020 8000C8CC 4E800020 blr
|
||||
800142DC 4BFF85E5 8001430C 4BFF85B5 800146A4 4BFF821D 800142BC 4BFF8605 800142F4 4BFF85CD 800142F4 4BFF85CD 800142BC 4BFF8605 80014334 4BFF858D bl -0x00007A34 /* 8000C8C0 */
|
||||
80015D04 4BFF6BC1 80015D34 4BFF6B91 80016174 4BFF6751 80015CE4 4BFF6BE1 80015D1C 4BFF6BA9 80015D1C 4BFF6BA9 80015CE4 4BFF6BE1 80015D5C 4BFF6B69 bl -0x00009458 /* 8000C8C4 */
|
||||
|
||||
Ruins Laser Fence SFX Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80166324 3C604005 801666D8 3C604005 80166848 3C604005 8016679C 3C604005 801666E0 3C604005 801666E0 3C604005 80166800 3C604005 80166CC4 3C604005 lis r3, 0x4005
|
||||
80166328 4800009C 801666DC 4800009C 8016684C 4800009C 801667A0 4800009C 801666E4 4800009C 801666E4 4800009C 80166804 4800009C 80166CC8 4800009C b +0x0000009C /* 80166780 */
|
||||
801663C0 4800001C 80166774 4800001C 801668E4 4800001C 80166838 4800001C 8016677C 4800001C 8016677C 4800001C 8016689C 4800001C 80166D60 4800001C b +0x0000001C /* 80166798 */
|
||||
|
||||
SFX Cancellation Distance Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
805CB608 46AFC800 805D5C08 46AFC800 805DD0A8 46AFC800 805DCE48 46AFC800 805CBF10 46AFC800 805D2F30 46AFC800 805DC750 46AFC800 805D8990 46AFC800 .invalid sc
|
||||
805CB8A8 43480000 805D5EA8 43480000 805DD348 43480000 805DD0E8 43480000 805CC1B0 43480000 805D31D0 43480000 805DC9F0 43480000 805D8C30 43480000 bc 26, 8, +0x00000000 /* 805CC1B0 */
|
||||
|
||||
Foie SFX Pitch Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8022E2A8 3880FF00 8022EC44 3880FF00 8022FB30 3880FF00 8022F8E4 3880FF00 8022EB64 3880FF00 8022EB64 3880FF00 8022FC18 3880FF00 8022F4B0 3880FF00 li r4, 0xFFFFFF00
|
||||
8022E2D8 3880FE80 8022EC74 3880FE80 8022FB60 3880FE80 8022F914 3880FE80 8022EB94 3880FE80 8022EB94 3880FE80 8022FC48 3880FE80 8022F4E0 3880FE80 li r4, 0xFFFFFE80
|
||||
8022E308 3880FDB0 8022ECA4 3880FDB0 8022FB90 3880FDB0 8022F944 3880FDB0 8022EBC4 3880FDB0 8022EBC4 3880FDB0 8022FC78 3880FDB0 8022F510 3880FDB0 li r4, 0xFFFFFDB0
|
||||
|
||||
Gifoie SFX Pitch Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
802300B8 3880FF00 80230A54 3880FF00 80231940 3880FF00 802316F4 3880FF00 80230974 3880FF00 80230974 3880FF00 80231A28 3880FF00 802312C0 3880FF00 li r4, 0xFFFFFF00
|
||||
802300E8 3880FE80 80230A84 3880FE80 80231970 3880FE80 80231724 3880FE80 802309A4 3880FE80 802309A4 3880FE80 80231A58 3880FE80 802312F0 3880FE80 li r4, 0xFFFFFE80
|
||||
80230118 3880FDB0 80230AB4 3880FDB0 802319A0 3880FDB0 80231754 3880FDB0 802309D4 3880FDB0 802309D4 3880FDB0 80231A88 3880FDB0 80231320 3880FDB0 li r4, 0xFFFFFDB0
|
||||
|
||||
Rafoie SFX Pitch Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
802365AC 3880FF00 80236F68 3880FF00 80237E54 3880FF00 80237C08 3880FF00 80236E88 3880FF00 80236E88 3880FF00 80237F3C 3880FF00 802377D4 3880FF00 li r4, 0xFFFFFF00
|
||||
802365DC 3880FE80 80236F98 3880FE80 80237E84 3880FE80 80237C38 3880FE80 80236EB8 3880FE80 80236EB8 3880FE80 80237F6C 3880FE80 80237804 3880FE80 li r4, 0xFFFFFE80
|
||||
8023660C 3880FDB0 80236FC8 3880FDB0 80237EB4 3880FDB0 80237C68 3880FDB0 80236EE8 3880FDB0 80236EE8 3880FDB0 80237F9C 3880FDB0 80237834 3880FDB0 li r4, 0xFFFFFDB0
|
||||
80236FC0 3880FF00 8023797C 3880FF00 80238868 3880FF00 8023861C 3880FF00 8023789C 3880FF00 8023789C 3880FF00 80238950 3880FF00 802381E8 3880FF00 li r4, 0xFFFFFF00
|
||||
80236FF0 3880FE80 802379AC 3880FE80 80238898 3880FE80 8023864C 3880FE80 802378CC 3880FE80 802378CC 3880FE80 80238980 3880FE80 80238218 3880FE80 li r4, 0xFFFFFE80
|
||||
80237020 3880FDB0 802379DC 3880FDB0 802388C8 3880FDB0 8023867C 3880FDB0 802378FC 3880FDB0 802378FC 3880FDB0 802389B0 3880FDB0 80238248 3880FDB0 li r4, 0xFFFFFDB0
|
||||
|
||||
Barta SFX Pitch Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80229B54 3880FF00 8022A4F0 3880FF00 8022B3E0 3880FF00 8022B190 3880FF00 8022A410 3880FF00 8022A410 3880FF00 8022B4C4 3880FF00 8022AD5C 3880FF00 li r4, 0xFFFFFF00
|
||||
80229B84 3880FE80 8022A520 3880FE80 8022B410 3880FE80 8022B1C0 3880FE80 8022A440 3880FE80 8022A440 3880FE80 8022B4F4 3880FE80 8022AD8C 3880FE80 li r4, 0xFFFFFE80
|
||||
80229BB4 3880FDB0 8022A550 3880FDB0 8022B440 3880FDB0 8022B1F0 3880FDB0 8022A470 3880FDB0 8022A470 3880FDB0 8022B524 3880FDB0 8022ADBC 3880FDB0 li r4, 0xFFFFFDB0
|
||||
|
||||
Gibarta SFX Pitch Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8022EAB4 3880FF00 8022F450 3880FF00 80230340 3880FF00 802300F0 3880FF00 8022F370 3880FF00 8022F370 3880FF00 80230424 3880FF00 8022FCBC 3880FF00 li r4, 0xFFFFFF00
|
||||
8022EAE4 3880FE80 8022F480 3880FE80 80230370 3880FE80 80230120 3880FE80 8022F3A0 3880FE80 8022F3A0 3880FE80 80230454 3880FE80 8022FCEC 3880FE80 li r4, 0xFFFFFE80
|
||||
8022EB14 3880FDB0 8022F4B0 3880FDB0 802303A0 3880FDB0 80230150 3880FDB0 8022F3D0 3880FDB0 8022F3D0 3880FDB0 80230484 3880FDB0 8022FD1C 3880FDB0 li r4, 0xFFFFFDB0
|
||||
|
||||
Rabarta SFX Pitch Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80235DD4 3880FF00 80236790 3880FF00 8023767C 3880FF00 80237430 3880FF00 802366B0 3880FF00 802366B0 3880FF00 80237764 3880FF00 80236FFC 3880FF00 li r4, 0xFFFFFF00
|
||||
80235E10 3880FE80 802367CC 3880FE80 802376B8 3880FE80 8023746C 3880FE80 802366EC 3880FE80 802366EC 3880FE80 802377A0 3880FE80 80237038 3880FE80 li r4, 0xFFFFFE80
|
||||
80235E4C 3880FDB0 80236808 3880FDB0 802376F4 3880FDB0 802374A8 3880FDB0 80236728 3880FDB0 80236728 3880FDB0 802377DC 3880FDB0 80237074 3880FDB0 li r4, 0xFFFFFDB0
|
||||
|
||||
Zonde SFX Pitch Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8023B2C8 3880FF00 8023BC84 3880FF00 8023CB70 3880FF00 8023C924 3880FF00 8023BBA4 3880FF00 8023BBA4 3880FF00 8023CC58 3880FF00 8023C4F0 3880FF00 li r4, 0xFFFFFF00
|
||||
8023B2F8 3880FE80 8023BCB4 3880FE80 8023CBA0 3880FE80 8023C954 3880FE80 8023BBD4 3880FE80 8023BBD4 3880FE80 8023CC88 3880FE80 8023C520 3880FE80 li r4, 0xFFFFFE80
|
||||
8023B328 3880FDB0 8023BCE4 3880FDB0 8023CBD0 3880FDB0 8023C984 3880FDB0 8023BC04 3880FDB0 8023BC04 3880FDB0 8023CCB8 3880FDB0 8023C550 3880FDB0 li r4, 0xFFFFFDB0
|
||||
|
||||
Gizonde SFX Pitch Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80230E08 3880FF00 802317C4 3880FF00 802326B0 3880FF00 80232464 3880FF00 802316E4 3880FF00 802316E4 3880FF00 80232798 3880FF00 80232030 3880FF00 li r4, 0xFFFFFF00
|
||||
80230E38 3880FE80 802317F4 3880FE80 802326E0 3880FE80 80232494 3880FE80 80231714 3880FE80 80231714 3880FE80 802327C8 3880FE80 80232060 3880FE80 li r4, 0xFFFFFE80
|
||||
80230E68 3880FDB0 80231824 3880FDB0 80232710 3880FDB0 802324C4 3880FDB0 80231744 3880FDB0 80231744 3880FDB0 802327F8 3880FDB0 80232090 3880FDB0 li r4, 0xFFFFFDB0
|
||||
|
||||
Razonde SFX Pitch Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80237998 3880FF00 80238354 3880FF00 80239240 3880FF00 80238FF4 3880FF00 80238274 3880FF00 80238274 3880FF00 80239328 3880FF00 80238BC0 3880FF00 li r4, 0xFFFFFF00
|
||||
802379C8 3880FE80 80238384 3880FE80 80239270 3880FE80 80239024 3880FE80 802382A4 3880FE80 802382A4 3880FE80 80239358 3880FE80 80238BF0 3880FE80 li r4, 0xFFFFFE80
|
||||
802379F8 3880FDB0 802383B4 3880FDB0 802392A0 3880FDB0 80239054 3880FDB0 802382D4 3880FDB0 802382D4 3880FDB0 80239388 3880FDB0 80238C20 3880FDB0 li r4, 0xFFFFFDB0
|
||||
|
||||
Grants SFX Pitch Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
802316FC 3880FF00 802320B8 3880FF00 80232FA4 3880FF00 80232D58 3880FF00 80231FD8 3880FF00 80231FD8 3880FF00 8023308C 3880FF00 80232924 3880FF00 li r4, 0xFFFFFF00
|
||||
80231734 3880FE80 802320F0 3880FE80 80232FDC 3880FE80 80232D90 3880FE80 80232010 3880FE80 80232010 3880FE80 802330C4 3880FE80 8023295C 3880FE80 li r4, 0xFFFFFE80
|
||||
8023176C 3880FDB0 80232128 3880FDB0 80233014 3880FDB0 80232DC8 3880FDB0 80232048 3880FDB0 80232048 3880FDB0 802330FC 3880FDB0 80232994 3880FDB0 li r4, 0xFFFFFDB0
|
||||
|
||||
Megid SFX Pitch Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
802337A8 3880FF00 80234164 3880FF00 80235050 3880FF00 80234E04 3880FF00 80234084 3880FF00 80234084 3880FF00 80235138 3880FF00 802349D0 3880FF00 li r4, 0xFFFFFF00
|
||||
802337D8 3880FE80 80234194 3880FE80 80235080 3880FE80 80234E34 3880FE80 802340B4 3880FE80 802340B4 3880FE80 80235168 3880FE80 80234A00 3880FE80 li r4, 0xFFFFFE80
|
||||
80233808 3880FDB0 802341C4 3880FDB0 802350B0 3880FDB0 80234E64 3880FDB0 802340E4 3880FDB0 802340E4 3880FDB0 80235198 3880FDB0 80234A30 3880FDB0 li r4, 0xFFFFFDB0
|
||||
|
||||
Anti SFX Pitch Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80229354 2C000001 80229CF0 2C000001 8022ABDC 2C000001 8022A990 2C000001 80229C10 2C000001 80229C10 2C000001 8022ACC4 2C000001 8022A55C 2C000001 cmpwi r0, 1
|
||||
|
||||
Shield DFP/EVP Bug Fix (allows shields to reach true max DFP/EVP values)
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
801185B0 88040016 801187CC 88040016 8011885C 88040016 80118764 88040016 80118854 88040016 80118854 88040016 80118774 88040016 8011894C 88040016 lbz r0, [r4 + 0x0016]
|
||||
801185BC 88040017 801187D8 88040017 80118868 88040017 80118770 88040017 80118860 88040017 80118860 88040017 80118780 88040017 80118958 88040017 lbz r0, [r4 + 0x0017]
|
||||
|
||||
VR Spaceship Item Drop Bug Fix (allows items to drop from enemies above a certain Y position)
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
805C996C 435C0000 805D3F6C 435C0000 805DB40C 435C0000 805DB1AC 435C0000 805CA274 435C0000 805D1294 435C0000 805DAAB4 435C0000 805D6CF4 435C0000 bc 26, 28, +0x00000000 /* 805CA274 */
|
||||
|
||||
Invalid Items Bug Fix (something to do with making invalid items correctly display as ???? I think)
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8011CA90 7C030378 8011CCD4 7C030378 8011CD0C 7C030378 8011CC6C 7C030378 8011CD34 7C030378 8011CD34 7C030378 8011CC7C 7C030378 8011CE54 7C030378 mr r3, r0
|
||||
8011CA94 3863FFFF 8011CCD8 3863FFFF 8011CD10 3863FFFF 8011CC70 3863FFFF 8011CD38 3863FFFF 8011CD38 3863FFFF 8011CC80 3863FFFF 8011CE58 3863FFFF subi r3, r3, 0x0001
|
||||
8011CA98 4BFFFFE8 8011CCDC 4BFFFFE8 8011CD14 4BFFFFE8 8011CC74 4BFFFFE8 8011CD3C 4BFFFFE8 8011CD3C 4BFFFFE8 8011CC84 4BFFFFE8 8011CE5C 4BFFFFE8 b -0x00000018 /* 8011CD24 */
|
||||
8011CB4C 7C030378 8011CD90 7C030378 8011CDC8 7C030378 8011CD28 7C030378 8011CDF0 7C030378 8011CDF0 7C030378 8011CD38 7C030378 8011CF10 7C030378 mr r3, r0
|
||||
8011CB50 3863FFFF 8011CD94 3863FFFF 8011CDCC 3863FFFF 8011CD2C 3863FFFF 8011CDF4 3863FFFF 8011CDF4 3863FFFF 8011CD3C 3863FFFF 8011CF14 3863FFFF subi r3, r3, 0x0001
|
||||
8011CB54 4BFFFFE8 8011CD98 4BFFFFE8 8011CDD0 4BFFFFE8 8011CD30 4BFFFFE8 8011CDF8 4BFFFFE8 8011CDF8 4BFFFFE8 8011CD40 4BFFFFE8 8011CF18 4BFFFFE8 b -0x00000018 /* 8011CDE0 */
|
||||
8011CB9C 7C040378 8011CDE0 7C040378 8011CE18 7C040378 8011CD78 7C040378 8011CE40 7C040378 8011CE40 7C040378 8011CD88 7C040378 8011CF60 7C040378 mr r4, r0
|
||||
8011CBA0 3884FFFF 8011CDE4 3884FFFF 8011CE1C 3884FFFF 8011CD7C 3884FFFF 8011CE44 3884FFFF 8011CE44 3884FFFF 8011CD8C 3884FFFF 8011CF64 3884FFFF subi r4, r4, 0x0001
|
||||
8011CBA4 4BFFFFE8 8011CDE8 4BFFFFE8 8011CE20 4BFFFFE8 8011CD80 4BFFFFE8 8011CE48 4BFFFFE8 8011CE48 4BFFFFE8 8011CD90 4BFFFFE8 8011CF68 4BFFFFE8 b -0x00000018 /* 8011CE30 */
|
||||
|
||||
Item Removal Maxed Stats Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000B088 7FA3EB78 8000B088 7FA3EB78 8000B088 7FA3EB78 8000B088 7FA3EB78 8000B088 7FA3EB78 8000B088 7FA3EB78 8000B088 7FA3EB78 8000B088 7FA3EB78 mr r3, r29
|
||||
8000B08C 38800000 8000B08C 38800000 8000B08C 38800000 8000B08C 38800000 8000B08C 38800000 8000B08C 38800000 8000B08C 38800000 8000B08C 38800000 li r4, 0x0000
|
||||
8000B090 481AE725 8000B090 481AEB91 8000B090 481B1C09 8000B090 481AEC5D 8000B090 481AEB11 8000B090 481AEB11 8000B090 481AECC1 8000B090 481AF17D bl +0x001AEB10 /* 801B9BA0 */
|
||||
8000B094 7FA3EB78 8000B094 7FA3EB78 8000B094 7FA3EB78 8000B094 7FA3EB78 8000B094 7FA3EB78 8000B094 7FA3EB78 8000B094 7FA3EB78 8000B094 7FA3EB78 mr r3, r29
|
||||
8000B098 481AE9F4 8000B098 481AEE60 8000B098 481B1ED8 8000B098 481AEF2C 8000B098 481AEDE0 8000B098 481AEDE0 8000B098 481AEF90 8000B098 481AF44C b +0x001AEDE0 /* 801B9E78 */
|
||||
8000B09C 881F0000 8000B09C 881F0000 8000B09C 881F0000 8000B09C 881F0000 8000B09C 881F0000 8000B09C 881F0000 8000B09C 881F0000 8000B09C 881F0000 lbz r0, [r31]
|
||||
8000B0A0 28090001 8000B0A0 28090001 8000B0A0 28090001 8000B0A0 28090001 8000B0A0 28090001 8000B0A0 28090001 8000B0A0 28090001 8000B0A0 28090001 cmplwi r9, 1
|
||||
8000B0A4 4082000C 8000B0A4 4082000C 8000B0A4 4082000C 8000B0A4 4082000C 8000B0A4 4082000C 8000B0A4 4082000C 8000B0A4 4082000C 8000B0A4 4082000C bne +0x0000000C /* 8000B0B0 */
|
||||
8000B0A8 881F0001 8000B0A8 881F0001 8000B0A8 881F0001 8000B0A8 881F0001 8000B0A8 881F0001 8000B0A8 881F0001 8000B0A8 881F0001 8000B0A8 881F0001 lbz r0, [r31 + 0x0001]
|
||||
8000B0AC 3BFF0002 8000B0AC 3BFF0002 8000B0AC 3BFF0002 8000B0AC 3BFF0002 8000B0AC 3BFF0002 8000B0AC 3BFF0002 8000B0AC 3BFF0002 8000B0AC 3BFF0002 addi r31, r31, 0x0002
|
||||
8000B0B0 481008C4 8000B0B0 48100AC4 8000B0B0 48100B58 8000B0B0 48100A44 8000B0B0 48100B68 8000B0B0 48100B68 8000B0B0 48100A54 8000B0B0 48100C44 b +0x00100B68 /* 8010BC18 */
|
||||
8000B0B4 39200000 8000B0B4 39200000 8000B0B4 39200000 8000B0B4 39200000 8000B0B4 39200000 8000B0B4 39200000 8000B0B4 39200000 8000B0B4 39200000 li r9, 0x0000
|
||||
8000B0B8 48100855 8000B0B8 48100A55 8000B0B8 48100AE9 8000B0B8 481009D5 8000B0B8 48100AF9 8000B0B8 48100AF9 8000B0B8 481009E5 8000B0B8 48100BD5 bl +0x00100AF8 /* 8010BBB0 */
|
||||
8000B0BC 7F43D378 8000B0BC 7F43D378 8000B0BC 7F43D378 8000B0BC 7F43D378 8000B0BC 7F43D378 8000B0BC 7F43D378 8000B0BC 7F43D378 8000B0BC 7F43D378 mr r3, r26
|
||||
8000B0C0 7F64DB78 8000B0C0 7F64DB78 8000B0C0 7F64DB78 8000B0C0 7F64DB78 8000B0C0 7F64DB78 8000B0C0 7F64DB78 8000B0C0 7F64DB78 8000B0C0 7F64DB78 mr r4, r27
|
||||
8000B0C4 7F85E378 8000B0C4 7F85E378 8000B0C4 7F85E378 8000B0C4 7F85E378 8000B0C4 7F85E378 8000B0C4 7F85E378 8000B0C4 7F85E378 8000B0C4 7F85E378 mr r5, r28
|
||||
8000B0C8 7FA6EB78 8000B0C8 7FA6EB78 8000B0C8 7FA6EB78 8000B0C8 7FA6EB78 8000B0C8 7FA6EB78 8000B0C8 7FA6EB78 8000B0C8 7FA6EB78 8000B0C8 7FA6EB78 mr r6, r29
|
||||
8000B0CC 7FC7F378 8000B0CC 7FC7F378 8000B0CC 7FC7F378 8000B0CC 7FC7F378 8000B0CC 7FC7F378 8000B0CC 7FC7F378 8000B0CC 7FC7F378 8000B0CC 7FC7F378 mr r7, r30
|
||||
8000B0D0 7FE8FB78 8000B0D0 7FE8FB78 8000B0D0 7FE8FB78 8000B0D0 7FE8FB78 8000B0D0 7FE8FB78 8000B0D0 7FE8FB78 8000B0D0 7FE8FB78 8000B0D0 7FE8FB78 mr r8, r31
|
||||
8000B0D4 39200001 8000B0D4 39200001 8000B0D4 39200001 8000B0D4 39200001 8000B0D4 39200001 8000B0D4 39200001 8000B0D4 39200001 8000B0D4 39200001 li r9, 0x0001
|
||||
8000B0D8 48100835 8000B0D8 48100A35 8000B0D8 48100AC9 8000B0D8 481009B5 8000B0D8 48100AD9 8000B0D8 48100AD9 8000B0D8 481009C5 8000B0D8 48100BB5 bl +0x00100AD8 /* 8010BBB0 */
|
||||
8000B0DC 48102CC0 8000B0DC 48102EC0 8000B0DC 4810300C 8000B0DC 48102E4C 8000B0DC 48102F64 8000B0DC 48102F64 8000B0DC 48102E5C 8000B0DC 48103040 b +0x00102F64 /* 8010E040 */
|
||||
8000C3F8 28040000 8000C3F8 28040000 8000C3F8 28040000 8000C3F8 28040000 8000C3F8 28040000 8000C3F8 28040000 8000C3F8 28040000 8000C3F8 28040000 cmplwi r4, 0
|
||||
8000C3FC 4D820020 8000C3FC 4D820020 8000C3FC 4D820020 8000C3FC 4D820020 8000C3FC 4D820020 8000C3FC 4D820020 8000C3FC 4D820020 8000C3FC 4D820020 beqlr
|
||||
8000C400 9421FFF0 8000C400 9421FFF0 8000C400 9421FFF0 8000C400 9421FFF0 8000C400 9421FFF0 8000C400 9421FFF0 8000C400 9421FFF0 8000C400 9421FFF0 stwu [r1 - 0x0010], r1
|
||||
8000C404 481AD3B4 8000C404 481AD820 8000C404 481B0898 8000C404 481AD8EC 8000C404 481AD7A0 8000C404 481AD7A0 8000C404 481AD950 8000C404 481ADE0C b +0x001AD7A0 /* 801B9BA4 */
|
||||
8000C408 9421FFE0 8000C408 9421FFE0 8000C408 9421FFE0 8000C408 9421FFE0 8000C408 9421FFE0 8000C408 9421FFE0 8000C408 9421FFE0 8000C408 9421FFE0 stwu [r1 - 0x0020], r1
|
||||
8000C40C 7C0802A6 8000C40C 7C0802A6 8000C40C 7C0802A6 8000C40C 7C0802A6 8000C40C 7C0802A6 8000C40C 7C0802A6 8000C40C 7C0802A6 8000C40C 7C0802A6 mflr r0
|
||||
8000C410 90010024 8000C410 90010024 8000C410 90010024 8000C410 90010024 8000C410 90010024 8000C410 90010024 8000C410 90010024 8000C410 90010024 stw [r1 + 0x0024], r0
|
||||
8000C414 BF410008 8000C414 BF410008 8000C414 BF410008 8000C414 BF410008 8000C414 BF410008 8000C414 BF410008 8000C414 BF410008 8000C414 BF410008 stmw [r1 + 0x0008], r26
|
||||
8000C418 7C7F1B78 8000C418 7C7F1B78 8000C418 7C7F1B78 8000C418 7C7F1B78 8000C418 7C7F1B78 8000C418 7C7F1B78 8000C418 7C7F1B78 8000C418 7C7F1B78 mr r31, r3
|
||||
8000C41C 4BFFFFDD 8000C41C 4BFFFFDD 8000C41C 4BFFFFDD 8000C41C 4BFFFFDD 8000C41C 4BFFFFDD 8000C41C 4BFFFFDD 8000C41C 4BFFFFDD 8000C41C 4BFFFFDD bl -0x00000024 /* 8000C3F8 */
|
||||
8000C420 3BC00000 8000C420 3BC00000 8000C420 3BC00000 8000C420 3BC00000 8000C420 3BC00000 8000C420 3BC00000 8000C420 3BC00000 8000C420 3BC00000 li r30, 0x0000
|
||||
8000C424 3BBF0D04 8000C424 3BBF0D04 8000C424 3BBF0D04 8000C424 3BBF0D04 8000C424 3BBF0D04 8000C424 3BBF0D04 8000C424 3BBF0D04 8000C424 3BBF0D04 addi r29, r31, 0x0D04
|
||||
8000C428 837F032C 8000C428 837F032C 8000C428 837F032C 8000C428 837F032C 8000C428 837F032C 8000C428 837F032C 8000C428 837F032C 8000C428 837F032C lwz r27, [r31 + 0x032C]
|
||||
8000C42C 839D0000 8000C42C 839D0000 8000C42C 839D0000 8000C42C 839D0000 8000C42C 839D0000 8000C42C 839D0000 8000C42C 839D0000 8000C42C 839D0000 lwz r28, [r29]
|
||||
8000C430 7F83E379 8000C430 7F83E379 8000C430 7F83E379 8000C430 7F83E379 8000C430 7F83E379 8000C430 7F83E379 8000C430 7F83E379 8000C430 7F83E379 mr. r3, r28
|
||||
8000C434 41820018 8000C434 41820018 8000C434 41820018 8000C434 41820018 8000C434 41820018 8000C434 41820018 8000C434 41820018 8000C434 41820018 beq +0x00000018 /* 8000C44C */
|
||||
8000C438 38800001 8000C438 38800001 8000C438 38800001 8000C438 38800001 8000C438 38800001 8000C438 38800001 8000C438 38800001 8000C438 38800001 li r4, 0x0001
|
||||
8000C43C 480FEADD 8000C43C 480FECDD 8000C43C 480FEDC9 8000C43C 480FEC5D 8000C43C 480FED81 8000C43C 480FED81 8000C43C 480FEC6D 8000C43C 480FEE5D bl +0x000FED80 /* 8010B1BC */
|
||||
8000C440 7F83E378 8000C440 7F83E378 8000C440 7F83E378 8000C440 7F83E378 8000C440 7F83E378 8000C440 7F83E378 8000C440 7F83E378 8000C440 7F83E378 mr r3, r28
|
||||
8000C444 38800001 8000C444 38800001 8000C444 38800001 8000C444 38800001 8000C444 38800001 8000C444 38800001 8000C444 38800001 8000C444 38800001 li r4, 0x0001
|
||||
8000C448 480FEC4D 8000C448 480FEE4D 8000C448 480FEF49 8000C448 480FEDCD 8000C448 480FEEF1 8000C448 480FEEF1 8000C448 480FEDDD 8000C448 480FEFCD bl +0x000FEEF0 /* 8010B338 */
|
||||
8000C44C 3BBD0004 8000C44C 3BBD0004 8000C44C 3BBD0004 8000C44C 3BBD0004 8000C44C 3BBD0004 8000C44C 3BBD0004 8000C44C 3BBD0004 8000C44C 3BBD0004 addi r29, r29, 0x0004
|
||||
8000C450 3BDE0001 8000C450 3BDE0001 8000C450 3BDE0001 8000C450 3BDE0001 8000C450 3BDE0001 8000C450 3BDE0001 8000C450 3BDE0001 8000C450 3BDE0001 addi r30, r30, 0x0001
|
||||
8000C454 2C1E000D 8000C454 2C1E000D 8000C454 2C1E000D 8000C454 2C1E000D 8000C454 2C1E000D 8000C454 2C1E000D 8000C454 2C1E000D 8000C454 2C1E000D cmpwi r30, 13
|
||||
8000C458 4180FFD4 8000C458 4180FFD4 8000C458 4180FFD4 8000C458 4180FFD4 8000C458 4180FFD4 8000C458 4180FFD4 8000C458 4180FFD4 8000C458 4180FFD4 blt -0x0000002C /* 8000C42C */
|
||||
8000C45C 937F032C 8000C45C 937F032C 8000C45C 937F032C 8000C45C 937F032C 8000C45C 937F032C 8000C45C 937F032C 8000C45C 937F032C 8000C45C 937F032C stw [r31 + 0x032C], r27
|
||||
8000C460 BB410008 8000C460 BB410008 8000C460 BB410008 8000C460 BB410008 8000C460 BB410008 8000C460 BB410008 8000C460 BB410008 8000C460 BB410008 lmw r26, [r1 + 0x0008]
|
||||
8000C464 80010024 8000C464 80010024 8000C464 80010024 8000C464 80010024 8000C464 80010024 8000C464 80010024 8000C464 80010024 8000C464 80010024 lwz r0, [r1 + 0x0024]
|
||||
8000C468 7C0803A6 8000C468 7C0803A6 8000C468 7C0803A6 8000C468 7C0803A6 8000C468 7C0803A6 8000C468 7C0803A6 8000C468 7C0803A6 8000C468 7C0803A6 mtlr r0
|
||||
8000C46C 38210020 8000C46C 38210020 8000C46C 38210020 8000C46C 38210020 8000C46C 38210020 8000C46C 38210020 8000C46C 38210020 8000C46C 38210020 addi r1, r1, 0x0020
|
||||
8000C470 4E800020 8000C470 4E800020 8000C470 4E800020 8000C470 4E800020 8000C470 4E800020 8000C470 4E800020 8000C470 4E800020 8000C470 4E800020 blr
|
||||
8010B970 4BEFF72C 8010BB70 4BEFF52C 8010BC04 4BEFF498 8010BAF0 4BEFF5AC 8010BC14 4BEFF488 8010BC14 4BEFF488 8010BB00 4BEFF59C 8010BCF0 4BEFF3AC b -0x00100B78 /* 8000B09C */
|
||||
8010DD98 4BEFD31C 8010DF98 4BEFD11C 8010E0E4 4BEFCFD0 8010DF24 4BEFD190 8010E03C 4BEFD078 8010E03C 4BEFD078 8010DF34 4BEFD180 8010E118 4BEFCF9C b -0x00102F88 /* 8000B0B4 */
|
||||
801B97B4 4BE52C54 801B9C20 4BE527E8 801BCC98 4BE4F770 801B9CEC 4BE5271C 801B9BA0 4BE52868 801B9BA0 4BE52868 801B9D50 4BE526B8 801BA20C 4BE521FC b -0x001AD798 /* 8000C408 */
|
||||
801B9A88 4BE51600 801B9EF4 4BE51194 801BCF6C 4BE4E11C 801B9FC0 4BE510C8 801B9E74 4BE51214 801B9E74 4BE51214 801BA024 4BE51064 801BA4E0 4BE50BA8 b -0x001AEDEC /* 8000B088 */
|
||||
|
||||
Unit Present Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000C640 54800673 8000C640 54800673 8000C640 54800673 8000C640 54800673 8000C640 54800673 8000C640 54800673 8000C640 54800673 8000C640 54800673 rlwinm. r0, r4, 0, 25, 25
|
||||
8000C644 41820008 8000C644 41820008 8000C644 41820008 8000C644 41820008 8000C644 41820008 8000C644 41820008 8000C644 41820008 8000C644 41820008 beq +0x00000008 /* 8000C64C */
|
||||
8000C648 38800000 8000C648 38800000 8000C648 38800000 8000C648 38800000 8000C648 38800000 8000C648 38800000 8000C648 38800000 8000C648 38800000 li r4, 0x0000
|
||||
8000C64C 38040009 8000C64C 38040009 8000C64C 38040009 8000C64C 38040009 8000C64C 38040009 8000C64C 38040009 8000C64C 38040009 8000C64C 38040009 addi r0, r4, 0x0009
|
||||
8000C650 4810C694 8000C650 4810C8B0 8000C650 4810C98C 8000C650 4810C848 8000C650 4810C938 8000C650 4810C938 8000C650 4810C858 8000C650 4810CA30 b +0x0010C938 /* 80118F88 */
|
||||
80118CE0 4BEF3960 80118EFC 4BEF3744 80118FD8 4BEF3668 80118E94 4BEF37AC 80118F84 4BEF36BC 80118F84 4BEF36BC 80118EA4 4BEF379C 8011907C 4BEF35C4 b -0x0010C944 /* 8000C640 */
|
||||
|
||||
Bank Item Stacking Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000C6D0 38000001 8000C6D0 38000001 8000C6D0 38000001 8000C6D0 38000001 8000C6D0 38000001 8000C6D0 38000001 8000C6D0 38000001 8000C6D0 38000001 li r0, 0x0001
|
||||
8000C6D4 901D0054 8000C6D4 901D0054 8000C6D4 901D0054 8000C6D4 901D0054 8000C6D4 901D0054 8000C6D4 901D0054 8000C6D4 901D0054 8000C6D4 901D0054 stw [r29 + 0x0054], r0
|
||||
8000C6D8 807D0024 8000C6D8 807D0024 8000C6D8 807D0024 8000C6D8 807D0024 8000C6D8 807D0024 8000C6D8 807D0024 8000C6D8 807D0024 8000C6D8 807D0024 lwz r3, [r29 + 0x0024]
|
||||
8000C6DC 482109C0 8000C6DC 48211324 8000C6DC 48212210 8000C6DC 48211FC4 8000C6DC 48211244 8000C6DC 48211244 8000C6DC 482122F8 8000C6DC 48211B90 b +0x00211244 /* 8021D920 */
|
||||
8000C6E0 38000001 8000C6E0 38000001 8000C6E0 38000001 8000C6E0 38000001 8000C6E0 38000001 8000C6E0 38000001 8000C6E0 38000001 8000C6E0 38000001 li r0, 0x0001
|
||||
8000C6E4 901F0378 8000C6E4 901F0378 8000C6E4 901F0378 8000C6E4 901F0378 8000C6E4 901F0378 8000C6E4 901F0378 8000C6E4 901F0378 8000C6E4 901F0378 stw [r31 + 0x0378], r0
|
||||
8000C6E8 807F0024 8000C6E8 807F0024 8000C6E8 807F0024 8000C6E8 807F0024 8000C6E8 807F0024 8000C6E8 807F0024 8000C6E8 807F0024 8000C6E8 807F0024 lwz r3, [r31 + 0x0024]
|
||||
8000C6EC 48165AA0 8000C6EC 482147D4 8000C6EC 482156C0 8000C6EC 48215474 8000C6EC 482146F4 8000C6EC 482146F4 8000C6EC 482157A8 8000C6EC 48215040 b +0x002146F4 /* 80220DE0 */
|
||||
8021D098 4BDEF638 8021D9FC 4BDEECD4 8021E8E8 4BDEDDE8 8021E69C 4BDEE034 8021D91C 4BDEEDB4 8021D91C 4BDEEDB4 8021E9D0 4BDEDD00 8021E268 4BDEE468 b -0x0021124C /* 8000C6D0 */
|
||||
80172188 4BE9A558 80220EBC 4BDEB824 80221DA8 4BDEA938 80221B5C 4BDEAB84 80220DDC 4BDEB904 80220DDC 4BDEB904 80221E90 4BDEA850 80221728 4BDEAFB8 b -0x002146FC /* 8000C6E0 */
|
||||
|
||||
Dropped Mag Colour Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80114378 38000012 8011458C 38000012 80114634 38000012 80114524 38000012 8011461C 38000012 8011461C 38000012 80114534 38000012 8011470C 38000012 li r0, 0x0012
|
||||
|
||||
Meseta Drop System Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80107478 4800000C 80107654 4800000C 80107708 4800000C 801075D4 4800000C 8010771C 4800000C 8010771C 4800000C 801075E4 4800000C 801077D4 4800000C b +0x0000000C /* 80107728 */
|
||||
8010748C 7C030378 80107668 7C030378 8010771C 7C030378 801075E8 7C030378 80107730 7C030378 80107730 7C030378 801075F8 7C030378 801077E8 7C030378 mr r3, r0
|
||||
|
||||
Present Colour Bug Fix (TODO: which versions need this?)
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80101C14 60000000 60000000 60000000 60000000 80101EB8 60000000 80101EB8 60000000 60000000 60000000 nop
|
||||
|
||||
Offline Quests Drop Table Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80104B48 4182000C 80104D24 4182000C 80104DE0 4182000C 80104CA4 4182000C 80104DEC 4182000C 80104DEC 4182000C 80104CB4 4182000C 80104EA4 4182000C beq +0x0000000C /* 80104DF8 */
|
||||
|
||||
Mag Revival Priority Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000C8A0 1C00000A 8000C8A0 1C00000A 8000C8A0 1C00000A 8000C8A0 1C00000A 8000C8A0 1C00000A 8000C8A0 1C00000A 8000C8A0 1C00000A 8000C8A0 1C00000A mulli r0, r0, 10
|
||||
8000C8A4 57E407BD 8000C8A4 57E407BD 8000C8A4 57E407BD 8000C8A4 57E407BD 8000C8A4 57E407BD 8000C8A4 57E407BD 8000C8A4 57E407BD 8000C8A4 57E407BD rlwinm. r4, r31, 0, 30, 30
|
||||
8000C8A8 41820008 8000C8A8 41820008 8000C8A8 41820008 8000C8A8 41820008 8000C8A8 41820008 8000C8A8 41820008 8000C8A8 41820008 8000C8A8 41820008 beq +0x00000008 /* 8000C8B0 */
|
||||
8000C8AC 7FA00734 8000C8AC 7FA00734 8000C8AC 7FA00734 8000C8AC 7FA00734 8000C8AC 7FA00734 8000C8AC 7FA00734 8000C8AC 7FA00734 8000C8AC 7FA00734 extsh r0, r29
|
||||
8000C8B0 48105DB8 8000C8B0 48105FB8 8000C8B0 48106190 8000C8B0 48105F44 8000C8B0 4810605C 8000C8B0 4810605C 8000C8B0 48105F54 8000C8B0 48106138 b +0x0010605C /* 8011290C */
|
||||
80112664 4BEFA23C 80112864 4BEFA03C 80112A3C 4BEF9E64 801127F0 4BEFA0B0 80112908 4BEF9F98 80112908 4BEF9F98 80112800 4BEFA0A0 801129E4 4BEF9EBC b -0x00106068 /* 8000C8A0 */
|
||||
|
||||
Mag Revival Challenge & Quest Mode Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
801CA1F4 48000010 801CA6E0 48000010 801CB5EC 48000010 801CA7AC 48000010 801CA610 48000010 801CA610 48000010 801CA810 48000010 801CACCC 48000010 b +0x00000010 /* 801CA620 */
|
||||
|
||||
Chat Bubble Window TAB Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80250264 60000000 80250CB0 60000000 80251CA4 60000000 802519A4 60000000 80250AEC 60000000 80250AEC 60000000 80251C68 60000000 802514B0 60000000 nop
|
||||
|
||||
Chat Log Window LF/Tab Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80267DDC 60000000 80268A88 60000000 80269AE4 60000000 80269898 60000000 80268788 60000000 80268788 60000000 80269B5C 60000000 802693A4 60000000 nop
|
||||
|
||||
Dark/Hell Special GFX Bug Fix (makes Dark/Hell display graphic on success like in PSO BB)
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000E1E0 7FC802A6 8000E1E0 7FC802A6 8000E1E0 7FC802A6 8000E1E0 7FC802A6 8000E1E0 7FC802A6 8000E1E0 7FC802A6 8000E1E0 7FC802A6 8000E1E0 7FC802A6 mflr r30
|
||||
8000E1E4 38A00000 8000E1E4 38A00000 8000E1E4 38A00000 8000E1E4 38A00000 8000E1E4 38A00000 8000E1E4 38A00000 8000E1E4 38A00000 8000E1E4 38A00000 li r5, 0x0000
|
||||
8000E1E8 38C0001E 8000E1E8 38C0001E 8000E1E8 38C0001E 8000E1E8 38C0001E 8000E1E8 38C0001E 8000E1E8 38C0001E 8000E1E8 38C0001E 8000E1E8 38C0001E li r6, 0x001E
|
||||
8000E1EC 38E00040 8000E1EC 38E00040 8000E1EC 38E00040 8000E1EC 38E00040 8000E1EC 38E00040 8000E1EC 38E00040 8000E1EC 38E00040 8000E1EC 38E00040 li r7, 0x0040
|
||||
8000E1F0 480782B1 8000E1F0 4807859D 8000E1F0 48078715 8000E1F0 480786C5 8000E1F0 4807853D 8000E1F0 4807853D 8000E1F0 480786D5 8000E1F0 4807869D bl +0x0007853C /* 8008672C */
|
||||
8000E1F4 7FC803A6 8000E1F4 7FC803A6 8000E1F4 7FC803A6 8000E1F4 7FC803A6 8000E1F4 7FC803A6 8000E1F4 7FC803A6 8000E1F4 7FC803A6 8000E1F4 7FC803A6 mtlr r30
|
||||
8000E1F8 4E800020 8000E1F8 4E800020 8000E1F8 4E800020 8000E1F8 4E800020 8000E1F8 4E800020 8000E1F8 4E800020 8000E1F8 4E800020 8000E1F8 4E800020 blr
|
||||
80355960 388001E8 80356D64 388001E8 803582C0 388001E8 80358074 388001E8 80356814 388001E8 80356858 388001E8 80358440 388001E8 80357834 388001E8 li r4, 0x01E8
|
||||
80355984 4BCB885D 80356D88 4BCB7459 803582E4 4BCB5EFD 80358098 4BCB6149 80356838 4BCB79A9 8035687C 4BCB7965 80358464 4BCB5D7D 80357858 4BCB6989 bl -0x00348658 /* 8000E1E0 */
|
||||
803559F4 388001E8 80356DF8 388001E8 80358354 388001E8 80358108 388001E8 803568A8 388001E8 803568EC 388001E8 803584D4 388001E8 803578C8 388001E8 li r4, 0x01E8
|
||||
80355A04 4BCB87DD 80356E08 4BCB73D9 80358364 4BCB5E7D 80358118 4BCB60C9 803568B8 4BCB7929 803568FC 4BCB78E5 803584E4 4BCB5CFD 803578D8 4BCB6909 bl -0x003486D8 /* 8000E1E0 */
|
||||
|
||||
Gol Dragon Camera Bug Fix (makes the camera after Gol Dragon display "normally")
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
802FB99C 2C030001 802FC968 2C030001 802FDE60 2C030001 802FDB6C 2C030001 802FC2F4 2C030001 802FC338 2C030001 802FDD28 2C030001 802FD100 2C030001 cmpwi r3, 1
|
||||
|
||||
Box/Fence Fadeout Bug Fix (stops boxes and other environmental objects fading in and out as you approach)
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80189A54 60000000 80189E2C 60000000 80189F90 60000000 80189EF0 60000000 80189E20 60000000 80189E20 60000000 80189F54 60000000 8018A418 60000000 nop
|
||||
801933DC 60000000 801937B0 60000000 80193914 60000000 80193874 60000000 801937A8 60000000 801937A8 60000000 801938D8 60000000 80193D9C 60000000 nop
|
||||
|
||||
TP Bar Colour Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8026DA74 3884AAFA 8026E738 3884AAFA 8026F794 3884AAFA 8026F548 3884AAFA 8026E2D4 3884AAFA 8026E2D4 3884AAFA 8026F6FC 3884AAFA 8026EF44 3884AAFA subi r4, r4, 0x5506
|
||||
8026DB88 3863AAFA 8026E84C 3863AAFA 8026F8A8 3863AAFA 8026F65C 3863AAFA 8026E3E8 3863AAFA 8026E3E8 3863AAFA 8026F810 3863AAFA 8026F058 3863AAFA subi r3, r3, 0x5506
|
||||
8026DC10 3883AAFA 8026E8D4 3883AAFA 8026F930 3883AAFA 8026F6E4 3883AAFA 8026E470 3883AAFA 8026E470 3883AAFA 8026F898 3883AAFA 8026F0E0 3883AAFA subi r4, r3, 0x5506
|
||||
804CBB40 FF0074EE 804CF290 FF0074EE 804D17E0 FF0074EE 804D1580 FF0074EE 804CC310 FF0074EE 804CC7F0 FF0074EE 804D0E58 FF0074EE 804D1248 FF0074EE fsel f24, f0, f14, f19
|
||||
|
||||
Devil's and Demon's Special Damage Display Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8001306C 4BFFFCC0 8001309C 4BFFFCC0 80013364 4BFFFCC0 8001304C 4BFFFCC0 80013084 4BFFFCC0 80013084 4BFFFCC0 8001304C 4BFFFCC0 800130C4 4BFFFCC0 b -0x00000340 /* 80012D44 */
|
||||
|
||||
Christmas Trees Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000B5C8 80630098 8000B5C8 80630098 8000B5C8 80630098 8000B5C8 80630098 8000B5C8 80630098 8000B5C8 80630098 8000B5C8 80630098 8000B5C8 80630098 lwz r3, [r3 + 0x0098]
|
||||
8000B5CC 483D46F5 8000B5CC 483D70D1 8000B5CC 483D8F71 8000B5CC 483D8D21 8000B5CC 483D5999 8000B5CC 483D59F1 8000B5CC 483D90F1 8000B5CC 483D7BE1 bl +0x003D5998 /* 803E0F64 */
|
||||
8000B5D0 807F042C 8000B5D0 807F042C 8000B5D0 807F042C 8000B5D0 807F042C 8000B5D0 807F042C 8000B5D0 807F042C 8000B5D0 807F042C 8000B5D0 807F042C lwz r3, [r31 + 0x042C]
|
||||
8000B5D4 809F0430 8000B5D4 809F0430 8000B5D4 809F0430 8000B5D4 809F0430 8000B5D4 809F0430 8000B5D4 809F0430 8000B5D4 809F0430 8000B5D4 809F0430 lwz r4, [r31 + 0x0430]
|
||||
8000B5D8 481788C0 8000B5D8 48178C88 8000B5D8 48178DEC 8000B5D8 48178D4C 8000B5D8 48178C7C 8000B5D8 48178C7C 8000B5D8 48178DB0 8000B5D8 48179274 b +0x00178C7C /* 80184254 */
|
||||
80183E94 4BE87734 8018425C 4BE8736C 801843C0 4BE87208 80184320 4BE872A8 80184250 4BE87378 80184250 4BE87378 80184384 4BE87244 80184848 4BE86D80 b -0x00178C88 /* 8000B5C8 */
|
||||
80183ED4 60000000 8018429C 60000000 80184400 60000000 80184360 60000000 80184290 60000000 80184290 60000000 801843C4 60000000 80184888 60000000 nop
|
||||
|
||||
Rain Drops Colour Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
804B3738 70808080 804B6E58 70808080 804B92F8 70808080 804B90B8 70808080 804B3EF0 70808080 804B43D0 70808080 804B8990 70808080 804B8E10 70808080 andi. r0, r4, 0x8080
|
||||
804B373C 60707070 804B6E5C 60707070 804B92FC 60707070 804B90BC 60707070 804B3EF4 60707070 804B43D4 60707070 804B8994 60707070 804B8E14 60707070 ori r16, r3, 0x7070
|
||||
|
||||
Reverser Target Lock Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
801C5EA4 389F02FC 801C6360 389F02FC 801C6604 389F02FC 801C642C 389F02FC 801C62C0 389F02FC 801C62C0 389F02FC 801C6490 389F02FC 801C694C 389F02FC addi r4, r31, 0x02FC
|
||||
|
||||
Deband/Shifta/Resta Target Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8022CF84 41810630 8022D920 41810630 8022E85C 41810630 8022E5C0 41810630 8022D840 41810630 8022D840 41810630 8022E8F4 41810630 8022E18C 41810630 bgt +0x00000630 /* 8022DE70 */
|
||||
8022D278 4181033C 4181033C 4181033C 4181033C 8022DB34 4181033C 8022DB34 4181033C 4181033C 4181033C bgt +0x0000033C /* 8022DE70 */
|
||||
8022D36C 41810248 41810248 41810248 41810248 8022DC28 41810248 8022DC28 41810248 41810248 41810248 bgt +0x00000248 /* 8022DE70 */
|
||||
|
||||
Tech Auto Targetting Bug Fix
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8022C850 60000000 8022D1EC 60000000 8022E128 60000000 8022DE8C 60000000 8022D10C 60000000 8022D10C 60000000 8022E1C0 60000000 8022DA58 60000000 nop
|
||||
804C6EE4 0000001E 804CA61C 0000001E 804CCB6C 0000001E 804CC90C 0000001E 804C76B4 0000001E 804C7B94 0000001E 804CC1E4 0000001E 804CC5D4 0000001E .invalid
|
||||
804C6F3C 00000028 804CA674 00000028 804CCBC4 00000028 804CC964 00000028 804C770C 00000028 804C7BEC 00000028 804CC23C 00000028 804CC62C 00000028 .invalid
|
||||
804C6F68 00000032 804CA6A0 00000032 804CCBF0 00000032 804CC990 00000032 804C7738 00000032 804C7C18 00000032 804CC268 00000032 804CC658 00000032 .invalid
|
||||
804C6F94 0000003C 804CA6CC 0000003C 804CCC1C 0000003C 804CC9BC 0000003C 804C7764 0000003C 804C7C44 0000003C 804CC294 0000003C 804CC684 0000003C .invalid
|
||||
804C6FA4 0018003C 804CA6DC 0018003C 804CCC2C 0018003C 804CC9CC 0018003C 804C7774 0018003C 804C7C54 0018003C 804CC2A4 0018003C 804CC694 0018003C .invalid
|
||||
804C71FC 00000028 804CA934 00000028 804CCE84 00000028 804CCC24 00000028 804C79CC 00000028 804C7EAC 00000028 804CC4FC 00000028 804CC8EC 00000028 .invalid
|
||||
|
||||
Enable Trap Animations
|
||||
BugFixes
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000BBD0 809F0370 8000BBD0 809F0370 8000BBD0 809F0370 8000BBD0 809F0370 8000BBD0 809F0370 8000BBD0 809F0370 8000BBD0 809F0370 8000BBD0 809F0370 lwz r4, [r31 + 0x0370]
|
||||
8000BBD4 3884FC00 8000BBD4 3884FC00 8000BBD4 3884FC00 8000BBD4 3884FC00 8000BBD4 3884FC00 8000BBD4 3884FC00 8000BBD4 3884FC00 8000BBD4 3884FC00 subi r4, r4, 0x0400
|
||||
8000BBD8 909F0370 8000BBD8 909F0370 8000BBD8 909F0370 8000BBD8 909F0370 8000BBD8 909F0370 8000BBD8 909F0370 8000BBD8 909F0370 8000BBD8 909F0370 stw [r31 + 0x0370], r4
|
||||
8000BBDC 807F0014 8000BBDC 807F0014 8000BBDC 807F0014 8000BBDC 807F0014 8000BBDC 807F0014 8000BBDC 807F0014 8000BBDC 807F0014 8000BBDC 807F0014 lwz r3, [r31 + 0x0014]
|
||||
8000BBE0 28030000 8000BBE0 28030000 8000BBE0 28030000 8000BBE0 28030000 8000BBE0 28030000 8000BBE0 28030000 8000BBE0 28030000 8000BBE0 28030000 cmplwi r3, 0
|
||||
8000BBE4 41820008 8000BBE4 41820008 8000BBE4 41820008 8000BBE4 41820008 8000BBE4 41820008 8000BBE4 41820008 8000BBE4 41820008 8000BBE4 41820008 beq +0x00000008 /* 8000BBEC */
|
||||
8000BBE8 90830060 8000BBE8 90830060 8000BBE8 90830060 8000BBE8 90830060 8000BBE8 90830060 8000BBE8 90830060 8000BBE8 90830060 8000BBE8 90830060 stw [r3 + 0x0060], r4
|
||||
8000BBEC 4816506C 8000BBEC 48165420 8000BBEC 48165678 8000BBEC 481654E4 8000BBEC 48165428 8000BBEC 48165428 8000BBEC 48165548 8000BBEC 48165A0C b +0x00165428 /* 80171014 */
|
||||
80170C54 4BE9AF7C 80171008 4BE9ABC8 80171260 4BE9A970 801710CC 4BE9AB04 80171010 4BE9ABC0 80171010 4BE9ABC0 80171130 4BE9AAA0 801715F4 4BE9A5DC b -0x00165440 /* 8000BBD0 */
|
||||
80170C74 60800420 80171028 60800420 80171280 60800420 801710EC 60800420 80171030 60800420 80171030 60800420 80171150 60800420 80171614 60800420 ori r0, r4, 0x0420
|
||||
|
||||
Extended Word Select
|
||||
ChatFeatures
|
||||
*** name=Chat
|
||||
*** desc=Enable extended\nWord Select and\nstop the Log Window\nfrom scrolling by\nholding L+R
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8034445C 38600000 803457AC 38600000 80346CCC 38600000 80346A80 38600000 8034525C 38600000 803452A0 38600000 80346E4C 38600000 8034627C 38600000 li r3, 0x0000
|
||||
|
||||
Chat Log Window: Lock Scrolling with L+R
|
||||
ChatFeatures
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000D6A0 3C608051 8000D6A0 3C608051 8000D6A0 3C608051 8000D6A0 3C608051 8000D6A0 3C608051 8000D6A0 3C608051 8000D6A0 3C608051 8000D6A0 3C608051 lis r3, 0x8051
|
||||
8000D6A4 A0638AD0 8000D6A4 A063C590 8000D6A4 A063EBD0 8000D6A4 A063E970 8000D6A4 A06393B0 8000D6A4 A0639890 8000D6A4 A063E270 8000D6A4 A063F290 lhz r3, [r3 - 0x6C50]
|
||||
8000D6A8 70600003 8000D6A8 70600003 8000D6A8 70600003 8000D6A8 70600003 8000D6A8 70600003 8000D6A8 70600003 8000D6A8 70600003 8000D6A8 70600003 andi. r0, r3, 0x0003
|
||||
8000D6AC 28000003 8000D6AC 28000003 8000D6AC 28000003 8000D6AC 28000003 8000D6AC 28000003 8000D6AC 28000003 8000D6AC 28000003 8000D6AC 28000003 cmplwi r0, 3
|
||||
8000D6B0 41820008 8000D6B0 41820008 8000D6B0 41820008 8000D6B0 41820008 8000D6B0 41820008 8000D6B0 41820008 8000D6B0 41820008 8000D6B0 41820008 beq +0x00000008 /* 8000D6B8 */
|
||||
8000D6B4 D03C0084 8000D6B4 D03C0084 8000D6B4 D03C0084 8000D6B4 D03C0084 8000D6B4 D03C0084 8000D6B4 D03C0084 8000D6B4 D03C0084 8000D6B4 D03C0084 stfs [r28 + 0x0084], f1
|
||||
8000D6B8 4825A814 8000D6B8 4825B4C0 8000D6B8 4825C51C 8000D6B8 4825C2D0 8000D6B8 4825B1C0 8000D6B8 4825B1C0 8000D6B8 4825C594 8000D6B8 4825BDDC b +0x0025B1C0 /* 80268878 */
|
||||
80267EC8 4BDA57D8 80268B74 4BDA4B2C 80269BD0 4BDA3AD0 80269984 4BDA3D1C 80268874 4BDA4E2C 80268874 4BDA4E2C 80269C48 4BDA3A58 80269490 4BDA4210 b -0x0025B1D4 /* 8000D6A0 */
|
||||
|
||||
Improved Draw Distance of most objects
|
||||
DrawDistance
|
||||
*** name=DrawDistance
|
||||
*** desc=Extend the draw\ndistance of many\nobjects
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000DFA0 C3C2C1F8 8000DFA0 C3C2C1F8 8000DFA0 C3C2C1F8 8000DFA0 C3C2C1F8 8000DFA0 C3C2C200 8000DFA0 C3C2C200 8000DFA0 C3C2C200 8000DFA0 C3C2C200 lfs f30, [r2 - 0x3E00]
|
||||
8000DFA4 EFDE0072 8000DFA4 EFDE0072 8000DFA4 EFDE0072 8000DFA4 EFDE0072 8000DFA4 EFDE0072 8000DFA4 EFDE0072 8000DFA4 EFDE0072 8000DFA4 EFDE0072 fmuls f30, f30, f1
|
||||
8000DFA8 4E800020 8000DFA8 4E800020 8000DFA8 4E800020 8000DFA8 4E800020 8000DFA8 4E800020 8000DFA8 4E800020 8000DFA8 4E800020 8000DFA8 4E800020 blr
|
||||
8000DFAC C042C1F8 8000DFAC C042C1F8 8000DFAC C042C1F8 8000DFAC C042C1F8 8000DFAC C042C200 8000DFAC C042C200 8000DFAC C042C200 8000DFAC C042C200 lfs f2, [r2 - 0x3E00]
|
||||
8000DFB0 C01E001C 8000DFB0 C01E001C 8000DFB0 C01E001C 8000DFB0 C01E001C 8000DFB0 C01E001C 8000DFB0 C01E001C 8000DFB0 C01E001C 8000DFB0 C01E001C lfs f0, [r30 + 0x001C]
|
||||
8000DFB4 EC0000B2 8000DFB4 EC0000B2 8000DFB4 EC0000B2 8000DFB4 EC0000B2 8000DFB4 EC0000B2 8000DFB4 EC0000B2 8000DFB4 EC0000B2 8000DFB4 EC0000B2 fmuls f0, f0, f2
|
||||
8000DFB8 4E800020 8000DFB8 4E800020 8000DFB8 4E800020 8000DFB8 4E800020 8000DFB8 4E800020 8000DFB8 4E800020 8000DFB8 4E800020 8000DFB8 4E800020 blr
|
||||
8000DFBC C382C1F8 8000DFBC C382C1F8 8000DFBC C382C1F8 8000DFBC C382C1F8 8000DFBC C382C200 8000DFBC C382C200 8000DFBC C382C200 8000DFBC C382C200 lfs f28, [r2 - 0x3E00]
|
||||
8000DFC0 EF9C00B2 8000DFC0 EF9C00B2 8000DFC0 EF9C00B2 8000DFC0 EF9C00B2 8000DFC0 EF9C00B2 8000DFC0 EF9C00B2 8000DFC0 EF9C00B2 8000DFC0 EF9C00B2 fmuls f28, f28, f2
|
||||
8000DFC4 4E800020 8000DFC4 4E800020 8000DFC4 4E800020 8000DFC4 4E800020 8000DFC4 4E800020 8000DFC4 4E800020 8000DFC4 4E800020 8000DFC4 4E800020 blr
|
||||
8000DFC8 C002C1F8 8000DFC8 C002C1F8 8000DFC8 C002C1F8 8000DFC8 C002C1F8 8000DFC8 C002C200 8000DFC8 C002C200 8000DFC8 C002C200 8000DFC8 C002C200 lfs f0, [r2 - 0x3E00]
|
||||
8000DFCC C023000C 8000DFCC C023000C 8000DFCC C023000C 8000DFCC C023000C 8000DFCC C023000C 8000DFCC C023000C 8000DFCC C023000C 8000DFCC C023000C lfs f1, [r3 + 0x000C]
|
||||
8000DFD0 EC000072 8000DFD0 EC000072 8000DFD0 EC000072 8000DFD0 EC000072 8000DFD0 EC000072 8000DFD0 EC000072 8000DFD0 EC000072 8000DFD0 EC000072 fmuls f0, f0, f1
|
||||
8000DFD4 D003000C 8000DFD4 D003000C 8000DFD4 D003000C 8000DFD4 D003000C 8000DFD4 D003000C 8000DFD4 D003000C 8000DFD4 D003000C 8000DFD4 D003000C stfs [r3 + 0x000C], f0
|
||||
8000DFD8 3C60804C 8000DFD8 3C60804C 8000DFD8 3C60804D 8000DFD8 3C60804D 8000DFD8 3C60804C 8000DFD8 3C60804C 8000DFD8 3C60804D 8000DFD8 3C60804D lis r3, 0x804C
|
||||
8000DFDC 4E800020 8000DFDC 4E800020 8000DFDC 4E800020 8000DFDC 4E800020 8000DFDC 4E800020 8000DFDC 4E800020 8000DFDC 4E800020 8000DFDC 4E800020 blr
|
||||
801008E8 4BF0D6B9 80100AD0 4BF0D4D1 80100B74 4BF0D42D 80100A50 4BF0D551 80100B8C 4BF0D415 80100B8C 4BF0D415 80100A60 4BF0D541 80100C50 4BF0D351 bl -0x000F2BEC /* 8000DFA0 */
|
||||
80156D00 4BEB72AD 801570B4 4BEB6EF9 80157218 4BEB6D95 80157178 4BEB6E35 801570BC 4BEB6EF1 801570BC 4BEB6EF1 801571DC 4BEB6DD1 801576A0 4BEB690D bl -0x00149110 /* 8000DFAC */
|
||||
801A1C64 4BE6C359 801A203C 4BE6BF81 801A21A0 4BE6BE1D 801A2100 4BE6BEBD 801A2040 4BE6BF7D 801A2040 4BE6BF7D 801A2164 4BE6BE59 801A2628 4BE6B995 bl -0x00194084 /* 8000DFBC */
|
||||
801A1E64 4BE6C13D 801A223C 4BE6BD65 801A23A0 4BE6BC01 801A2300 4BE6BCA1 801A2240 4BE6BD61 801A2240 4BE6BD61 801A2364 4BE6BC3D 801A2828 4BE6B779 bl -0x001942A0 /* 8000DFA0 */
|
||||
80205044 4BE08F85 802058B8 4BE08711 80206640 4BE07989 802063F4 4BE07BD5 80205840 4BE08789 80205840 4BE08789 80206728 4BE078A1 80206124 4BE07EA5 bl -0x001F7878 /* 8000DFC8 */
|
||||
802057E8 4BE087E1 8020605C 4BE07F6D 80206DE4 4BE071E5 80206B98 4BE07431 80205FE4 4BE07FE5 80205FE4 4BE07FE5 80206ECC 4BE070FD 802068C8 4BE07701 bl -0x001F801C /* 8000DFC8 */
|
||||
805C83A8 47AFC800 805D29A8 47AFC800 805D9E48 47AFC800 805D9BE8 47AFC800 805C8CB0 47AFC800 805CFCD0 47AFC800 805D94F0 47AFC800 805D5730 47AFC800 .invalid sc
|
||||
805C9254 47742400 805D3854 47742400 805DACF4 47742400 805DAA94 47742400 805C9B5C 47742400 805D0B7C 47742400 805DA39C 47742400 805D65DC 47742400 .invalid sc
|
||||
805C987C 491C4000 805D3E7C 491C4000 805DB31C 491C4000 805DB0BC 491C4000 805CA184 491C4000 805D11A4 491C4000 805DA9C4 491C4000 805D6C04 491C4000 b +0x011C4000 /* 8178E184 */
|
||||
805CA708 47AFC800 805D4D08 47AFC800 805DC1A8 47AFC800 805DBF48 47AFC800 805CB010 47AFC800 805D2030 47AFC800 805DB850 47AFC800 805D7A90 47AFC800 .invalid sc
|
||||
805CAC98 44AF0000 805D5298 44AF0000 805DC738 44AF0000 805DC4D8 44AF0000 805CB5A0 44AF0000 805D25C0 44AF0000 805DBDE0 44AF0000 805D8020 44AF0000 .invalid sc
|
||||
|
||||
Show Enemy HP Bars
|
||||
EnemyHPBars
|
||||
*** name=Enemy HP bars
|
||||
*** desc=Show HP bars in\nenemy info windows
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
802612C4 4BFE1541 80261E9C 4BFE1349 80262EE4 4BFE0665 80262C98 4BFE1241 80261B9C 4BFE1545 80261B9C 4BFE1545 80262F5C 4BFE12B1 802627A4 4BFE12B1 bl -0x0001EABC /* 802430E0 */
|
||||
804CAF00 42300000 804CE650 42300000 804D0BA0 42300000 804D0940 42300000 804CB6D0 42300000 804CBBB0 42300000 804D0218 42300000 804D0608 42300000 bdnz cr4, +0x00000000 /* 804CB6D0 */
|
||||
804CAF1C FF00FF15 804CE66C FF00FF15 804D0BBC FF00FF15 804D095C FF00FF15 804CB6EC FF00FF15 804CBBCC FF00FF15 804D0234 FF00FF15 804D0624 FF00FF15 .invalid FC, 0
|
||||
805CBFBC 42A00000 805D65BC 42A00000 805DDA5C 42A00000 805DD7FC 42A00000 805CC8C4 42A00000 805D38E4 42A00000 805DD104 42A00000 805D9344 42A00000 b +0x00000000 /* 805CC8C4 */
|
||||
804CAE40 42640000 804CE590 42640000 804D0AE0 42640000 804D0880 42640000 804CB610 42640000 804CBAF0 42640000 804D0158 42640000 804D0548 42640000 bc 19, 4, +0x00000000 /* 804CB610 */
|
||||
804CAE4C 42640000 804CE59C 42640000 804D0AEC 42640000 804D088C 42640000 804CB61C 42640000 804CBAFC 42640000 804D0164 42640000 804D0554 42640000 bc 19, 4, +0x00000000 /* 804CB61C */
|
||||
804CAE58 42640000 804CE5A8 42640000 804D0AF8 42640000 804D0898 42640000 804CB628 42640000 804CBB08 42640000 804D0170 42640000 804D0560 42640000 bc 19, 4, +0x00000000 /* 804CB628 */
|
||||
804CAE64 42640000 804CE5B4 42640000 804D0B04 42640000 804D08A4 42640000 804CB634 42640000 804CBB14 42640000 804D017C 42640000 804D056C 42640000 bc 19, 4, +0x00000000 /* 804CB634 */
|
||||
|
||||
PSO DC Reticle Colours
|
||||
DCReticleColors
|
||||
*** name=DC targets
|
||||
*** desc=Change the target\nreticle colors to\nthose used on the\nDreamcast
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
802AB3FC 3C8000FF 802AC2A4 3C8000FF 802AD3D0 3C8000FF 802AD184 3C8000FF 802ABDB8 3C8000FF 802ABDFC 3C8000FF 802AD338 3C8000FF 802ACACC 3C8000FF lis r4, 0x00FF
|
||||
802AB410 388000FF 802AC2B8 388000FF 802AD3E4 388000FF 802AD198 388000FF 802ABDCC 388000FF 802ABE10 388000FF 802AD34C 388000FF 802ACAE0 388000FF li r4, 0x00FF
|
||||
802AB424 3884FF00 802AC2CC 3884FF00 802AD3F8 3884FF00 802AD1AC 3884FF00 802ABDE0 3884FF00 802ABE24 3884FF00 802AD360 3884FF00 802ACAF4 3884FF00 subi r4, r4, 0x0100
|
||||
804A1F18 3F800000 804A5638 3F800000 804A7AD8 3F800000 804A7898 3F800000 804A26C8 3F800000 804A2BA8 3F800000 804A7168 3F800000 804A75E8 3F800000 lis r28, 0x0000
|
||||
804A1F1C 00000000 804A563C 00000000 804A7ADC 00000000 804A789C 00000000 804A26CC 00000000 804A2BAC 00000000 804A716C 00000000 804A75EC 00000000 .invalid
|
||||
804A1F28 3F800000 804A5648 3F800000 804A7AE8 3F800000 804A78A8 3F800000 804A26D8 3F800000 804A2BB8 3F800000 804A7178 3F800000 804A75F8 3F800000 lis r28, 0x0000
|
||||
804A1F2C 00000000 804A564C 00000000 804A7AEC 00000000 804A78AC 00000000 804A26DC 00000000 804A2BBC 00000000 804A717C 00000000 804A75FC 00000000 .invalid
|
||||
804A1F38 3F800000 804A5658 3F800000 804A7AF8 3F800000 804A78B8 3F800000 804A26E8 3F800000 804A2BC8 3F800000 804A7188 3F800000 804A7608 3F800000 lis r28, 0x0000
|
||||
804A1F3C 3F800000 804A565C 3F800000 804A7AFC 3F800000 804A78BC 3F800000 804A26EC 3F800000 804A2BCC 3F800000 804A718C 3F800000 804A760C 3F800000 lis r28, 0x0000
|
||||
804A1F40 00000000 804A5660 00000000 804A7B00 00000000 804A78C0 00000000 804A26F0 00000000 804A2BD0 00000000 804A7190 00000000 804A7610 00000000 .invalid
|
||||
804A1F48 00000000 804A5668 00000000 804A7B08 00000000 804A78C8 00000000 804A26F8 00000000 804A2BD8 00000000 804A7198 00000000 804A7618 00000000 .invalid
|
||||
804A1F50 3F800000 804A5670 3F800000 804A7B10 3F800000 804A78D0 3F800000 804A2700 3F800000 804A2BE0 3F800000 804A71A0 3F800000 804A7620 3F800000 lis r28, 0x0000
|
||||
804A1F58 3ECCCCCD 804A5678 3ECCCCCD 804A7B18 3ECCCCCD 804A78D8 3ECCCCCD 804A2708 3ECCCCCD 804A2BE8 3ECCCCCD 804A71A8 3ECCCCCD 804A7628 3ECCCCCD subis r22, r12, 0x3333
|
||||
804A1F5C 3DCCCCCD 804A567C 3DCCCCCD 804A7B1C 3DCCCCCD 804A78DC 3DCCCCCD 804A270C 3DCCCCCD 804A2BEC 3DCCCCCD 804A71AC 3DCCCCCD 804A762C 3DCCCCCD subis r14, r12, 0x3333
|
||||
804A1F60 3DCCCCCD 804A5680 3DCCCCCD 804A7B20 3DCCCCCD 804A78E0 3DCCCCCD 804A2710 3DCCCCCD 804A2BF0 3DCCCCCD 804A71B0 3DCCCCCD 804A7630 3DCCCCCD subis r14, r12, 0x3333
|
||||
|
||||
PSOX / BB Reticle Colours
|
||||
PSOXReticleColors
|
||||
*** name=Xbox/BB targets
|
||||
*** desc=Change the target\nreticle colors to\nthose used on the\nXbox and Blue Burst
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
802AB424 388000FF 802AC2CC 388000FF 802AD3F8 388000FF 802AD1AC 388000FF 802ABDE0 388000FF 802ABE24 388000FF 802AD360 388000FF 802ACAF4 388000FF li r4, 0x00FF
|
||||
804A1F38 00000000 804A5658 00000000 804A7AF8 00000000 804A78B8 00000000 804A26E8 00000000 804A2BC8 00000000 804A7188 00000000 804A7608 00000000 .invalid
|
||||
804A1F3C 00000000 804A565C 00000000 804A7AFC 00000000 804A78BC 00000000 804A26EC 00000000 804A2BCC 00000000 804A718C 00000000 804A760C 00000000 .invalid
|
||||
804A1F40 3F800000 804A5660 3F800000 804A7B00 3F800000 804A78C0 3F800000 804A26F0 3F800000 804A2BD0 3F800000 804A7190 3F800000 804A7610 3F800000 lis r28, 0x0000
|
||||
|
||||
Show Rare Items on Area & Radar Map
|
||||
RareDropNotifications
|
||||
*** name=Rare alerts
|
||||
*** desc=Show rare items on\nthe map and play a\nsound when a rare\nitem drops
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000C660 881F00EF 8000C660 881F00EF 8000C660 881F00EF 8000C660 881F00EF 8000C660 881F00EF 8000C660 881F00EF 8000C660 881F00EF 8000C660 881F00EF lbz r0, [r31 + 0x00EF]
|
||||
8000C664 28000004 8000C664 28000004 8000C664 28000004 8000C664 28000004 8000C664 28000004 8000C664 28000004 8000C664 28000004 8000C664 28000004 cmplwi r0, 4
|
||||
8000C668 40820018 8000C668 40820018 8000C668 40820018 8000C668 40820018 8000C668 40820018 8000C668 40820018 8000C668 40820018 8000C668 40820018 bne +0x00000018 /* 8000C680 */
|
||||
8000C66C 387F0038 8000C66C 387F0038 8000C66C 387F0038 8000C66C 387F0038 8000C66C 387F0038 8000C66C 387F0038 8000C66C 387F0038 8000C66C 387F0038 addi r3, r31, 0x0038
|
||||
8000C670 3C80FFFF 8000C670 3C80FFFF 8000C670 3C80FFFF 8000C670 3C80FFFF 8000C670 3C80FFFF 8000C670 3C80FFFF 8000C670 3C80FFFF 8000C670 3C80FFFF lis r4, 0xFFFF
|
||||
8000C674 38A00001 8000C674 38A00001 8000C674 38A00001 8000C674 38A00001 8000C674 38A00001 8000C674 38A00001 8000C674 38A00001 8000C674 38A00001 li r5, 0x0001
|
||||
8000C678 38C00000 8000C678 38C00000 8000C678 38C00000 8000C678 38C00000 8000C678 38C00000 8000C678 38C00000 8000C678 38C00000 8000C678 38C00000 li r6, 0x0000
|
||||
8000C67C 481ECE15 8000C67C 481ED4B1 8000C67C 481ED709 8000C67C 481ED4BD 8000C67C 481ED381 8000C67C 481ED381 8000C67C 481ED511 8000C67C 481EDA8D bl +0x001ED380 /* 801F99FC */
|
||||
8000C680 7FE3FB78 8000C680 7FE3FB78 8000C680 7FE3FB78 8000C680 7FE3FB78 8000C680 7FE3FB78 8000C680 7FE3FB78 8000C680 7FE3FB78 8000C680 7FE3FB78 mr r3, r31
|
||||
8000C684 480F5F9C 8000C684 480F6178 8000C684 480F6788 8000C684 480F60F8 8000C684 480F6240 8000C684 480F6240 8000C684 480F6108 8000C684 480F62F8 b +0x000F6240 /* 801028C4 */
|
||||
8010261C 4BF0A044 801027F8 4BF09E68 80102E08 4BF09858 80102778 4BF09EE8 801028C0 4BF09DA0 801028C0 4BF09DA0 80102788 4BF09ED8 80102978 4BF09CE8 b -0x000F6260 /* 8000C660 */
|
||||
|
||||
Rare Item Drops: Play SFX
|
||||
RareDropNotifications
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000C690 28030000 8000C690 28030000 8000C690 28030000 8000C690 28030000 8000C690 28030000 8000C690 28030000 8000C690 28030000 8000C690 28030000 cmplwi r3, 0
|
||||
8000C694 41820020 8000C694 41820020 8000C694 41820020 8000C694 41820020 8000C694 41820020 8000C694 41820020 8000C694 41820020 8000C694 41820020 beq +0x00000020 /* 8000C6B4 */
|
||||
8000C698 880300EF 8000C698 880300EF 8000C698 880300EF 8000C698 880300EF 8000C698 880300EF 8000C698 880300EF 8000C698 880300EF 8000C698 880300EF lbz r0, [r3 + 0x00EF]
|
||||
8000C69C 28000004 8000C69C 28000004 8000C69C 28000004 8000C69C 28000004 8000C69C 28000004 8000C69C 28000004 8000C69C 28000004 8000C69C 28000004 cmplwi r0, 4
|
||||
8000C6A0 40820014 8000C6A0 40820014 8000C6A0 40820014 8000C6A0 40820014 8000C6A0 40820014 8000C6A0 40820014 8000C6A0 40820014 8000C6A0 40820014 bne +0x00000014 /* 8000C6B4 */
|
||||
8000C6A4 3C600005 8000C6A4 3C600005 8000C6A4 3C600005 8000C6A4 3C600005 8000C6A4 3C600005 8000C6A4 3C600005 8000C6A4 3C600005 8000C6A4 3C600005 lis r3, 0x0005
|
||||
8000C6A8 60632813 8000C6A8 60632813 8000C6A8 60632813 8000C6A8 60632813 8000C6A8 60632813 8000C6A8 60632813 8000C6A8 60632813 8000C6A8 60632813 ori r3, r3, 0x2813
|
||||
8000C6AC 38800000 8000C6AC 38800000 8000C6AC 38800000 8000C6AC 38800000 8000C6AC 38800000 8000C6AC 38800000 8000C6AC 38800000 8000C6AC 38800000 li r4, 0x0000
|
||||
8000C6B0 48026FFD 8000C6B0 4802702D 8000C6B0 48027049 8000C6B0 48026FDD 8000C6B0 4802721D 8000C6B0 4802721D 8000C6B0 480271E5 8000C6B0 4802725D bl +0x0002721C /* 800338CC */
|
||||
8000C6B4 80010024 8000C6B4 80010024 8000C6B4 80010024 8000C6B4 80010024 8000C6B4 80010024 8000C6B4 80010024 8000C6B4 80010024 8000C6B4 80010024 lwz r0, [r1 + 0x0024]
|
||||
8000C6B8 4810E64C 8000C6B8 4810E868 8000C6B8 4810EA38 8000C6B8 4810E800 8000C6B8 4810E8F0 8000C6B8 4810E8F0 8000C6B8 4810E810 8000C6B8 4810E9E8 b +0x0010E8F0 /* 8011AFA8 */
|
||||
8011AD00 4BEF1990 8011AF1C 4BEF1774 8011B0EC 4BEF15A4 8011AEB4 4BEF17DC 8011AFA4 4BEF16EC 8011AFA4 4BEF16EC 8011AEC4 4BEF17CC 8011B09C 4BEF15F4 b -0x0010E914 /* 8000C690 */
|
||||
|
||||
Play SFX for Hungry Mag
|
||||
HungryMagSound
|
||||
*** name=MAG alert
|
||||
*** desc=Play a sound when\nyour MAG is hungry
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000BF30 9421FFF0 8000BF30 9421FFF0 8000BF30 9421FFF0 8000BF30 9421FFF0 8000BF30 9421FFF0 8000BF30 9421FFF0 8000BF30 9421FFF0 8000BF30 9421FFF0 stwu [r1 - 0x0010], r1
|
||||
8000BF34 7C0802A6 8000BF34 7C0802A6 8000BF34 7C0802A6 8000BF34 7C0802A6 8000BF34 7C0802A6 8000BF34 7C0802A6 8000BF34 7C0802A6 8000BF34 7C0802A6 mflr r0
|
||||
8000BF38 90010014 8000BF38 90010014 8000BF38 90010014 8000BF38 90010014 8000BF38 90010014 8000BF38 90010014 8000BF38 90010014 8000BF38 90010014 stw [r1 + 0x0014], r0
|
||||
8000BF3C 3C600002 8000BF3C 3C600002 8000BF3C 3C600002 8000BF3C 3C600002 8000BF3C 3C600002 8000BF3C 3C600002 8000BF3C 3C600002 8000BF3C 3C600002 lis r3, 0x0002
|
||||
8000BF40 60632825 8000BF40 60632825 8000BF40 60632825 8000BF40 60632825 8000BF40 60632825 8000BF40 60632825 8000BF40 60632825 8000BF40 60632825 ori r3, r3, 0x2825
|
||||
8000BF44 38800000 8000BF44 38800000 8000BF44 38800000 8000BF44 38800000 8000BF44 38800000 8000BF44 38800000 8000BF44 38800000 8000BF44 38800000 li r4, 0x0000
|
||||
8000BF48 48027765 8000BF48 48027795 8000BF48 480277B1 8000BF48 48027745 8000BF48 48027985 8000BF48 48027985 8000BF48 4802794D 8000BF48 480279C5 bl +0x00027984 /* 800338CC */
|
||||
8000BF4C 80010014 8000BF4C 80010014 8000BF4C 80010014 8000BF4C 80010014 8000BF4C 80010014 8000BF4C 80010014 8000BF4C 80010014 8000BF4C 80010014 lwz r0, [r1 + 0x0014]
|
||||
8000BF50 7C0803A6 8000BF50 7C0803A6 8000BF50 7C0803A6 8000BF50 7C0803A6 8000BF50 7C0803A6 8000BF50 7C0803A6 8000BF50 7C0803A6 8000BF50 7C0803A6 mtlr r0
|
||||
8000BF54 38210010 8000BF54 38210010 8000BF54 38210010 8000BF54 38210010 8000BF54 38210010 8000BF54 38210010 8000BF54 38210010 8000BF54 38210010 addi r1, r1, 0x0010
|
||||
8000BF58 4E800020 8000BF58 4E800020 8000BF58 4E800020 8000BF58 4E800020 8000BF58 4E800020 8000BF58 4E800020 8000BF58 4E800020 8000BF58 4E800020 blr
|
||||
80110D94 4BEFB19C 80110F94 4BEFAF9C 80111080 4BEFAEB0 80110F20 4BEFB010 80111038 4BEFAEF8 80111038 4BEFAEF8 80110F30 4BEFB000 80111114 4BEFAE1C b -0x00105108 /* 8000BF30 */
|
||||
|
||||
Invisible Mag
|
||||
InvisibleMag
|
||||
*** name=Invisible MAG
|
||||
*** desc=Make MAGs invisible
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80114F04 480000D4 80115118 480000D4 8011521C 480000D4 801150B0 480000D4 801151A8 480000D4 801151A8 480000D4 801150C0 480000D4 80115298 480000D4 b +0x000000D4 /* 8011527C */
|
||||
|
||||
16:9 Aspect Ratio
|
||||
169AspectRatioV1
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
80000088 C04210F0 80000088 C0421120 80000088 C0421130 80000088 C0421130 80000088 C0421108 80000088 C0421108 80000088 C0421138 80000088 C0421128 lfs f2, [r2 + 0x1108]
|
||||
8000008C EFBD00B2 8000008C EFBD00B2 8000008C EFBD00B2 8000008C EFBD00B2 8000008C EFBD00B2 8000008C EFBD00B2 8000008C EFBD00B2 8000008C EFBD00B2 fmuls f29, f29, f2
|
||||
80000090 FC40E890 80000090 FC40E890 80000090 FC40E890 80000090 FC40E890 80000090 FC40E890 80000090 FC40E890 80000090 FC40E890 80000090 FC40E890 fmr f2, f29
|
||||
80000094 483D1D98 80000094 483D47A0 80000094 483D6640 80000094 483D63F0 80000094 483D3068 80000094 483D30C0 80000094 483D67C0 80000094 483D52B0 b +0x003D3068 /* 803D30FC */
|
||||
803D1E28 4BC2E260 803D4830 4BC2B858 803D66D0 4BC299B8 803D6480 4BC29C08 803D30F8 4BC2CF90 803D3150 4BC2CF38 803D6850 4BC29838 803D5340 4BC2AD48 b -0x003D3070 /* 80000088 */
|
||||
|
||||
16:9 Aspect Ratio V2
|
||||
169AspectRatioV2
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000BE4C C01C0040 8000BE4C C01C0040 8000BE4C C01C0040 8000BE4C C01C0040 8000BE4C C01C0040 8000BE4C C01C0040 8000BE4C C01C0040 8000BE4C C01C0040 lfs f0, [r28 + 0x0040]
|
||||
8000BE50 C062F7C0 8000BE50 C062F7C8 8000BE50 C062F7C8 8000BE50 C062F7C8 8000BE50 C062F7D0 8000BE50 C062F7D0 8000BE50 C062F7D0 8000BE50 C062F7D0 lfs f3, [r2 - 0x0830]
|
||||
8000BE54 EC4100FA 8000BE54 EC4100FA 8000BE54 EC4100FA 8000BE54 EC4100FA 8000BE54 EC4100FA 8000BE54 EC4100FA 8000BE54 EC4100FA 8000BE54 EC4100FA fmadds f2, f1, f0, f3
|
||||
8000BE58 C062E3EC 8000BE58 C062E3F4 8000BE58 C062E3F4 8000BE58 C062E3F4 8000BE58 C062E3FC 8000BE58 C062E3FC 8000BE58 C062E3FC 8000BE58 C062E3FC lfs f3, [r2 - 0x1C04]
|
||||
8000BE5C 48253B0C 8000BE5C 482546E4 8000BE5C 48255768 8000BE5C 482554E0 8000BE5C 482543E4 8000BE5C 482543E4 8000BE5C 482557A4 8000BE5C 48254FEC b +0x002543E4 /* 80260240 */
|
||||
8000BE60 C0030010 8000BE60 C0030010 8000BE60 C0030010 8000BE60 C0030010 8000BE60 C0030010 8000BE60 C0030010 8000BE60 C0030010 8000BE60 C0030010 lfs f0, [r3 + 0x0010]
|
||||
8000BE64 C0240000 8000BE64 C0240000 8000BE64 C0240000 8000BE64 C0240000 8000BE64 C0240000 8000BE64 C0240000 8000BE64 C0240000 8000BE64 C0240000 lfs f1, [r4]
|
||||
8000BE68 EC210028 8000BE68 EC210028 8000BE68 EC210028 8000BE68 EC210028 8000BE68 EC210028 8000BE68 EC210028 8000BE68 EC210028 8000BE68 EC210028 fsubs f1, f1, f0
|
||||
8000BE6C C082F7C0 8000BE6C C082F7C8 8000BE6C C082F7C8 8000BE6C C082F7C8 8000BE6C C082F7D0 8000BE6C C082F7D0 8000BE6C C082F7D0 8000BE6C C082F7D0 lfs f4, [r2 - 0x0830]
|
||||
8000BE70 EC84007A 8000BE70 EC84007A 8000BE70 EC84007A 8000BE70 EC84007A 8000BE70 EC84007A 8000BE70 EC84007A 8000BE70 EC84007A 8000BE70 EC84007A fmadds f4, f4, f0, f1
|
||||
8000BE74 C0030038 8000BE74 C0030038 8000BE74 C0030038 8000BE74 C0030038 8000BE74 C0030038 8000BE74 C0030038 8000BE74 C0030038 8000BE74 C0030038 lfs f0, [r3 + 0x0038]
|
||||
8000BE78 48250454 8000BE78 48250FFC 8000BE78 48251FCC 8000BE78 48251CF0 8000BE78 48250D2C 8000BE78 48250D2C 8000BE78 48251FB4 8000BE78 482517FC b +0x00250D2C /* 8025CBA4 */
|
||||
8000BE7C C01E0008 8000BE7C C01E0008 8000BE7C C01E0008 8000BE7C C01E0008 8000BE7C C01E0008 8000BE7C C01E0008 8000BE7C C01E0008 8000BE7C C01E0008 lfs f0, [r30 + 0x0008]
|
||||
8000BE80 C082F7C0 8000BE80 C082F7C8 8000BE80 C082F7C8 8000BE80 C082F7C8 8000BE80 C082F7D0 8000BE80 C082F7D0 8000BE80 C082F7D0 8000BE80 C082F7D0 lfs f4, [r2 - 0x0830]
|
||||
8000BE84 EC040032 8000BE84 EC040032 8000BE84 EC040032 8000BE84 EC040032 8000BE84 EC040032 8000BE84 EC040032 8000BE84 EC040032 8000BE84 EC040032 fmuls f0, f4, f0
|
||||
8000BE88 ECA400F2 8000BE88 ECA400F2 8000BE88 ECA400F2 8000BE88 ECA400F2 8000BE88 ECA400F2 8000BE88 ECA400F2 8000BE88 ECA400F2 8000BE88 ECA400F2 fmuls f5, f4, f3
|
||||
8000BE8C 48235FE0 8000BE8C 482369C0 8000BE8C 48237920 8000BE8C 482376B4 8000BE8C 482368BC 8000BE8C 482368BC 8000BE8C 482379E8 8000BE8C 48237230 b +0x002368BC /* 80242748 */
|
||||
8000BE90 C082F7C0 8000BE90 C082F7C8 8000BE90 C082F7C8 8000BE90 C082F7C8 8000BE90 C082F7D0 8000BE90 C082F7D0 8000BE90 C082F7D0 8000BE90 C082F7D0 lfs f4, [r2 - 0x0830]
|
||||
8000BE94 EC04083A 8000BE94 EC04083A 8000BE94 EC04083A 8000BE94 EC04083A 8000BE94 EC04083A 8000BE94 EC04083A 8000BE94 EC04083A 8000BE94 EC04083A fmadds f0, f4, f1, f0
|
||||
8000BE98 EC8400F2 8000BE98 EC8400F2 8000BE98 EC8400F2 8000BE98 EC8400F2 8000BE98 EC8400F2 8000BE98 EC8400F2 8000BE98 EC8400F2 8000BE98 EC8400F2 fmuls f4, f4, f3
|
||||
8000BE9C 48236030 8000BE9C 48236A10 8000BE9C 48237970 8000BE9C 48237704 8000BE9C 4823690C 8000BE9C 4823690C 8000BE9C 48237A38 8000BE9C 48237280 b +0x0023690C /* 802427A8 */
|
||||
8000BEA0 C0060000 8000BEA0 C0060000 8000BEA0 C0060000 8000BEA0 C0060000 8000BEA0 C0060000 8000BEA0 C0060000 8000BEA0 C0060000 8000BEA0 C0060000 lfs f0, [r6]
|
||||
8000BEA4 C042F7C0 8000BEA4 C042F7C8 8000BEA4 C042F7C8 8000BEA4 C042F7C8 8000BEA4 C042F7D0 8000BEA4 C042F7D0 8000BEA4 C042F7D0 8000BEA4 C042F7D0 lfs f2, [r2 - 0x0830]
|
||||
8000BEA8 EC020032 8000BEA8 EC020032 8000BEA8 EC020032 8000BEA8 EC020032 8000BEA8 EC020032 8000BEA8 EC020032 8000BEA8 EC020032 8000BEA8 EC020032 fmuls f0, f2, f0
|
||||
8000BEAC 482411F8 8000BEAC 48241C44 8000BEAC 48242B84 8000BEAC 48242938 8000BEAC 48241A80 8000BEAC 48241A80 8000BEAC 48242BFC 8000BEAC 48242444 b +0x00241A80 /* 8024D92C */
|
||||
8000BEB0 C04210F0 8000BEB0 C0421120 8000BEB0 C0421130 8000BEB0 C0421130 8000BEB0 C0421108 8000BEB0 C0421108 8000BEB0 C0421138 8000BEB0 C0421128 lfs f2, [r2 + 0x1108]
|
||||
8000BEB4 EFBD00B2 8000BEB4 EFBD00B2 8000BEB4 EFBD00B2 8000BEB4 EFBD00B2 8000BEB4 EFBD00B2 8000BEB4 EFBD00B2 8000BEB4 EFBD00B2 8000BEB4 EFBD00B2 fmuls f29, f29, f2
|
||||
8000BEB8 FC40E890 8000BEB8 FC40E890 8000BEB8 FC40E890 8000BEB8 FC40E890 8000BEB8 FC40E890 8000BEB8 FC40E890 8000BEB8 FC40E890 8000BEB8 FC40E890 fmr f2, f29
|
||||
8000BEBC 483C5F70 8000BEBC 483C8978 8000BEBC 483CA818 8000BEBC 483CA5C8 8000BEBC 483C7240 8000BEBC 483C7298 8000BEBC 483CA998 8000BEBC 483C9488 b +0x003C7240 /* 803D30FC */
|
||||
80241E68 4BDCA014 80242848 4BDC9634 802437A8 4BDC86D4 8024353C 4BDC8940 80242744 4BDC9738 80242744 4BDC9738 80243870 4BDC860C 802430B8 4BDC8DC4 b -0x002368C8 /* 8000BE7C */
|
||||
80241E74 EC25007A 80242854 EC25007A 802437B4 EC25007A 80243548 EC25007A 80242750 EC25007A 80242750 EC25007A 8024387C EC25007A 802430C4 EC25007A fmadds f1, f5, f0, f1
|
||||
80241EC8 4BDC9FC8 802428A8 4BDC95E8 80243808 4BDC8688 8024359C 4BDC88F4 802427A4 4BDC96EC 802427A4 4BDC96EC 802438D0 4BDC85C0 80243118 4BDC8D78 b -0x00236914 /* 8000BE90 */
|
||||
80241ED0 EC04007A 802428B0 EC04007A 80243810 EC04007A 802435A4 EC04007A 802427AC EC04007A 802427AC EC04007A 802438D8 EC04007A 80243120 EC04007A fmadds f0, f4, f0, f1
|
||||
8024D0A0 4BDBEE00 8024DAEC 4BDBE3B4 8024EA2C 4BDBD474 8024E7E0 4BDBD6C0 8024D928 4BDBE578 8024D928 4BDBE578 8024EAA4 4BDBD3FC 8024E2EC 4BDBDBB4 b -0x00241A88 /* 8000BEA0 */
|
||||
8025C2C8 4BDAFB98 8025CE70 4BDAEFF0 8025DE40 4BDAE020 8025DB64 4BDAE2FC 8025CBA0 4BDAF2C0 8025CBA0 4BDAF2C0 8025DE28 4BDAE038 8025D670 4BDAE7F0 b -0x00250D40 /* 8000BE60 */
|
||||
8025C324 60000000 8025CECC 60000000 8025DE9C 60000000 8025DBC0 60000000 8025CBFC 60000000 8025CBFC 60000000 8025DE84 60000000 8025D6CC 60000000 nop
|
||||
8025F964 4BDAC4E8 8026053C 4BDAB910 802615C0 4BDAA88C 80261338 4BDAAB14 8026023C 4BDABC10 8026023C 4BDABC10 802615FC 4BDAA850 80260E44 4BDAB008 b -0x002543F0 /* 8000BE4C */
|
||||
8025F974 EC421828 8026054C EC421828 802615D0 EC421828 80261348 EC421828 8026024C EC421828 8026024C EC421828 8026160C EC421828 80260E54 EC421828 fsubs f2, f2, f3
|
||||
803D1E28 4BC3A088 803D4830 4BC37680 803D66D0 4BC357E0 803D6480 4BC35A30 803D30F8 4BC38DB8 803D3150 4BC38D60 803D6850 4BC35660 803D5340 4BC36B70 b -0x003C7248 /* 8000BEB0 */
|
||||
8044B3E0 432A0000 8044E200 432A0000 80450268 432A0000 80450030 432A0000 8044C170 432A0000 8044C5F0 432A0000 8044FEE8 432A0000 8044FCE8 432A0000 bc 25, 10, +0x00000000 /* 8044C170 */
|
||||
8044B3F0 43FB8000 8044E210 43FB8000 80450278 43FB8000 80450040 43FB8000 8044C180 43FB8000 8044C600 43FB8000 8044FEF8 43FB8000 8044FCF8 43FB8000 bc 31, 27, -0x00008000 /* 80444180 */
|
||||
8044B488 43540000 8044E2A8 43540000 80450310 43540000 804500D8 43540000 8044C218 43540000 8044C698 43540000 8044FF90 43540000 8044FD90 43540000 bc 26, 20, +0x00000000 /* 8044C218 */
|
||||
8044B490 43860000 8044E2B0 43860000 80450318 43860000 804500E0 43860000 8044C220 43860000 8044C6A0 43860000 8044FF98 43860000 8044FD98 43860000 bc 28, 6, +0x00000000 /* 8044C220 */
|
||||
8044B858 42B00000 8044E678 42B00000 804506E0 42B00000 804504A8 42B00000 8044C5E8 42B00000 8044CA68 42B00000 80450360 42B00000 80450160 42B00000 b cr4, +0x00000000 /* 8044C5E8 */
|
||||
8044B968 430A0000 8044E788 430A0000 804507F0 430A0000 804505B8 430A0000 8044C6F8 430A0000 8044CB78 430A0000 80450470 430A0000 80450270 430A0000 bc 24, 10, +0x00000000 /* 8044C6F8 */
|
||||
8044B970 43160000 8044E790 43160000 804507F8 43160000 804505C0 43160000 8044C700 43160000 8044CB80 43160000 80450478 43160000 80450278 43160000 bc 24, 22, +0x00000000 /* 8044C700 */
|
||||
804CBCA8 44420000 804CF3F8 44420000 804D1948 44420000 804D16E8 44420000 804CC478 44420000 804CC958 44420000 804D0FC0 44420000 804D13B0 44420000 .invalid sc
|
||||
804EA678 42780000 804EDDF8 42780000 804F0410 42780000 804F01B0 42780000 804EAEB0 42780000 804EB390 42780000 804EFAC0 42780000 804F0998 42780000 bc 19, 24, +0x00000000 /* 804EAEB0 */
|
||||
804EA680 42B00000 804EDE00 42B00000 804F0418 42B00000 804F01B8 42B00000 804EAEB8 42B00000 804EB398 42B00000 804EFAC8 42B00000 804F09A0 42B00000 b cr4, +0x00000000 /* 804EAEB8 */
|
||||
805CBB58 00000000 805D6158 00000000 805DD5F8 00000000 805DD398 00000000 805CC460 00000000 805D3480 00000000 805DCCA0 00000000 805D8EE0 00000000 .invalid
|
||||
805CC360 44214000 805D6968 44214000 805DDE08 44214000 805DDBA8 44214000 805CCC70 44214000 805D3C90 44214000 805DD4B0 44214000 805D96F0 44214000 .invalid sc
|
||||
805CC36C 43A48000 805D6974 43A48000 805DDE14 43A48000 805DDBB4 43A48000 805CCC7C 43A48000 805D3C9C 43A48000 805DD4BC 43A48000 805D96FC 43A48000 b cr1, -0x00008000 /* 805C4C7C */
|
||||
805CC390 44214000 805D6998 44214000 805DDE38 44214000 805DDBD8 44214000 805CCCA0 44214000 805D3CC0 44214000 805DD4E0 44214000 805D9720 44214000 .invalid sc
|
||||
805CC768 42280000 805D6D70 42280000 805DE210 42280000 805DDFB0 42280000 805CD078 42280000 805D4098 42280000 805DD8B8 42280000 805D9AF8 42280000 bdnz cr2, +0x00000000 /* 805CD078 */
|
||||
805CCFAC 3F800000 805D75B4 3F800000 805DEA54 3F800000 805DE7F4 3F800000 805CD8BC 3F800000 805D48DC 3F800000 805DE0FC 3F800000 805DA33C 3F800000 lis r28, 0x0000
|
||||
805CCFC0 41980000 805D75C8 41980000 805DEA68 41980000 805DE808 41980000 805CD8D0 41980000 805D48F0 41980000 805DE110 41980000 805DA350 41980000 blt cr6, +0x00000000 /* 805CD8D0 */
|
||||
805CCFE0 43180000 805D75E8 43180000 805DEA88 43180000 805DE828 43180000 805CD8F0 43180000 805D4910 43180000 805DE130 43180000 805DA370 43180000 bdnz cr6, +0x00000000 /* 805CD8F0 */
|
||||
|
||||
Water & Light Effects Aspect Ratio Fix (for use with a 16:9 code)
|
||||
169AmbientEffectsFix
|
||||
JP12------------- JP13------------- JP14------------- JP15------------- US10------------- US11------------- US12------------- EU--------------- DISASSEMBLY (US10)
|
||||
8000BDF0 C36210F0 8000BDF0 C3621120 8000BDF0 C3621130 8000BDF0 C3621130 8000BDF0 C3621108 8000BDF0 C3621108 8000BDF0 C3621138 8000BDF0 C3621128 lfs f27, [r2 + 0x1108]
|
||||
8000BDF4 EC4206F2 8000BDF4 EC4206F2 8000BDF4 EC4206F2 8000BDF4 EC4206F2 8000BDF4 EC4206F2 8000BDF4 EC4206F2 8000BDF4 EC4206F2 8000BDF4 EC4206F2 fmuls f2, f2, f27
|
||||
8000BDF8 FF601090 8000BDF8 FF601090 8000BDF8 FF601090 8000BDF8 FF601090 8000BDF8 FF601090 8000BDF8 FF601090 8000BDF8 FF601090 8000BDF8 FF601090 fmr f27, f2
|
||||
8000BDFC 48366614 8000BDFC 48368D80 8000BDFC 4836AC1C 8000BDFC 4836A9D0 8000BDFC 48367658 8000BDFC 4836769C 8000BDFC 4836AD9C 8000BDFC 483698C4 b +0x00367658 /* 80373454 */
|
||||
8037240C 4BC999E4 80374B78 4BC97278 80376A14 4BC953DC 803767C8 4BC95628 80373450 4BC989A0 80373494 4BC9895C 80376B94 4BC9525C 803756BC 4BC96734 b -0x00367660 /* 8000BDF0 */
|
||||
+2785
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,829 @@
|
||||
.version BB_V4
|
||||
.quest_num 65535
|
||||
.episode Episode1
|
||||
.max_players 0
|
||||
.name "title dummy"
|
||||
.short_desc "intro dummy"
|
||||
.long_desc "detail dummy"
|
||||
|
||||
start@0x0000:
|
||||
ret
|
||||
|
||||
label0001@0x0001:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "Greetings."
|
||||
message ...
|
||||
arg_pushs "We\'ve got an emergency\nsituation happening on\nRagol."
|
||||
add_msg ...
|
||||
arg_pushs "We need skilled hunters\nsuch as yourself to help\nus out."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0002@0x0002:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0003@0x0003:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0004@0x0004:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0005@0x0005:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0006@0x0006:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0007@0x0007:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0008@0x0008:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0009@0x0009:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0014@0x0014:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EA
|
||||
arg_pushs "A meteor impact formed\nan enormous Crater on\nRagol\'s surface."
|
||||
message ...
|
||||
arg_pushs "We believe that it may\nhold some clues as to\nwhat\'s going on, now."
|
||||
add_msg ...
|
||||
arg_pushs "Please, help us in\nwhatever way you can."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0015@0x0015:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EA
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0016@0x0016:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EA
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0017@0x0017:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EA
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0018@0x0018:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EA
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0019@0x0019:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EA
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label001E@0x001E:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "I\'ve been thinking for a\nwhile, now, and I find\nit strange."
|
||||
message ...
|
||||
arg_pushs "We had already detected\nthe meteor beforehand,\nright?"
|
||||
add_msg ...
|
||||
arg_pushs "So, then, how come..."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label001F@0x001F:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0020@0x0020:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0021@0x0021:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0022@0x0022:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0023@0x0023:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0024@0x0024:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0025@0x0025:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0026@0x0026:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0032@0x0032:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EC
|
||||
arg_pushs "There\'s been a meteor\nstrike!"
|
||||
message ...
|
||||
arg_pushs "A meteor!"
|
||||
add_msg ...
|
||||
arg_pushs "It looks like we were\nokay this time, but\nwhat if more come?"
|
||||
add_msg ...
|
||||
arg_pushs "We need to leave this\nplanet now!"
|
||||
add_msg ...
|
||||
arg_pushs "Err... Sorry, I guess\nI\'m overreacting."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0033@0x0033:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EC
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0034@0x0034:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EC
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0035@0x0035:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EC
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0036@0x0036:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EC
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0037@0x0037:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EC
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label003C@0x003C:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003F4
|
||||
arg_pushs "There\'s been a lot of\nmovement from people in\nuniform recently."
|
||||
message ...
|
||||
arg_pushs "There\'s talk of a simple\ninvestigation of the\nCrater, but..."
|
||||
add_msg ...
|
||||
arg_pushs "They seem a bit too tense\nfor such a \"simple\"\ninvestigation."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0046@0x0046:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003F5
|
||||
arg_pushs "Have you heard?"
|
||||
message ...
|
||||
arg_pushs "That shockwave was caused\nby a meteor that almost\nhit Pioneer 2!"
|
||||
add_msg ...
|
||||
arg_pushs "Evidently, it impacted\non the surface of\nRagol."
|
||||
add_msg ...
|
||||
arg_pushs "The whole situation\nseems weird."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0050@0x0050:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003F6
|
||||
arg_pushs "The people coming through\nhere seem to be getting\nmore and more nervous."
|
||||
message ...
|
||||
arg_pushs "Things on Pioneer 2 seem\nokay, but what\'s going on\ndown on Ragol?"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label005A@0x005A:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003F7
|
||||
arg_pushs "That shaking we felt was\nbecause of the meteor!"
|
||||
message ...
|
||||
arg_pushs "It gave me quite a\nshock, but I\'m glad\neveryone\'s okay!"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0064@0x0064:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003F8
|
||||
arg_pushs "You!\nYou!\nYou!"
|
||||
message ...
|
||||
arg_pushs "This is no time to\ngoof off!"
|
||||
add_msg ...
|
||||
arg_pushs "That shaking had my\neyes popping out of\nmy head!"
|
||||
add_msg ...
|
||||
arg_pushs "Aw, I\'m just teasing you.\nStill, this situation is\njust incredible!"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label006E@0x006E:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003FA
|
||||
arg_pushs "If you\'re hurt, head to\nthe Medical Center for\nsome aid!"
|
||||
message ...
|
||||
arg_pushs "Sometimes, courage is\nknowing when it\'s\nbetter to retreat."
|
||||
add_msg ...
|
||||
arg_pushs "Do your best, but\ndon\'t overdo it!"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0078@0x0078:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003FB
|
||||
arg_pushs "This teleporter will take\nyou down to the surface\nof Ragol."
|
||||
message ...
|
||||
arg_pushs "The investigation of the\nmeteor impact is not\nyet complete."
|
||||
add_msg ...
|
||||
arg_pushs "Please be prepared for\nany and all possible\ncontingencies."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0082@0x0082:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003FC
|
||||
arg_pushs "The military must be\ndispatched to deal with\nthis crisis."
|
||||
message ...
|
||||
arg_pushs "We must give our all,\nfor the sake of the\npeople."
|
||||
add_msg ...
|
||||
arg_pushs "That is a soldier\'s\nultimate duty."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label008C@0x008C:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003FD
|
||||
arg_pushs "It\'s shopping day!\nAnd yet again, I end\nup here..."
|
||||
message ...
|
||||
arg_pushs "..."
|
||||
add_msg ...
|
||||
arg_pushs "...hey, were you\njust listening in\non me?"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0096@0x0096:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003FF
|
||||
arg_pushs "This teleporter leads to\na battle training\nsimulator."
|
||||
message ...
|
||||
arg_pushs "The goal is to defeat as\nmany opponents as\npossible in a set time."
|
||||
add_msg ...
|
||||
arg_pushs "The simulator has been\ndesigned by the\ngovernment itself."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00A0@0x00A0:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000400
|
||||
arg_pushs "I wonder which one of\nus is stronger, between\nyou and I."
|
||||
message ...
|
||||
arg_pushs "I mean, I don\'t bear you\nany ill will, I\'m just\ncurious."
|
||||
add_msg ...
|
||||
arg_pushs "The simulator can make\nfor a good test of your\ntrue abilities."
|
||||
add_msg ...
|
||||
arg_pushs "In a real contest,\nthough, it all comes\ndown to luck."
|
||||
add_msg ...
|
||||
arg_pushs "The stronger opponent\ndoesn\'t always\nnecessarily succeed."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00AA@0x00AA:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000401
|
||||
arg_pushs "Experience and items here\ncan\'t be used elsewhere."
|
||||
message ...
|
||||
arg_pushs "My dad said that you\ncan\'t save them, and you\ncan\'t take them with you."
|
||||
add_msg ...
|
||||
arg_pushs "But I\'m just a kid. I\nreally don\'t know what\nhe\'s talking about."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00B4@0x00B4:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000402
|
||||
arg_pushs "Make sure that you don\'t\nget caught in your own\nTraps!"
|
||||
message ...
|
||||
arg_pushs "That\'s why my grandpa\nsaid. But I\'m just a kid,\nso I don\'t get it."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00BE@0x00BE:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000404
|
||||
arg_pushs "This teleporter won\'t \ntake you to Ragol."
|
||||
message ...
|
||||
arg_pushs "It\'ll bring you to a\ngovernment-designed\ntraining simulator."
|
||||
add_msg ...
|
||||
arg_pushs "I heard that it ranks\nhunters."
|
||||
add_msg ...
|
||||
arg_pushs "What a great simulator!"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00C8@0x00C8:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000405
|
||||
arg_pushs "Each stage has its own\nset of rules. Read them\nbefore starting a game."
|
||||
message ...
|
||||
arg_pushs "When a stage has been\ncleared, a title is given\nto allow you to progress."
|
||||
add_msg ...
|
||||
arg_pushs "You can play the same\nstages even after you\nhave cleared them."
|
||||
add_msg ...
|
||||
arg_pushs "I\'ve heard you\'ll receive\nwonderful rewards after\nclearing all the stages."
|
||||
add_msg ...
|
||||
arg_pushs "Good luck!"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00D2@0x00D2:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000406
|
||||
arg_pushs "Experience and items only\napply to the stage they\nwere earned on."
|
||||
message ...
|
||||
arg_pushs "That\'s what my dad told\nme, but I\'m just a kid.\nI don\'t understand."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00DC@0x00DC:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000407
|
||||
arg_pushs "Press TAB to see the\ntitle that you received."
|
||||
message ...
|
||||
arg_pushs "My grandpa told me that\nbefore, but I didn\'t pay\nattention then."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00E6@0x00E6:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000408
|
||||
arg_pushs "The emphasis of this\nsimulation is to help\nothers!"
|
||||
message ...
|
||||
arg_pushs "The simulation will end\nwhen any player in your\ngroup is dead."
|
||||
add_msg ...
|
||||
arg_pushs "Pay attention to each\nother\'s condition and\nhelp each other."
|
||||
add_msg ...
|
||||
arg_pushs "For example, when you\nhave a Force, give health\nitems to him or her."
|
||||
add_msg ...
|
||||
arg_pushs "Good luck!"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00E7@0x00E7:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000408
|
||||
arg_pushs "The emphasis of this\nsimulation is to help\nothers!"
|
||||
message ...
|
||||
arg_pushs "The simulation will end\nwhen all players in the\ngroup are dead."
|
||||
add_msg ...
|
||||
arg_pushs "Pay attention to each\nother\'s condition and\nhelp each other."
|
||||
add_msg ...
|
||||
arg_pushs "For example, when you\nhave a Force, give health\nitems to him or her."
|
||||
add_msg ...
|
||||
arg_pushs "Good luck!"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0320@0x0320:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000000
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label032A@0x032A:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000002
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label0334@0x0334:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000003
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label033E@0x033E:
|
||||
// Could not determine data type; disassembling as code
|
||||
gget 0x000B, r200
|
||||
gget 0x000C, r201
|
||||
gget 0x000D, r202
|
||||
gget 0x000E, r203
|
||||
gget 0x000F, r204
|
||||
gget 0x0010, r205
|
||||
gget 0x0011, r206
|
||||
gget 0x0012, r207
|
||||
gget 0x0013, r208
|
||||
gget 0x0014, r209
|
||||
gget 0x0015, r210
|
||||
gget 0x0016, r211
|
||||
gget 0x0017, r212
|
||||
gget 0x0018, r213
|
||||
gget 0x0019, r214
|
||||
gget 0x001A, r215
|
||||
gget 0x001E, r216
|
||||
gget 0x001F, r217
|
||||
gget 0x0020, r218
|
||||
gget 0x0021, r219
|
||||
gget 0x0022, r220
|
||||
gget 0x0028, r221
|
||||
gget 0x0029, r222
|
||||
gget 0x002A, r223
|
||||
gget 0x002B, r224
|
||||
gget 0x002C, r225
|
||||
gget 0x002D, r226
|
||||
gget 0x002E, r227
|
||||
gget 0x002F, r228
|
||||
gget 0x0030, r229
|
||||
jmpi_eq r208, 0x00000001, label033F /* 22F7 */
|
||||
arg_pushl 0x00000006
|
||||
bb_p2_menu ...
|
||||
gset 0x0013
|
||||
ret
|
||||
|
||||
label033F@0x033F:
|
||||
arg_pushl 0x00000006
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label0348@0x0348:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000005
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label0352@0x0352:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000004
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label035C@0x035C:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000001
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label0366@0x0366:
|
||||
// Could not determine data type; disassembling as code
|
||||
gget 0x000B, r200
|
||||
gget 0x000C, r201
|
||||
gget 0x000D, r202
|
||||
gget 0x000E, r203
|
||||
gget 0x000F, r204
|
||||
gget 0x0010, r205
|
||||
gget 0x0011, r206
|
||||
gget 0x0012, r207
|
||||
gget 0x0013, r208
|
||||
gget 0x0014, r209
|
||||
gget 0x0015, r210
|
||||
gget 0x0016, r211
|
||||
gget 0x0017, r212
|
||||
gget 0x0018, r213
|
||||
gget 0x0019, r214
|
||||
gget 0x001A, r215
|
||||
gget 0x001E, r216
|
||||
gget 0x001F, r217
|
||||
gget 0x0020, r218
|
||||
gget 0x0021, r219
|
||||
gget 0x0022, r220
|
||||
gget 0x0028, r221
|
||||
gget 0x0029, r222
|
||||
gget 0x002A, r223
|
||||
gget 0x002B, r224
|
||||
gget 0x002C, r225
|
||||
gget 0x002D, r226
|
||||
gget 0x002E, r227
|
||||
gget 0x002F, r228
|
||||
gget 0x0030, r229
|
||||
gget 0x03FA, r230
|
||||
jmpi_eq r230, 0x00000001, label0367 /* 24F6 */
|
||||
arg_pushl 0x00000419
|
||||
arg_pushs "How do you do?\nI\'m the new receptionist\nclerk, here!"
|
||||
message ...
|
||||
arg_pushs "My name is <color 5>Momoka<color 0>."
|
||||
add_msg ...
|
||||
arg_pushs "If you need help or would\nlike to see what we\'re\noffering, come see me."
|
||||
add_msg ...
|
||||
mesend
|
||||
gset 0x03FA
|
||||
arg_pushl 0x00000007
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label0367@0x0367:
|
||||
arg_pushl 0x00000007
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label0370@0x0370:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "I am Coren Tsu, a wandering merchant,\nyou could say."
|
||||
message ...
|
||||
arg_pushs "Please take some time to look at\nthe rare and wonderous goods\nI have been collecting."
|
||||
add_msg ...
|
||||
arg_pushs "If you spend a little meseta,\nyou could win a wonderful prize."
|
||||
add_msg ...
|
||||
arg_pushs "Well? Wanna try?"
|
||||
add_msg ...
|
||||
mesend
|
||||
arg_pushb 0x64
|
||||
arg_pushs "Yes\nNo"
|
||||
list ...
|
||||
switch_jmp r100, [label0371 /* 1750 */, label0372 /* 18C1 */]
|
||||
ret
|
||||
|
||||
label0371@0x0371:
|
||||
bb_get_number_in_pack r100
|
||||
jmpi_eq r100, 0x0000001E, label0373 /* 1984 */
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "You may win,\nyou may lose."
|
||||
message ...
|
||||
arg_pushs "But if you don't win,\ndon't take it out on me."
|
||||
add_msg ...
|
||||
arg_pushs "That's just the way\ngambling is, yes?"
|
||||
add_msg ...
|
||||
arg_pushs "Well then, how much\nmeseta do you want to pay?"
|
||||
add_msg ...
|
||||
arg_pushs "As long as you pay me,\nI'll give you a great service."
|
||||
add_msg ...
|
||||
mesend
|
||||
arg_pushb 0x65
|
||||
arg_pushs "1000 Meseta\n10000 Meseta\n100000 Meseta\nI'll stop"
|
||||
list ...
|
||||
switch_jmp r101, [label0374 /* 19FD */, label0375 /* 1A12 */, label0376 /* 1A27 */, label0377 /* 1A3C */]
|
||||
ret
|
||||
|
||||
label0372@0x0372:
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "Huh?"
|
||||
message ...
|
||||
arg_pushs "That's too bad..."
|
||||
add_msg ...
|
||||
arg_pushs "Well, these kind of things usually\nhave a chance to lose money. "
|
||||
add_msg ...
|
||||
arg_pushs "Let's keep this discreet."
|
||||
add_msg ...
|
||||
arg_pushs "If you feel up to it,\ntalk to me again."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0373@0x0373:
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "It seems you have\ntoo many items."
|
||||
message ...
|
||||
arg_pushs "First, go and\norganize your items,"
|
||||
add_msg ...
|
||||
arg_pushs "Then speak to me again."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0374@0x0374:
|
||||
get_slot_meseta r102
|
||||
jmpi_lt r102, 0x000003E8, label0378 /* 1AA3 */
|
||||
leti r102, 0x000003E8
|
||||
jmp label0379 /* 1B02 */
|
||||
ret
|
||||
|
||||
label0375@0x0375:
|
||||
get_slot_meseta r102
|
||||
jmpi_lt r102, 0x00002710, label0378 /* 1AA3 */
|
||||
leti r102, 0x00002710
|
||||
jmp label0379 /* 1B02 */
|
||||
ret
|
||||
|
||||
label0376@0x0376:
|
||||
get_slot_meseta r102
|
||||
jmpi_lt r102, 0x000186A0, label0378 /* 1AA3 */
|
||||
leti r102, 0x000186A0
|
||||
jmp label0379 /* 1B02 */
|
||||
ret
|
||||
|
||||
label0377@0x0377:
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "What?"
|
||||
message ...
|
||||
arg_pushs "You said you'd try,\nthen you said no."
|
||||
add_msg ...
|
||||
arg_pushs "People like that\nfail at everything."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0378@0x0378:
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "What the...?"
|
||||
message ...
|
||||
arg_pushs "You don't have the\nmeseta to pay me?"
|
||||
add_msg ...
|
||||
arg_pushs "I won't work with such\ncold hearted people."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0379@0x0379:
|
||||
get_client_id r100
|
||||
let r103, r100
|
||||
let r104, r102
|
||||
clear r105
|
||||
take_slot_meseta r103-r104, r105
|
||||
jmpi_eq r105, 0x00000000, label0378 /* 1AA3 */
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "You better pray..."
|
||||
message ...
|
||||
arg_pushs "for something good..."
|
||||
add_msg ...
|
||||
mesend
|
||||
clear r100
|
||||
|
||||
label037A@0x037A:
|
||||
arg_pushl 0x00000010
|
||||
se ...
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
addi r100, 0x0000000F
|
||||
jmpi_le r100, 0x0000005A, label037A /* 1B84 */
|
||||
arg_pushr r101
|
||||
bb_send_6xE2 ...
|
||||
clear r106
|
||||
clear r100
|
||||
|
||||
label037B@0x037B:
|
||||
sync
|
||||
bb_get_6xE3_status r106
|
||||
jmpi_eq r106, 0x00000001, label037C /* 1BEA */
|
||||
jmpi_eq r106, 0x00000002, label037D /* 1D24 */
|
||||
addi r100, 0x00000001
|
||||
jmpi_le r100, 0x0000012C, label037B /* 1BAE */
|
||||
arg_pushs "SERVER SEND ERROR"
|
||||
window_msg ...
|
||||
winend
|
||||
ret
|
||||
|
||||
label037C@0x037C:
|
||||
sync
|
||||
arg_pushl 0x00000001
|
||||
bgm ...
|
||||
arg_pushs "<bk>\nObtained <color 4><meseta_slot_prize><color 0>!"
|
||||
window_msg ...
|
||||
winend
|
||||
sync
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "Look here!\nTake it!"
|
||||
message ...
|
||||
arg_pushs "Even if you had bad luck,\nsomething good will come out of it."
|
||||
add_msg ...
|
||||
arg_pushs "You'll win someday!"
|
||||
add_msg ...
|
||||
arg_pushs "In case you want to try again,\ncome back to me once more."
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label037D@0x037D:
|
||||
arg_pushs "COMMAND EXECUTION ERROR"
|
||||
window_msg ...
|
||||
winend
|
||||
ret
|
||||
|
||||
nop
|
||||
nop
|
||||
@@ -0,0 +1,828 @@
|
||||
.version BB_V4
|
||||
.quest_num 65535
|
||||
.episode Episode1
|
||||
.max_players 0
|
||||
.name "title dummy"
|
||||
.short_desc "intro dummy"
|
||||
.long_desc "detail dummy"
|
||||
|
||||
start@0x0000:
|
||||
ret
|
||||
|
||||
label0001@0x0001:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "私が総督のタイレルだ。"
|
||||
message ...
|
||||
arg_pushs "現在、ラグオルでは\n異常事態が発生しておる。"
|
||||
add_msg ...
|
||||
arg_pushs "優秀なハンターズである\n君たちにも、ぜひ協力を頼む。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0002@0x0002:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0003@0x0003:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0004@0x0004:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0005@0x0005:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0006@0x0006:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0007@0x0007:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0008@0x0008:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0009@0x0009:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003E9
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0014@0x0014:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EA
|
||||
arg_pushs "隕石の落下により、\nラグオル地表に大規模な\nクレーターができました。"
|
||||
message ...
|
||||
arg_pushs "そこを発端とした\n一連の異常事態収拾に\nお力をお貸し下さい。"
|
||||
add_msg ...
|
||||
arg_pushs "ご協力をどうか\nよろしくお願いします。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0015@0x0015:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EA
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0016@0x0016:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EA
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0017@0x0017:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EA
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0018@0x0018:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EA
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0019@0x0019:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EA
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label001E@0x001E:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "この前から、ずっと\n考えていたのですが、\nおかしいんです。"
|
||||
message ...
|
||||
arg_pushs "あの隕石については\n我々も以前から\n察知はしていました。"
|
||||
add_msg ...
|
||||
arg_pushs "それなのに……"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label001F@0x001F:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0020@0x0020:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0021@0x0021:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0022@0x0022:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0023@0x0023:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0024@0x0024:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0025@0x0025:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0026@0x0026:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EB
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0032@0x0032:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EC
|
||||
arg_pushs "隕石が落ちたんだぞ!"
|
||||
message ...
|
||||
arg_pushs "隕石が!"
|
||||
add_msg ...
|
||||
arg_pushs "今、我々が無事だったとは言え、\nいつまた落ちてくるのかわからん!"
|
||||
add_msg ...
|
||||
arg_pushs "一刻も早く、この惑星から\n遠く離れるべきなんだよ!"
|
||||
add_msg ...
|
||||
arg_pushs "……おっと失礼。\n興奮しすぎたようだ。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0033@0x0033:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EC
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0034@0x0034:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EC
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0035@0x0035:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EC
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0036@0x0036:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EC
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0037@0x0037:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003EC
|
||||
arg_pushs "NO_TEXT"
|
||||
message ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label003C@0x003C:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003F4
|
||||
arg_pushs "最近、あの制服のやつらの\n動きがあわただしい。"
|
||||
message ...
|
||||
arg_pushs "隕石の調査だと言っているが\nはたして……?"
|
||||
add_msg ...
|
||||
arg_pushs "それにしても、\nあまりにも緊迫感があるが。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0046@0x0046:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003F5
|
||||
arg_pushs "知っているか……?"
|
||||
message ...
|
||||
arg_pushs "この前、このパイオニア2が\n激しく揺れたのは隕石が\nすぐ近くをかすめたせいさ。"
|
||||
add_msg ...
|
||||
arg_pushs "その隕石はその直後\nラグオルヘと衝突したらしい。"
|
||||
add_msg ...
|
||||
arg_pushs "しかし謎だらけだよ。\nこの事態は……"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0050@0x0050:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003F6
|
||||
arg_pushs "ここのところ、\nこのあたりを通る人に\n緊張感が感じられるわ。"
|
||||
message ...
|
||||
arg_pushs "パイオニア2の中は\n大丈夫だけど、ラグオルは\n大変なのかしら?"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label005A@0x005A:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003F7
|
||||
arg_pushs "この前の大きな揺れは\n隕石のせいだったんだね!"
|
||||
message ...
|
||||
arg_pushs "びっくりしたけど、\nみんなが無事でよかったよ。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0064@0x0064:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003F8
|
||||
arg_pushs "あんた!\nあんた!\nあんた!"
|
||||
message ...
|
||||
arg_pushs "そんなに、のんきに\nしている場合じゃないわよ!"
|
||||
add_msg ...
|
||||
arg_pushs "この前のあのすごい揺れ!\nあたしゃ目ん玉が飛び出たわよ!"
|
||||
add_msg ...
|
||||
arg_pushs "まぁ、冗談だけどね……\nそれくらいスゴかったってことよ!"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label006E@0x006E:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003FA
|
||||
arg_pushs "疲れて傷ついた体は\nメディカルセンターで\nリフレッシュ!"
|
||||
message ...
|
||||
arg_pushs "戦う勇気も必要だけど、\n時には撤退する勇気も必要よ。"
|
||||
add_msg ...
|
||||
arg_pushs "決して無理をせずに\nがんばってね!"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0078@0x0078:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003FB
|
||||
arg_pushs "ここの転送装置から\n惑星ラグオルヘと通じている。"
|
||||
message ...
|
||||
arg_pushs "惑星ラグオルは\n隕石衝突後の収拾が\n未だ完全ではない。"
|
||||
add_msg ...
|
||||
arg_pushs "何があろうと動じない\n準備と心構えを怠らぬようにな。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0082@0x0082:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003FC
|
||||
arg_pushs "我々軍部は、\n今回のような一大事では\n先陣を切って動かなければならん。"
|
||||
message ...
|
||||
arg_pushs "皆のために体を張って……"
|
||||
add_msg ...
|
||||
arg_pushs "軍人とはそういうものだ。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label008C@0x008C:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003FD
|
||||
arg_pushs "今日はお買い物日和ね。\nって、私ったら、\nまたここに来ちゃったわ。"
|
||||
message ...
|
||||
arg_pushs "…………"
|
||||
add_msg ...
|
||||
arg_pushs "……あら、聞こえちゃった?"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0096@0x0096:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x000003FF
|
||||
arg_pushs "バトルの申し込みをしたら、\n政府が 訓練のために作った\nシミュレータに転送されるよ。"
|
||||
message ...
|
||||
arg_pushs "決められた時間内に、どれだけ\n相手を倒したかを競うんだってさ。"
|
||||
add_msg ...
|
||||
arg_pushs "よくできた シミュレータだよねぇ!"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00A0@0x00A0:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000400
|
||||
arg_pushs "オレとお前、\nどっちが強いんだろう?"
|
||||
message ...
|
||||
arg_pushs "…って、ハンターズ同士で\n思ったことない?"
|
||||
add_msg ...
|
||||
arg_pushs "そんなときは、この訓練用\nシミュレータを使えば、\nあなたの 今の実力が判るわよ。"
|
||||
add_msg ...
|
||||
arg_pushs "勝負は 時の運…"
|
||||
add_msg ...
|
||||
arg_pushs "実力だけで\nおしはかれないことも あるけどね。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00AA@0x00AA:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000401
|
||||
arg_pushs "経験値やアイテムは その場限り。"
|
||||
message ...
|
||||
arg_pushs "セーブされないし\n持ち込んでも\n無くなることはねぇぜ。"
|
||||
add_msg ...
|
||||
arg_pushs "…って 父ちゃんが言ってたけど、\nボク 子供だから 何のことだか\nよく わからないや。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00B4@0x00B4:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000402
|
||||
arg_pushs "トラップは、置いてしばらくすると\n起動するから、自分で\n巻き込まれないよう 気をつけるんじゃぞ。"
|
||||
message ...
|
||||
arg_pushs "…って おじいちゃんが言ってたけど、\nボク 子供だから 何のことだか\nよく わからないや。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00BE@0x00BE:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000404
|
||||
arg_pushs "このエリアの転送装置は\nラグオルへ向かうものじゃないよ。"
|
||||
message ...
|
||||
arg_pushs "政府が 訓練のために作った\nシミュレータなんだ。"
|
||||
add_msg ...
|
||||
arg_pushs "ハンターのランク付けをするための\nものらしいよ。"
|
||||
add_msg ...
|
||||
arg_pushs "よくできた シミュレータだよねぇ!"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00C8@0x00C8:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000405
|
||||
arg_pushs "ステージごとに設定された状態から\nゲームをスタート!"
|
||||
message ...
|
||||
arg_pushs "ステージを制覇すると\nその証明に 称号が与えられ、\n次のステージに 進めるようになるの。"
|
||||
add_msg ...
|
||||
arg_pushs "一度クリアしたステージも、\n何度でも挑戦できるんだって。"
|
||||
add_msg ...
|
||||
arg_pushs "で、全ステージを制覇すると\n素敵なごほうびがもらえるらしいわ。"
|
||||
add_msg ...
|
||||
arg_pushs "がんばってね!"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00D2@0x00D2:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000406
|
||||
arg_pushs "経験値やアイテムは その場限り。\nセーブはされないよ。"
|
||||
message ...
|
||||
arg_pushs "…って 父ちゃんが言ってたけど、\nボク 子供だから 何のことだか\nよく わからないや。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00DC@0x00DC:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000407
|
||||
arg_pushs "与えられた称号は、ロビーで\nTabキーを押すと見ることが\nできるんじゃよ。"
|
||||
message ...
|
||||
arg_pushs "…って おじいちゃんが言ってたけど、\nボク 子供だから 何のことだか\nよく わからないや。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00E6@0x00E6:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000408
|
||||
arg_pushs "このシミュレータのテーマは\n「助け合いの試練」であぁる!"
|
||||
message ...
|
||||
arg_pushs "参加者のうち 1人でも\n戦えなくなったら、その時点で\nシミュレーションは終了となぁる!"
|
||||
add_msg ...
|
||||
arg_pushs "他の参加者のステータスに注意し、\nお互い助けあいながら\n進むがよかろう!"
|
||||
add_msg ...
|
||||
arg_pushs "フォースのように体力の弱い者が\n参加する場合は、回復系アイテム等を\nマメに渡してあげたりするといいぞぉ。"
|
||||
add_msg ...
|
||||
arg_pushs "では、健闘を祈る!"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label00E7@0x00E7:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000408
|
||||
arg_pushs "このシミュレータのテーマは\n「助け合いの試練」であぁる!"
|
||||
message ...
|
||||
arg_pushs "参加者 全員が\n戦えなくなったら、その時点で\nシミュレーションは終了となぁる!"
|
||||
add_msg ...
|
||||
arg_pushs "他の参加者のステータスに注意し、\nお互い助けあいながら\n進むがよかろう!"
|
||||
add_msg ...
|
||||
arg_pushs "フォースのように体力の弱い者が\n参加する場合は、回復系アイテム等を\nマメに渡してあげたりするといいぞぉ。"
|
||||
add_msg ...
|
||||
arg_pushs "では、健闘を祈る!"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0320@0x0320:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000000
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label032A@0x032A:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000002
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label0334@0x0334:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000003
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label033E@0x033E:
|
||||
// Could not determine data type; disassembling as code
|
||||
gget 0x000B, r200
|
||||
gget 0x000C, r201
|
||||
gget 0x000D, r202
|
||||
gget 0x000E, r203
|
||||
gget 0x000F, r204
|
||||
gget 0x0010, r205
|
||||
gget 0x0011, r206
|
||||
gget 0x0012, r207
|
||||
gget 0x0013, r208
|
||||
gget 0x0014, r209
|
||||
gget 0x0015, r210
|
||||
gget 0x0016, r211
|
||||
gget 0x0017, r212
|
||||
gget 0x0018, r213
|
||||
gget 0x0019, r214
|
||||
gget 0x001A, r215
|
||||
gget 0x001E, r216
|
||||
gget 0x001F, r217
|
||||
gget 0x0020, r218
|
||||
gget 0x0021, r219
|
||||
gget 0x0022, r220
|
||||
gget 0x0028, r221
|
||||
gget 0x0029, r222
|
||||
gget 0x002A, r223
|
||||
gget 0x002B, r224
|
||||
gget 0x002C, r225
|
||||
gget 0x002D, r226
|
||||
gget 0x002E, r227
|
||||
gget 0x002F, r228
|
||||
gget 0x0030, r229
|
||||
jmpi_eq r208, 0x00000001, label033F /* 14A3 */
|
||||
arg_pushl 0x00000006
|
||||
bb_p2_menu ...
|
||||
gset 0x0013
|
||||
ret
|
||||
|
||||
label033F@0x033F:
|
||||
arg_pushl 0x00000006
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label0348@0x0348:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000005
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label0352@0x0352:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000004
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label035C@0x035C:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000001
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label0366@0x0366:
|
||||
// Could not determine data type; disassembling as code
|
||||
gget 0x000B, r200
|
||||
gget 0x000C, r201
|
||||
gget 0x000D, r202
|
||||
gget 0x000E, r203
|
||||
gget 0x000F, r204
|
||||
gget 0x0010, r205
|
||||
gget 0x0011, r206
|
||||
gget 0x0012, r207
|
||||
gget 0x0013, r208
|
||||
gget 0x0014, r209
|
||||
gget 0x0015, r210
|
||||
gget 0x0016, r211
|
||||
gget 0x0017, r212
|
||||
gget 0x0018, r213
|
||||
gget 0x0019, r214
|
||||
gget 0x001A, r215
|
||||
gget 0x001E, r216
|
||||
gget 0x001F, r217
|
||||
gget 0x0020, r218
|
||||
gget 0x0021, r219
|
||||
gget 0x0022, r220
|
||||
gget 0x0028, r221
|
||||
gget 0x0029, r222
|
||||
gget 0x002A, r223
|
||||
gget 0x002B, r224
|
||||
gget 0x002C, r225
|
||||
gget 0x002D, r226
|
||||
gget 0x002E, r227
|
||||
gget 0x002F, r228
|
||||
gget 0x0030, r229
|
||||
gget 0x03FA, r230
|
||||
jmpi_eq r230, 0x00000001, label0367 /* 1612 */
|
||||
arg_pushl 0x00000419
|
||||
arg_pushs "はじめましてぇ。\n新しく総督府の受付事務員として\n配属となりました…"
|
||||
message ...
|
||||
arg_pushs "<color 5>モモカ<color 0>です。"
|
||||
add_msg ...
|
||||
arg_pushs "ふつつかものですが、\n今後とも よろしくお願いしますねぇ。"
|
||||
add_msg ...
|
||||
mesend
|
||||
gset 0x03FA
|
||||
arg_pushl 0x00000007
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label0367@0x0367:
|
||||
arg_pushl 0x00000007
|
||||
bb_p2_menu ...
|
||||
ret
|
||||
|
||||
label0370@0x0370:
|
||||
// Could not determine data type; disassembling as code
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "オレの名前はコレン・ツだ。\n人はオレを放浪商人と呼ぶ。"
|
||||
message ...
|
||||
arg_pushs "オレがかき集めた\nレアでアレなアイテムを\nここらでちょいとサバこうかと。"
|
||||
add_msg ...
|
||||
arg_pushs "それなりのお代を頂戴すれば、\n豪華商品が当たるやもしれない。\nいやいや、当たらぬかもしれない。"
|
||||
add_msg ...
|
||||
arg_pushs "ホラホラホラホラ、\nひとつヤッてみるかい?"
|
||||
add_msg ...
|
||||
mesend
|
||||
arg_pushb 0x64
|
||||
arg_pushs "はい\nいいえ"
|
||||
list ...
|
||||
switch_jmp r100, [label0371 /* 1750 */, label0372 /* 18C1 */]
|
||||
ret
|
||||
|
||||
label0371@0x0371:
|
||||
bb_get_number_in_pack r100
|
||||
jmpi_eq r100, 0x0000001E, label0373 /* 1984 */
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "当たるも八卦、\n当たらぬも八卦。"
|
||||
message ...
|
||||
arg_pushs "ロクなものが当たらぬ時は\nニブい自分をおうらみなさい。\nこれぞ合わせて八卦でござい。"
|
||||
add_msg ...
|
||||
arg_pushs "ギャンブルなんて\nそんなモン。"
|
||||
add_msg ...
|
||||
arg_pushs "さてさて、いかほどメセタを\nいただけるんで?"
|
||||
add_msg ...
|
||||
arg_pushs "お代の払いが縁の始まり、\n払いの額を選んでちょうだいな。"
|
||||
add_msg ...
|
||||
mesend
|
||||
arg_pushb 0x65
|
||||
arg_pushs "1000メセタ\n10000メセタ\n100000メセタ\nやっぱり止める"
|
||||
list ...
|
||||
switch_jmp r101, [label0374 /* 19FD */, label0375 /* 1A12 */, label0376 /* 1A27 */, label0377 /* 1A3C */]
|
||||
ret
|
||||
|
||||
label0372@0x0372:
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "ん?"
|
||||
message ...
|
||||
arg_pushs "そいつぁ残念だな。"
|
||||
add_msg ...
|
||||
arg_pushs "まあ、こういうモンはたいてい\n損をするかもしれないからな。"
|
||||
add_msg ...
|
||||
arg_pushs "慎重なのも悪かぁない。"
|
||||
add_msg ...
|
||||
arg_pushs "だけどソデ摺りあうも他生の縁。\n気が向いたら、また話しかけてくれ。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0373@0x0373:
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "こいつぁアイテムが\nいっぱいみたいだな。"
|
||||
message ...
|
||||
arg_pushs "マズは、アイテムを\n整理してきてくれ。"
|
||||
add_msg ...
|
||||
arg_pushs "オレとの縁はそれからだ。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0374@0x0374:
|
||||
get_slot_meseta r102
|
||||
jmpi_lt r102, 0x000003E8, label0378 /* 1AA3 */
|
||||
leti r102, 0x000003E8
|
||||
jmp label0379 /* 1B02 */
|
||||
ret
|
||||
|
||||
label0375@0x0375:
|
||||
get_slot_meseta r102
|
||||
jmpi_lt r102, 0x00002710, label0378 /* 1AA3 */
|
||||
leti r102, 0x00002710
|
||||
jmp label0379 /* 1B02 */
|
||||
ret
|
||||
|
||||
label0376@0x0376:
|
||||
get_slot_meseta r102
|
||||
jmpi_lt r102, 0x000186A0, label0378 /* 1AA3 */
|
||||
leti r102, 0x000186A0
|
||||
jmp label0379 /* 1B02 */
|
||||
ret
|
||||
|
||||
label0377@0x0377:
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "なんだ?"
|
||||
message ...
|
||||
arg_pushs "一度、やると言ったのに\n止めルのか。"
|
||||
add_msg ...
|
||||
arg_pushs "そういうヤツは\nなにやっても失敗するぞ。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0378@0x0378:
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "なんだ?"
|
||||
message ...
|
||||
arg_pushs "払うといった額のメセタを\n満たしてないのか?"
|
||||
add_msg ...
|
||||
arg_pushs "冷やかしならお断りだよ。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label0379@0x0379:
|
||||
get_client_id r100
|
||||
let r103, r100
|
||||
let r104, r102
|
||||
clear r105
|
||||
take_slot_meseta r103-r104, r105
|
||||
jmpi_eq r105, 0x00000000, label0378 /* 1AA3 */
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "当たる八卦は末広がりか。\nはたまた渋々うなだれ坊主か。"
|
||||
message ...
|
||||
arg_pushs "いいモンが当たる様に\n念じることだな。"
|
||||
add_msg ...
|
||||
mesend
|
||||
clear r100
|
||||
|
||||
label037A@0x037A:
|
||||
arg_pushl 0x00000010
|
||||
se ...
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
sync
|
||||
addi r100, 0x0000000F
|
||||
jmpi_le r100, 0x0000005A, label037A /* 1B84 */
|
||||
arg_pushr r101
|
||||
bb_send_6xE2 ...
|
||||
clear r106
|
||||
clear r100
|
||||
|
||||
label037B@0x037B:
|
||||
sync
|
||||
bb_get_6xE3_status r106
|
||||
jmpi_eq r106, 0x00000001, label037C /* 1BEA */
|
||||
jmpi_eq r106, 0x00000002, label037D /* 1D24 */
|
||||
addi r100, 0x00000001
|
||||
jmpi_le r100, 0x0000012C, label037B /* 1BAE */
|
||||
arg_pushs "サーバーセンドエラー"
|
||||
window_msg ...
|
||||
winend
|
||||
ret
|
||||
|
||||
label037C@0x037C:
|
||||
sync
|
||||
arg_pushl 0x00000001
|
||||
bgm ...
|
||||
arg_pushs "<bk>\n<color 4><meseta_slot_prize><color 0>を入手した!"
|
||||
window_msg ...
|
||||
winend
|
||||
sync
|
||||
arg_pushl 0x00000418
|
||||
arg_pushs "ほらよ!\nもっていきな!"
|
||||
message ...
|
||||
arg_pushs "ロクなモンが当たらなくても\n恨んじゃダメだよ、最初に言った。"
|
||||
add_msg ...
|
||||
arg_pushs "「ホラホラホラホラ」\nご了承済み。"
|
||||
add_msg ...
|
||||
arg_pushs "だけど今度は必ず当たる!"
|
||||
add_msg ...
|
||||
arg_pushs "かもしれないから、\nまたきてくれよ。"
|
||||
add_msg ...
|
||||
mesend
|
||||
ret
|
||||
|
||||
label037D@0x037D:
|
||||
arg_pushs "コマンド実行エラー"
|
||||
window_msg ...
|
||||
winend
|
||||
ret
|
||||
+1922
File diff suppressed because it is too large
Load Diff
+1920
File diff suppressed because it is too large
Load Diff
+1854
File diff suppressed because it is too large
Load Diff
+1930
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,96 @@
|
||||
###########################################################
|
||||
|
||||
NPC: Coren Tsu - The Wanderer
|
||||
AREAS: Pioneer 2
|
||||
|
||||
Translations by: apexseals (discord: apexseals)
|
||||
Proofing & Debugging by: nolrinale (github.com/nolrinale)
|
||||
|
||||
###########################################################
|
||||
|
||||
presentation:
|
||||
|
||||
I am Coren Tsu, a wandering merchant,
|
||||
you could say.
|
||||
|
||||
Please take some time to look at
|
||||
the rare and wonderous goods
|
||||
I have been collecting.
|
||||
|
||||
If you spend a little meseta,
|
||||
you could win a wonderful prize.
|
||||
|
||||
Well? Wanna try?
|
||||
|
||||
|
||||
You may win,
|
||||
you may lose.
|
||||
|
||||
But if you don't win,
|
||||
don't take it out on me.
|
||||
|
||||
That's just the way
|
||||
gambling is, yes?
|
||||
|
||||
Well then, how much
|
||||
meseta do you want to pay?
|
||||
|
||||
As long as you pay me,
|
||||
I'll give you a great service.
|
||||
|
||||
|
||||
Huh?
|
||||
|
||||
That's too bad...
|
||||
|
||||
Well, these kind of things usually
|
||||
have a chance to lose money.
|
||||
|
||||
Let's keep this discreet.
|
||||
If you feel up to it, talk to me again.
|
||||
|
||||
|
||||
It seems you have
|
||||
too many items.
|
||||
|
||||
First, go and
|
||||
organize your items,
|
||||
|
||||
Then speak to me again.
|
||||
|
||||
What?
|
||||
|
||||
You said you'd try,
|
||||
then you said no.
|
||||
|
||||
People like that
|
||||
fail at everything.
|
||||
|
||||
|
||||
What the...?
|
||||
|
||||
You don't have the
|
||||
meseta to pay me?
|
||||
|
||||
I won't work with such
|
||||
cold hearted people.
|
||||
|
||||
|
||||
Alright, let's do it.
|
||||
|
||||
You better pray
|
||||
for something good...
|
||||
|
||||
|
||||
Look here!
|
||||
Take it!
|
||||
|
||||
Even if you had bad luck,
|
||||
something good will come out of it.
|
||||
|
||||
You'll win someday!
|
||||
|
||||
In case you want to try again,
|
||||
come back to me once more.
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+35
-24
@@ -1,39 +1,50 @@
|
||||
#!/bin/env python3
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def get_ip_address(ifname):
|
||||
data = subprocess.check_output(['ifconfig', ifname])
|
||||
for line in data.splitlines():
|
||||
line = line.strip()
|
||||
if line.startswith(b'inet '):
|
||||
return line.split()[1].decode('ascii')
|
||||
raise RuntimeError('cannot get address for interface ' + ifname)
|
||||
data = subprocess.check_output(["ifconfig", ifname])
|
||||
for line in data.splitlines():
|
||||
line = line.strip()
|
||||
if line.startswith(b"inet "):
|
||||
return line.split()[1].decode("ascii")
|
||||
raise RuntimeError("cannot get address for interface " + ifname)
|
||||
|
||||
|
||||
def main(argv):
|
||||
if len(argv) < 2:
|
||||
raise RuntimeError(f'Usage: {argv[0]} <original-destination> [new-destination]')
|
||||
if os.geteuid() != 0:
|
||||
raise RuntimeError('You must use sudo to run this script')
|
||||
original_destination = argv[1]
|
||||
new_destination = argv[2] if len(argv) > 2 else get_ip_address('en0')
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--pid", "-p", type=int, default=0)
|
||||
parser.add_argument("orig_destination", type=str)
|
||||
parser.add_argument("new_destination", type=str, default=None, nargs="?")
|
||||
args = parser.parse_args()
|
||||
|
||||
print(f'Finding occurrences of \"{original_destination}\"')
|
||||
addresses_str = subprocess.check_output(['memwatch', 'Flycast.app', 'find', f'\"{original_destination}\"'])
|
||||
for line in addresses_str.splitlines():
|
||||
# line is like '(0) 00007FFF038500A0 (rw-)' (we care only about the address)
|
||||
tokens = line.split()
|
||||
if len(tokens) != 3:
|
||||
continue
|
||||
print(f'Replacing \"{original_destination}\" with \"{new_destination}\" at {tokens[1]} in Flycast')
|
||||
subprocess.check_call(['memwatch', 'Flycast.app', 'write', tokens[1], f'\"{new_destination}\" 00'])
|
||||
if os.geteuid() != 0:
|
||||
raise RuntimeError("You must use sudo to run this script")
|
||||
new_destination = args.new_destination or get_ip_address("en0")
|
||||
proc_arg = "Flycast.app" if args.pid == 0 else str(args.pid)
|
||||
|
||||
return 0
|
||||
print(f'Finding occurrences of "{args.orig_destination}"')
|
||||
addresses_str = subprocess.check_output(
|
||||
["memwatch", proc_arg, "find", f'"{args.orig_destination}"']
|
||||
)
|
||||
for line in addresses_str.splitlines():
|
||||
# line is like '(0) 00007FFF038500A0 (rw-)' (we care only about the address)
|
||||
tokens = line.split()
|
||||
if len(tokens) != 3:
|
||||
continue
|
||||
print(
|
||||
f'Replacing "{args.orig_destination}" with "{new_destination}" at {tokens[1]} in Flycast'
|
||||
)
|
||||
subprocess.check_call(
|
||||
["memwatch", proc_arg, "write", tokens[1], f'"{new_destination}" 00']
|
||||
)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
||||
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 364 B |
Binary file not shown.
|
Before Width: | Height: | Size: 364 B |
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 442 B |
@@ -2,7 +2,13 @@
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
inline void run_ar_code_translator(const std::string&, const std::string&, const std::string&) {
|
||||
throw std::runtime_error("resource_file is not available; install it and rebuild newserv");
|
||||
}
|
||||
|
||||
inline std::vector<std::pair<uint32_t, std::string>> diff_dol_files(const std::string&, const std::string&) {
|
||||
throw std::runtime_error("resource_file is not available; install it and rebuild newserv");
|
||||
}
|
||||
|
||||
+330
-83
@@ -1,99 +1,310 @@
|
||||
#include "ARCodeTranslator.hh"
|
||||
|
||||
#include <array>
|
||||
#include <future>
|
||||
#include <phosg/Filesystem.hh>
|
||||
#include <phosg/Strings.hh>
|
||||
#include <resource_file/ExecutableFormats/DOLFile.hh>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void run_ar_code_translator(const std::string& initial_directory, const std::string& use_file, const std::string& command) {
|
||||
string directory = initial_directory;
|
||||
while (ends_with(directory, "/")) {
|
||||
directory.resize(directory.size() - 1);
|
||||
}
|
||||
PrefixedLogger log("[ar-trans] ");
|
||||
class ARCodeTranslator {
|
||||
public:
|
||||
enum class ExpandMethod {
|
||||
FORWARD = 0,
|
||||
FORWARD_WITH_BARRIER,
|
||||
BACKWARD,
|
||||
BACKWARD_WITH_BARRIER,
|
||||
BOTH,
|
||||
BOTH_WITH_BARRIER,
|
||||
BOTH_IGNORE_ORIGIN,
|
||||
};
|
||||
|
||||
unordered_map<string, shared_ptr<DOLFile>> files;
|
||||
for (const auto& filename : list_directory(directory)) {
|
||||
if (ends_with(filename, ".dol")) {
|
||||
string name = filename.substr(0, filename.size() - 4);
|
||||
string path = directory + "/" + filename;
|
||||
files.emplace(name, new DOLFile(path.c_str()));
|
||||
log.info("Loaded %s", name.c_str());
|
||||
static const char* name_for_expand_method(ExpandMethod method) {
|
||||
switch (method) {
|
||||
case ExpandMethod::FORWARD:
|
||||
return "FORWARD";
|
||||
case ExpandMethod::FORWARD_WITH_BARRIER:
|
||||
return "FORWARD_WITH_BARRIER";
|
||||
case ExpandMethod::BACKWARD:
|
||||
return "BACKWARD";
|
||||
case ExpandMethod::BACKWARD_WITH_BARRIER:
|
||||
return "BACKWARD_WITH_BARRIER";
|
||||
case ExpandMethod::BOTH:
|
||||
return "BOTH";
|
||||
case ExpandMethod::BOTH_WITH_BARRIER:
|
||||
return "BOTH_WITH_BARRIER";
|
||||
case ExpandMethod::BOTH_IGNORE_ORIGIN:
|
||||
return "BOTH_IGNORE_ORIGIN";
|
||||
default:
|
||||
throw logic_error("invalid expand method");
|
||||
}
|
||||
}
|
||||
|
||||
string source_filename;
|
||||
shared_ptr<DOLFile> source_file;
|
||||
auto find_match = [&](std::shared_ptr<DOLFile> target_file, uint32_t source_address) -> uint32_t {
|
||||
const DOLFile::Section* source_section = nullptr;
|
||||
for (const auto& sec : source_file->sections) {
|
||||
if (source_address >= sec.address && source_address < sec.address + sec.data.size()) {
|
||||
source_section = &sec;
|
||||
ARCodeTranslator(const string& directory)
|
||||
: log("[ar-trans] "),
|
||||
directory(directory) {
|
||||
while (ends_with(this->directory, "/")) {
|
||||
this->directory.pop_back();
|
||||
}
|
||||
for (const auto& filename : list_directory(this->directory)) {
|
||||
if (ends_with(filename, ".dol")) {
|
||||
string name = filename.substr(0, filename.size() - 4);
|
||||
string path = directory + "/" + filename;
|
||||
this->files.emplace(name, make_shared<DOLFile>(path.c_str()));
|
||||
this->log.info("Loaded %s", name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
~ARCodeTranslator() = default;
|
||||
|
||||
const string& get_source_filename() const {
|
||||
return this->src_filename;
|
||||
}
|
||||
void set_source_file(const string& filename) {
|
||||
this->src_filename = filename;
|
||||
this->src_file = files.at(this->src_filename);
|
||||
}
|
||||
|
||||
void find_rtoc_global_regs() const {
|
||||
for (const auto& it : files) {
|
||||
bool r2_high_found = false;
|
||||
bool r2_low_found = false;
|
||||
bool r13_high_found = false;
|
||||
bool r13_low_found = false;
|
||||
uint32_t r2 = 0;
|
||||
uint32_t r13 = 0;
|
||||
for (const auto& section : it.second->sections) {
|
||||
if (!section.is_text) {
|
||||
continue;
|
||||
}
|
||||
StringReader r(section.data);
|
||||
while (!r.eof() && r.where()) {
|
||||
uint32_t opcode = r.get_u32b();
|
||||
if ((opcode & 0xFFFF0000) == 0x3DA00000) {
|
||||
if (r13_high_found) {
|
||||
throw runtime_error("multiple values for r13_high");
|
||||
}
|
||||
r13_high_found = true;
|
||||
r13 |= (opcode << 16);
|
||||
} else if ((opcode & 0xFFFF0000) == 0x3C400000) {
|
||||
if (r2_high_found) {
|
||||
throw runtime_error("multiple values for r2_high");
|
||||
}
|
||||
r2_high_found = true;
|
||||
r2 |= (opcode << 16);
|
||||
} else if ((opcode & 0xFFFF0000) == 0x61AD0000) {
|
||||
if (r13_low_found) {
|
||||
throw runtime_error("multiple values for r13_low");
|
||||
}
|
||||
r13_low_found = true;
|
||||
r13 |= (opcode & 0xFFFF);
|
||||
} else if ((opcode & 0xFFFF0000) == 0x60420000) {
|
||||
if (r2_low_found) {
|
||||
throw runtime_error("multiple values for r2_low");
|
||||
}
|
||||
r2_low_found = true;
|
||||
r2 |= (opcode & 0xFFFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (r2_low_found && r2_high_found) {
|
||||
fprintf(stderr, "(%s) r2 = %08" PRIX32 "\n", it.first.c_str(), r2);
|
||||
} else {
|
||||
fprintf(stderr, "(%s) r2 = __MISSING__\n", it.first.c_str());
|
||||
}
|
||||
if (r13_low_found && r13_high_found) {
|
||||
fprintf(stderr, "(%s) r13 = %08" PRIX32 "\n", it.first.c_str(), r13);
|
||||
} else {
|
||||
fprintf(stderr, "(%s) r13 = __MISSING__\n", it.first.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t find_match(shared_ptr<const DOLFile> dest_file, uint32_t src_address, ExpandMethod expand_method) const {
|
||||
if (!this->src_file) {
|
||||
throw runtime_error("no source file selected");
|
||||
}
|
||||
|
||||
const DOLFile::Section* src_section = nullptr;
|
||||
for (const auto& sec : this->src_file->sections) {
|
||||
if (src_address >= sec.address && src_address < sec.address + sec.data.size()) {
|
||||
src_section = &sec;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!source_section) {
|
||||
if (!src_section) {
|
||||
throw runtime_error("source address not within any section");
|
||||
}
|
||||
size_t source_offset = source_address - source_section->address;
|
||||
size_t source_bytes_available_after = source_section->data.size() - source_offset;
|
||||
log.info("(find_match) Source offset = %08zX with %08zX bytes available after", source_offset, source_bytes_available_after);
|
||||
|
||||
for (size_t match_length = 4;
|
||||
match_length < min<size_t>(source_bytes_available_after, 0x100);
|
||||
match_length += 4) {
|
||||
const char* method_token = this->name_for_expand_method(expand_method);
|
||||
|
||||
size_t src_offset = src_address - src_section->address;
|
||||
size_t src_bytes_available_before = src_offset;
|
||||
size_t src_bytes_available_after = src_section->data.size() - src_offset - 4;
|
||||
this->log.info("(find_match/%s) Source offset = %08zX with %zX/%zX bytes available before/after",
|
||||
method_token, src_offset, src_bytes_available_before, src_bytes_available_after);
|
||||
|
||||
size_t match_bytes_before = 0;
|
||||
size_t match_bytes_after = 0;
|
||||
while (match_bytes_before + match_bytes_after + 4 < 0x100) {
|
||||
size_t num_matches = 0;
|
||||
size_t last_match_address = 0;
|
||||
StringReader source_r(source_section->data.data() + source_offset, match_length);
|
||||
for (const auto& target_section : target_file->sections) {
|
||||
for (size_t target_section_offset = 0;
|
||||
target_section_offset + match_length <= target_section.data.size();
|
||||
target_section_offset += 4) {
|
||||
source_r.go(0);
|
||||
StringReader target_r(target_section.data.data() + target_section_offset, match_length);
|
||||
size_t match_length = match_bytes_before + match_bytes_after + 4;
|
||||
StringReader src_r(src_section->data.data() + src_offset - match_bytes_before, match_length);
|
||||
for (const auto& dest_section : dest_file->sections) {
|
||||
for (size_t dest_match_offset = 0;
|
||||
dest_match_offset < dest_section.data.size();
|
||||
dest_match_offset += 4) {
|
||||
src_r.go(0);
|
||||
StringReader dest_r(dest_section.data.data() + dest_match_offset, match_length);
|
||||
size_t z;
|
||||
for (z = 0; z < match_length; z += 4) {
|
||||
if (source_section->is_text) {
|
||||
uint32_t source_opcode = source_r.get_u32b();
|
||||
uint32_t target_opcode = target_r.get_u32b();
|
||||
uint32_t source_class = source_opcode & 0xFC000000;
|
||||
if (source_class != (target_opcode & 0xFC000000)) {
|
||||
if (expand_method == ExpandMethod::BOTH_IGNORE_ORIGIN && z == match_bytes_before) {
|
||||
src_r.skip(4);
|
||||
dest_r.skip(4);
|
||||
} else if (src_section->is_text) {
|
||||
uint32_t src_opcode = src_r.get_u32b();
|
||||
uint32_t dest_opcode = dest_r.get_u32b();
|
||||
uint32_t src_class = src_opcode & 0xFC000000;
|
||||
if (src_class != (dest_opcode & 0xFC000000)) {
|
||||
break;
|
||||
}
|
||||
if (source_class == 0x48000000) {
|
||||
source_opcode &= 0xFC000003;
|
||||
target_opcode &= 0xFC000003;
|
||||
} else if (source_class == 0x40000000) {
|
||||
source_opcode &= 0xFFFF0003;
|
||||
target_opcode &= 0xFFFF0003;
|
||||
if (src_class == 0x48000000) {
|
||||
// b +-offset
|
||||
src_opcode &= 0xFC000003;
|
||||
dest_opcode &= 0xFC000003;
|
||||
} else if (((src_opcode & 0xAC1F0000) == 0x800D0000) || ((src_opcode & 0xAC1F0000) == 0x80020000)) {
|
||||
// lwz/lfs rXX/fXX, [r2/r13 +- offset] OR stw/stfs [r2/r13 +- offset], rXX/fXX
|
||||
src_opcode &= 0xFFFF0000;
|
||||
dest_opcode &= 0xFFFF0000;
|
||||
}
|
||||
if (source_opcode != target_opcode) {
|
||||
if (src_opcode != dest_opcode) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (source_r.get_u32l() != target_r.get_u32l()) {
|
||||
uint32_t src_data = src_r.get_u32b();
|
||||
uint32_t dest_data = dest_r.get_u32b();
|
||||
if ((src_data & 0xFE000000) == 0x80000000) {
|
||||
src_data &= 0xFE000003;
|
||||
}
|
||||
if ((dest_data & 0xFE000000) == 0x80000000) {
|
||||
dest_data &= 0xFE000003;
|
||||
}
|
||||
if (src_data != dest_data) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (z == match_length) {
|
||||
num_matches++;
|
||||
last_match_address = target_section.address + target_section_offset;
|
||||
last_match_address = dest_section.address + dest_match_offset + match_bytes_before;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("(find_match) For match length %zX, %zu matches found", match_length, num_matches);
|
||||
this->log.info("(find_match/%s) For match length %zX, %zu matches found", method_token, match_length, num_matches);
|
||||
if (num_matches == 1) {
|
||||
return last_match_address;
|
||||
} else if (num_matches == 0) {
|
||||
throw runtime_error("did not find exactly one match");
|
||||
}
|
||||
bool can_expand_backward = false;
|
||||
bool can_expand_forward = false;
|
||||
switch (expand_method) {
|
||||
case ExpandMethod::BACKWARD_WITH_BARRIER:
|
||||
can_expand_backward = (src_r.pget_u32b(0) != 0x4E800020) &&
|
||||
(src_bytes_available_before >= match_bytes_before + 4);
|
||||
break;
|
||||
case ExpandMethod::BACKWARD:
|
||||
can_expand_backward = (src_bytes_available_before >= match_bytes_before + 4);
|
||||
break;
|
||||
case ExpandMethod::FORWARD_WITH_BARRIER:
|
||||
can_expand_forward = (src_r.pget_u32b(src_r.size() - 4) != 0x4E800020) &&
|
||||
(src_bytes_available_after >= match_bytes_after + 4);
|
||||
break;
|
||||
case ExpandMethod::FORWARD:
|
||||
can_expand_forward = (src_bytes_available_after >= match_bytes_after + 4);
|
||||
break;
|
||||
case ExpandMethod::BOTH_WITH_BARRIER:
|
||||
case ExpandMethod::BOTH_IGNORE_ORIGIN:
|
||||
can_expand_backward = (src_r.pget_u32b(0) != 0x4E800020) &&
|
||||
(src_bytes_available_before >= match_bytes_before + 4);
|
||||
can_expand_forward = (src_r.pget_u32b(src_r.size() - 4) != 0x4E800020) &&
|
||||
(src_bytes_available_after >= match_bytes_after + 4);
|
||||
break;
|
||||
case ExpandMethod::BOTH:
|
||||
can_expand_backward = (src_bytes_available_before >= match_bytes_before + 4);
|
||||
can_expand_forward = (src_bytes_available_after >= match_bytes_after + 4);
|
||||
break;
|
||||
default:
|
||||
throw logic_error("invalid expand method");
|
||||
}
|
||||
if (!can_expand_backward && !can_expand_forward) {
|
||||
throw runtime_error("no further expansion is allowed");
|
||||
}
|
||||
if (can_expand_backward) {
|
||||
match_bytes_before += 4;
|
||||
}
|
||||
if (can_expand_forward) {
|
||||
match_bytes_after += 4;
|
||||
}
|
||||
}
|
||||
throw runtime_error("scan field too long; too many matches");
|
||||
};
|
||||
}
|
||||
|
||||
auto handle_command = [&](const string& command) -> void {
|
||||
void find_all_matches(uint32_t src_addr) const {
|
||||
if (!this->src_file) {
|
||||
throw runtime_error("no source file selected");
|
||||
}
|
||||
|
||||
unordered_map<string, uint32_t> results;
|
||||
for (const auto& it : files) {
|
||||
if (it.second == this->src_file) {
|
||||
log.info("(%s) %08" PRIX32 " (from source)", it.first.c_str(), src_addr);
|
||||
results.emplace(it.first, src_addr);
|
||||
} else {
|
||||
|
||||
array<future<uint32_t>, 7> futures;
|
||||
static const array<ExpandMethod, 7> methods = {
|
||||
ExpandMethod::FORWARD,
|
||||
ExpandMethod::FORWARD_WITH_BARRIER,
|
||||
ExpandMethod::BACKWARD,
|
||||
ExpandMethod::BACKWARD_WITH_BARRIER,
|
||||
ExpandMethod::BOTH,
|
||||
ExpandMethod::BOTH_WITH_BARRIER,
|
||||
ExpandMethod::BOTH_IGNORE_ORIGIN,
|
||||
};
|
||||
for (size_t z = 0; z < methods.size(); z++) {
|
||||
futures[z] = async(&ARCodeTranslator::find_match, this, it.second, src_addr, methods[z]);
|
||||
}
|
||||
|
||||
unordered_set<uint32_t> match_addrs;
|
||||
for (size_t z = 0; z < futures.size(); z++) {
|
||||
const char* method_name = this->name_for_expand_method(methods[z]);
|
||||
try {
|
||||
uint32_t ret = futures[z].get();
|
||||
log.info("(%s) (%s) %08" PRIX32, it.first.c_str(), method_name, ret);
|
||||
match_addrs.emplace(ret);
|
||||
} catch (const exception& e) {
|
||||
log.error("(%s) (%s) failed: %s", it.first.c_str(), method_name, e.what());
|
||||
}
|
||||
}
|
||||
|
||||
if (match_addrs.empty()) {
|
||||
log.error("(%s) no match found", it.first.c_str());
|
||||
} else if (match_addrs.size() > 1) {
|
||||
log.error("(%s) different matches found by different methods", it.first.c_str());
|
||||
} else {
|
||||
results.emplace(it.first, *match_addrs.begin());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const auto& it : results) {
|
||||
fprintf(stdout, "%s => %08" PRIX32 "\n", it.first.c_str(), it.second);
|
||||
}
|
||||
}
|
||||
|
||||
void handle_command(const string& command) {
|
||||
auto tokens = split(command, ' ');
|
||||
if (tokens.empty()) {
|
||||
throw runtime_error("no command given");
|
||||
@@ -101,54 +312,90 @@ void run_ar_code_translator(const std::string& initial_directory, const std::str
|
||||
strip_trailing_whitespace(tokens[tokens.size() - 1]);
|
||||
|
||||
if (tokens[0] == "use") {
|
||||
source_filename = tokens.at(1);
|
||||
source_file = files.at(source_filename);
|
||||
this->set_source_file(tokens.at(1));
|
||||
} else if (tokens[0] == "match") {
|
||||
if (!source_file) {
|
||||
throw runtime_error("no source file selected");
|
||||
}
|
||||
|
||||
uint32_t source_addr = stoul(tokens.at(1), nullptr, 16);
|
||||
for (const auto& it : files) {
|
||||
if (it.second == source_file) {
|
||||
log.info("(%s) %08" PRIX32, it.first.c_str(), source_addr);
|
||||
} else {
|
||||
try {
|
||||
uint32_t match_addr = find_match(it.second, source_addr);
|
||||
log.info("(%s) %08" PRIX32, it.first.c_str(), match_addr);
|
||||
} catch (const exception& e) {
|
||||
log.error("(%s) failed: %s", it.first.c_str(), e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
this->find_all_matches(stoul(tokens.at(1), nullptr, 16));
|
||||
} else if (tokens[0] == "find-globals") {
|
||||
this->find_rtoc_global_regs();
|
||||
} else if (!tokens[0].empty()) {
|
||||
throw runtime_error("unknown command");
|
||||
}
|
||||
};
|
||||
|
||||
if (!use_file.empty()) {
|
||||
source_filename = use_file;
|
||||
source_file = files.at(source_filename);
|
||||
}
|
||||
|
||||
if (!command.empty()) {
|
||||
handle_command(command);
|
||||
} else {
|
||||
void run_shell() {
|
||||
while (!feof(stdin)) {
|
||||
if (!source_filename.empty()) {
|
||||
fprintf(stdout, "ar-trans:%s/%s> ", directory.c_str(), source_filename.c_str());
|
||||
if (!this->src_filename.empty()) {
|
||||
fprintf(stdout, "ar-trans:%s/%s> ", this->directory.c_str(), this->src_filename.c_str());
|
||||
} else {
|
||||
fprintf(stdout, "ar-trans:%s> ", directory.c_str());
|
||||
fprintf(stdout, "ar-trans:%s> ", this->directory.c_str());
|
||||
}
|
||||
fflush(stdout);
|
||||
|
||||
string command = fgets(stdin);
|
||||
try {
|
||||
handle_command(command);
|
||||
this->handle_command(command);
|
||||
} catch (const exception& e) {
|
||||
log.error("Failed: %s", e.what());
|
||||
this->log.error("Failed: %s", e.what());
|
||||
}
|
||||
}
|
||||
fputc('\n', stdout);
|
||||
}
|
||||
|
||||
private:
|
||||
PrefixedLogger log;
|
||||
string directory;
|
||||
unordered_map<string, shared_ptr<const DOLFile>> files;
|
||||
string src_filename;
|
||||
shared_ptr<const DOLFile> src_file;
|
||||
};
|
||||
|
||||
void run_ar_code_translator(const std::string& directory, const std::string& use_filename, const std::string& command) {
|
||||
ARCodeTranslator trans(directory);
|
||||
if (!use_filename.empty()) {
|
||||
trans.set_source_file(use_filename);
|
||||
}
|
||||
|
||||
if (!command.empty()) {
|
||||
trans.handle_command(command);
|
||||
} else {
|
||||
trans.run_shell();
|
||||
}
|
||||
}
|
||||
|
||||
vector<pair<uint32_t, string>> diff_dol_files(const string& a_filename, const string& b_filename) {
|
||||
DOLFile a(a_filename.c_str());
|
||||
DOLFile b(b_filename.c_str());
|
||||
auto a_mem = make_shared<MemoryContext>();
|
||||
auto b_mem = make_shared<MemoryContext>();
|
||||
a.load_into(a_mem);
|
||||
b.load_into(b_mem);
|
||||
|
||||
uint32_t min_addr = 0xFFFFFFFF;
|
||||
uint32_t max_addr = 0x00000000;
|
||||
for (const auto& sec : a.sections) {
|
||||
min_addr = min<uint32_t>(min_addr, sec.address);
|
||||
max_addr = max<uint32_t>(max_addr, sec.address + sec.data.size());
|
||||
}
|
||||
for (const auto& sec : b.sections) {
|
||||
min_addr = min<uint32_t>(min_addr, sec.address);
|
||||
max_addr = max<uint32_t>(max_addr, sec.address + sec.data.size());
|
||||
}
|
||||
|
||||
vector<pair<uint32_t, string>> ret;
|
||||
for (uint32_t addr = min_addr; addr < max_addr; addr += 4) {
|
||||
bool a_exists = a_mem->exists(addr, 4);
|
||||
bool b_exists = b_mem->exists(addr, 4);
|
||||
if (a_exists && b_exists) {
|
||||
string a_value = a_mem->read(addr, 4);
|
||||
string b_value = b_mem->read(addr, 4);
|
||||
if (a_value != b_value) {
|
||||
if (!ret.empty() && (ret.back().first + ret.back().second.size() == addr)) {
|
||||
ret.back().second += b_value;
|
||||
} else {
|
||||
ret.emplace_back(make_pair(addr, b_value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
void run_ar_code_translator(const std::string& initial_directory, const std::string& use_file, const std::string& command);
|
||||
std::vector<std::pair<uint32_t, std::string>> diff_dol_files(const std::string& a_filename, const std::string& b_filename);
|
||||
|
||||
+6
-6
@@ -78,13 +78,13 @@ void CatSession::on_channel_input(
|
||||
if (command == 0x02 || command == 0x17 || command == 0x91 || command == 0x9B) {
|
||||
const auto& cmd = check_size_t<S_ServerInitDefault_DC_PC_V3_02_17_91_9B>(data, 0xFFFF);
|
||||
if (uses_v3_encryption(this->channel.version)) {
|
||||
this->channel.crypt_in.reset(new PSOV3Encryption(cmd.server_key));
|
||||
this->channel.crypt_out.reset(new PSOV3Encryption(cmd.client_key));
|
||||
this->channel.crypt_in = make_shared<PSOV3Encryption>(cmd.server_key);
|
||||
this->channel.crypt_out = make_shared<PSOV3Encryption>(cmd.client_key);
|
||||
this->log.info("Enabled V3 encryption (server key %08" PRIX32 ", client key %08" PRIX32 ")",
|
||||
cmd.server_key.load(), cmd.client_key.load());
|
||||
} else { // PC, DC, or patch server
|
||||
this->channel.crypt_in.reset(new PSOV2Encryption(cmd.server_key));
|
||||
this->channel.crypt_out.reset(new PSOV2Encryption(cmd.client_key));
|
||||
this->channel.crypt_in = make_shared<PSOV2Encryption>(cmd.server_key);
|
||||
this->channel.crypt_out = make_shared<PSOV2Encryption>(cmd.client_key);
|
||||
this->log.info("Enabled V2 encryption (server key %08" PRIX32 ", client key %08" PRIX32 ")",
|
||||
cmd.server_key.load(), cmd.client_key.load());
|
||||
}
|
||||
@@ -95,8 +95,8 @@ void CatSession::on_channel_input(
|
||||
throw runtime_error("BB encryption requires a key file");
|
||||
}
|
||||
const auto& cmd = check_size_t<S_ServerInitDefault_BB_03_9B>(data, 0xFFFF);
|
||||
this->channel.crypt_in.reset(new PSOBBEncryption(*this->bb_key_file, &cmd.server_key[0], sizeof(cmd.server_key)));
|
||||
this->channel.crypt_out.reset(new PSOBBEncryption(*this->bb_key_file, &cmd.client_key[0], sizeof(cmd.client_key)));
|
||||
this->channel.crypt_in = make_shared<PSOBBEncryption>(*this->bb_key_file, &cmd.server_key[0], sizeof(cmd.server_key));
|
||||
this->channel.crypt_out = make_shared<PSOBBEncryption>(*this->bb_key_file, &cmd.client_key[0], sizeof(cmd.client_key));
|
||||
this->log.info("Enabled BB encryption");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,6 +292,7 @@ void Channel::send(uint16_t cmd, uint32_t flag, const std::vector<std::pair<cons
|
||||
}
|
||||
case Version::PC_PATCH:
|
||||
case Version::BB_PATCH:
|
||||
case Version::PC_NTE:
|
||||
case Version::PC_V2: {
|
||||
PSOCommandHeaderPC header;
|
||||
if (this->crypt_out.get()) {
|
||||
|
||||
+355
-164
@@ -52,12 +52,6 @@ static void check_version(shared_ptr<Client> c, Version version) {
|
||||
}
|
||||
}
|
||||
|
||||
static void check_not_version(shared_ptr<Client> c, Version version) {
|
||||
if (c->version() == version) {
|
||||
throw precondition_failed("$C6This command cannot\nbe used for your\nversion of PSO.");
|
||||
}
|
||||
}
|
||||
|
||||
static void check_is_game(shared_ptr<Lobby> l, bool is_game) {
|
||||
if (l->is_game() != is_game) {
|
||||
throw precondition_failed(is_game ? "$C6This command cannot\nbe used in lobbies." : "$C6This command cannot\nbe used in games.");
|
||||
@@ -70,20 +64,20 @@ static void check_is_ep3(shared_ptr<Client> c, bool is_ep3) {
|
||||
}
|
||||
}
|
||||
|
||||
static void check_cheats_enabled(shared_ptr<Lobby> l) {
|
||||
if (!l->check_flag(Lobby::Flag::CHEATS_ENABLED)) {
|
||||
static void check_cheats_enabled(shared_ptr<Lobby> l, shared_ptr<Client> c) {
|
||||
if (!l->check_flag(Lobby::Flag::CHEATS_ENABLED) && !(c->license->flags & License::Flag::CHEAT_ANYWHERE)) {
|
||||
throw precondition_failed("$C6This command can\nonly be used in\ncheat mode.");
|
||||
}
|
||||
}
|
||||
|
||||
static void check_cheats_allowed(shared_ptr<ServerState> s) {
|
||||
if (s->cheat_mode_behavior == ServerState::BehaviorSwitch::OFF) {
|
||||
static void check_cheats_allowed(shared_ptr<ServerState> s, shared_ptr<Client> c) {
|
||||
if ((s->cheat_mode_behavior == ServerState::BehaviorSwitch::OFF) && !(c->license->flags & License::Flag::CHEAT_ANYWHERE)) {
|
||||
throw precondition_failed("$C6Cheats are disabled\non this server.");
|
||||
}
|
||||
}
|
||||
|
||||
static void check_proxy_cheats_allowed(shared_ptr<ServerState> s) {
|
||||
if (s->cheat_mode_behavior == ServerState::BehaviorSwitch::OFF) {
|
||||
static void check_cheats_allowed(shared_ptr<ServerState> s, shared_ptr<ProxyServer::LinkedSession> ses) {
|
||||
if ((s->cheat_mode_behavior == ServerState::BehaviorSwitch::OFF) && (!ses->license || !(ses->license->flags & License::Flag::CHEAT_ANYWHERE))) {
|
||||
throw precondition_failed("$C6Cheats are disabled\non this proxy.");
|
||||
}
|
||||
}
|
||||
@@ -112,16 +106,26 @@ static void server_command_lobby_info(shared_ptr<Client> c, const std::string&)
|
||||
} else {
|
||||
lines.emplace_back(string_printf("$C6%08X$C7 L$C6%d-%d$C7", l->lobby_id, l->min_level + 1, l->max_level + 1));
|
||||
}
|
||||
lines.emplace_back(string_printf("$C7Section ID: $C6%s$C7", name_for_section_id(l->section_id).c_str()));
|
||||
lines.emplace_back(string_printf("$C7Section ID: $C6%s$C7", name_for_section_id(l->section_id)));
|
||||
|
||||
if (l->check_flag(Lobby::Flag::DROPS_ENABLED)) {
|
||||
if (l->item_creator) {
|
||||
lines.emplace_back("Server item table");
|
||||
} else {
|
||||
switch (l->drop_mode) {
|
||||
case Lobby::DropMode::DISABLED:
|
||||
lines.emplace_back("Drops disabled");
|
||||
break;
|
||||
case Lobby::DropMode::CLIENT:
|
||||
lines.emplace_back("Client item table");
|
||||
}
|
||||
} else {
|
||||
lines.emplace_back("No item drops");
|
||||
break;
|
||||
case Lobby::DropMode::SERVER_SHARED:
|
||||
lines.emplace_back("Server item table");
|
||||
break;
|
||||
case Lobby::DropMode::SERVER_PRIVATE:
|
||||
lines.emplace_back("Server indiv items");
|
||||
break;
|
||||
case Lobby::DropMode::SERVER_DUPLICATE:
|
||||
lines.emplace_back("Server dup items");
|
||||
break;
|
||||
default:
|
||||
lines.emplace_back("$C4Unknown drop mode$C7");
|
||||
}
|
||||
if (l->check_flag(Lobby::Flag::CHEATS_ENABLED)) {
|
||||
lines.emplace_back("Cheats enabled");
|
||||
@@ -164,6 +168,15 @@ static void server_command_ping(shared_ptr<Client> c, const std::string&) {
|
||||
send_command(c, 0x1D, 0x00);
|
||||
}
|
||||
|
||||
static void proxy_command_ping(shared_ptr<ProxyServer::LinkedSession> ses, const std::string&) {
|
||||
ses->client_ping_start_time = now();
|
||||
ses->server_ping_start_time = now();
|
||||
|
||||
C_GuildCardSearch_40 cmd = {0x00010000, ses->remote_guild_card_number, ses->remote_guild_card_number};
|
||||
ses->client_channel.send(0x1D, 0x00);
|
||||
ses->server_channel.send(0x40, 0x00, &cmd, sizeof(cmd));
|
||||
}
|
||||
|
||||
static void proxy_command_lobby_info(shared_ptr<ProxyServer::LinkedSession> ses, const std::string&) {
|
||||
string msg;
|
||||
// On non-masked-GC sessions (BB), there is no remote Guild Card number, so we
|
||||
@@ -263,10 +276,26 @@ static void server_command_quest(shared_ptr<Client> c, const std::string& args)
|
||||
return;
|
||||
}
|
||||
|
||||
Version effective_version = is_ep3(c->version()) ? Version::GC_V3 : c->version();
|
||||
|
||||
auto s = c->require_server_state();
|
||||
auto l = c->require_lobby();
|
||||
auto q = s->quest_index_for_client(c)->get(stoul(args));
|
||||
set_lobby_quest(c->require_lobby(), q);
|
||||
auto q = s->quest_index_for_version(effective_version)->get(stoul(args));
|
||||
if (!q) {
|
||||
send_text_message(c, "$C6Quest not found");
|
||||
} else {
|
||||
set_lobby_quest(c->require_lobby(), q, true);
|
||||
}
|
||||
}
|
||||
|
||||
static void server_command_qcheck(shared_ptr<Client> c, const std::string& args) {
|
||||
auto l = c->require_lobby();
|
||||
uint16_t flag_num = stoul(args, nullptr, 0);
|
||||
|
||||
send_text_message_printf(c, "$C7Quest flag 0x%hX (%hu)\nis %s on %s",
|
||||
flag_num, flag_num,
|
||||
c->character()->quest_flags.get(l->difficulty, flag_num) ? "set" : "not set",
|
||||
name_for_difficulty(l->difficulty));
|
||||
}
|
||||
|
||||
static void server_command_qset_qclear(shared_ptr<Client> c, const std::string& args, bool should_set) {
|
||||
@@ -282,11 +311,17 @@ static void server_command_qset_qclear(shared_ptr<Client> c, const std::string&
|
||||
|
||||
uint16_t flag_num = stoul(args, nullptr, 0);
|
||||
|
||||
if (should_set) {
|
||||
c->character()->quest_flags.set(l->difficulty, flag_num);
|
||||
} else {
|
||||
c->character()->quest_flags.clear(l->difficulty, flag_num);
|
||||
}
|
||||
|
||||
if (is_v1_or_v2(c->version())) {
|
||||
G_SetQuestFlag_DC_PC_6x75 cmd = {{0x75, 0x02, 0x0000}, flag_num, should_set ? 0 : 1};
|
||||
G_UpdateQuestFlag_DC_PC_6x75 cmd = {{0x75, 0x02, 0x0000}, flag_num, should_set ? 0 : 1};
|
||||
send_command_t(l, 0x60, 0x00, cmd);
|
||||
} else {
|
||||
G_SetQuestFlag_V3_BB_6x75 cmd = {{{0x75, 0x02, 0x0000}, flag_num, should_set ? 0 : 1}, l->difficulty, 0x0000};
|
||||
G_UpdateQuestFlag_V3_BB_6x75 cmd = {{{0x75, 0x03, 0x0000}, flag_num, should_set ? 0 : 1}, l->difficulty, 0x0000};
|
||||
send_command_t(l, 0x60, 0x00, cmd);
|
||||
}
|
||||
}
|
||||
@@ -299,6 +334,32 @@ static void server_command_qclear(shared_ptr<Client> c, const std::string& args)
|
||||
return server_command_qset_qclear(c, args, false);
|
||||
}
|
||||
|
||||
static void proxy_command_qset_qclear(shared_ptr<ProxyServer::LinkedSession> ses, const std::string& args, bool should_set) {
|
||||
if (!ses->is_in_game) {
|
||||
send_text_message(ses->client_channel, "$C6This command cannot\nbe used in the lobby");
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t flag_num = stoul(args, nullptr, 0);
|
||||
if (is_v1_or_v2(ses->version())) {
|
||||
G_UpdateQuestFlag_DC_PC_6x75 cmd = {{0x75, 0x02, 0x0000}, flag_num, should_set ? 0 : 1};
|
||||
ses->client_channel.send(0x60, 0x00, &cmd, sizeof(cmd));
|
||||
ses->server_channel.send(0x60, 0x00, &cmd, sizeof(cmd));
|
||||
} else {
|
||||
G_UpdateQuestFlag_V3_BB_6x75 cmd = {{{0x75, 0x03, 0x0000}, flag_num, should_set ? 0 : 1}, ses->difficulty, 0x0000};
|
||||
ses->client_channel.send(0x60, 0x00, &cmd, sizeof(cmd));
|
||||
ses->server_channel.send(0x60, 0x00, &cmd, sizeof(cmd));
|
||||
}
|
||||
}
|
||||
|
||||
static void proxy_command_qset(shared_ptr<ProxyServer::LinkedSession> ses, const std::string& args) {
|
||||
return proxy_command_qset_qclear(ses, args, true);
|
||||
}
|
||||
|
||||
static void proxy_command_qclear(shared_ptr<ProxyServer::LinkedSession> ses, const std::string& args) {
|
||||
return proxy_command_qset_qclear(ses, args, false);
|
||||
}
|
||||
|
||||
static void server_command_qsync(shared_ptr<Client> c, const std::string& args) {
|
||||
if (!c->config.check_flag(Client::Flag::DEBUG_ENABLED)) {
|
||||
send_text_message(c, "$C6This command can only\nbe run in debug mode\n(run %sdebug first)");
|
||||
@@ -331,6 +392,33 @@ static void server_command_qsync(shared_ptr<Client> c, const std::string& args)
|
||||
send_command_t(c, 0x60, 0x00, cmd);
|
||||
}
|
||||
|
||||
static void proxy_command_qsync(shared_ptr<ProxyServer::LinkedSession> ses, const std::string& args) {
|
||||
if (!ses->is_in_game) {
|
||||
send_text_message(ses->client_channel, "$C6This command cannot\nbe used in the lobby");
|
||||
return;
|
||||
}
|
||||
|
||||
auto tokens = split(args, ' ');
|
||||
if (tokens.size() != 2) {
|
||||
send_text_message(ses->client_channel, "$C6Incorrect number of\narguments");
|
||||
return;
|
||||
}
|
||||
|
||||
G_SyncQuestData_6x77 cmd;
|
||||
cmd.header = {0x77, 0x03, 0x0000};
|
||||
cmd.register_number = stoul(tokens[0].substr(1), nullptr, 0);
|
||||
cmd.unused = 0;
|
||||
if (tokens[0][0] == 'r') {
|
||||
cmd.value.as_int = stoul(tokens[1], nullptr, 0);
|
||||
} else if (tokens[0][0] == 'f') {
|
||||
cmd.value.as_float = stof(tokens[1]);
|
||||
} else {
|
||||
send_text_message(ses->client_channel, "$C6First argument must\nbe a register");
|
||||
return;
|
||||
}
|
||||
ses->client_channel.send(0x60, 0x00, cmd);
|
||||
}
|
||||
|
||||
static void server_command_qcall(shared_ptr<Client> c, const std::string& args) {
|
||||
if (!c->config.check_flag(Client::Flag::DEBUG_ENABLED)) {
|
||||
send_text_message(c, "$C6This command can only\nbe run in debug mode\n(run %sdebug first)");
|
||||
@@ -354,7 +442,7 @@ static void proxy_command_qcall(shared_ptr<ProxyServer::LinkedSession> ses, cons
|
||||
}
|
||||
|
||||
static void server_command_show_material_counts(shared_ptr<Client> c, const std::string&) {
|
||||
auto p = c->game_data.character();
|
||||
auto p = c->character();
|
||||
if (is_v1_or_v2(c->version())) {
|
||||
send_text_message_printf(c, "%hhu HP, %hhu TP",
|
||||
p->get_material_usage(PSOBBCharacterFile::MaterialType::HP),
|
||||
@@ -461,26 +549,30 @@ static void proxy_command_patch(shared_ptr<ProxyServer::LinkedSession> ses, cons
|
||||
}
|
||||
|
||||
static void server_command_persist(shared_ptr<Client> c, const std::string&) {
|
||||
check_license_flags(c, License::Flag::DEBUG);
|
||||
auto l = c->require_lobby();
|
||||
if (l->check_flag(Lobby::Flag::DEFAULT)) {
|
||||
send_text_message(c, "$C6Default lobbies\ncannot be marked\ntemporary");
|
||||
} else if (!l->check_flag(Lobby::Flag::GAME)) {
|
||||
send_text_message(c, "$C6Private lobbies\ncannot be marked\npersistent");
|
||||
} else if (l->check_flag(Lobby::Flag::QUEST_IN_PROGRESS) || l->check_flag(Lobby::Flag::JOINABLE_QUEST_IN_PROGRESS)) {
|
||||
send_text_message(c, "$C6Games cannot be\npersistent if a\nquest has already\nbegun");
|
||||
} else if (l->check_flag(Lobby::Flag::IS_SPECTATOR_TEAM)) {
|
||||
send_text_message(c, "$C6Spectator teams\ncannot be marked\npersistent");
|
||||
} else {
|
||||
l->toggle_flag(Lobby::Flag::PERSISTENT);
|
||||
send_text_message_printf(c, "Lobby persistence\n%s",
|
||||
l->check_flag(Lobby::Flag::PERSISTENT) ? "enabled" : "disabled");
|
||||
send_text_message_printf(l, "Lobby persistence\n%s", l->check_flag(Lobby::Flag::PERSISTENT) ? "enabled" : "disabled");
|
||||
}
|
||||
}
|
||||
|
||||
static void server_command_exit(shared_ptr<Client> c, const std::string&) {
|
||||
auto l = c->require_lobby();
|
||||
if (l->is_game()) {
|
||||
if (is_ep3(c->version())) {
|
||||
c->channel.send(0xED, 0x00);
|
||||
} else if (l->check_flag(Lobby::Flag::QUEST_IN_PROGRESS) || l->check_flag(Lobby::Flag::JOINABLE_QUEST_IN_PROGRESS)) {
|
||||
if (l->check_flag(Lobby::Flag::QUEST_IN_PROGRESS) || l->check_flag(Lobby::Flag::JOINABLE_QUEST_IN_PROGRESS)) {
|
||||
G_UnusedHeader cmd = {0x73, 0x01, 0x0000};
|
||||
c->channel.send(0x60, 0x00, cmd);
|
||||
c->floor = 0;
|
||||
} else if (is_ep3(c->version())) {
|
||||
c->channel.send(0xED, 0x00);
|
||||
} else {
|
||||
send_text_message(c, "$C6You must return to\nthe lobby first");
|
||||
}
|
||||
@@ -702,9 +794,8 @@ static void server_command_playrec(shared_ptr<Client> c, const std::string& args
|
||||
send_text_message(c, "$C4The recording does\nnot exist");
|
||||
return;
|
||||
}
|
||||
shared_ptr<Episode3::BattleRecord> record(new Episode3::BattleRecord(data));
|
||||
shared_ptr<Episode3::BattleRecordPlayer> battle_player(
|
||||
new Episode3::BattleRecordPlayer(record, s->game_server->get_base()));
|
||||
auto record = make_shared<Episode3::BattleRecord>(data);
|
||||
auto battle_player = make_shared<Episode3::BattleRecordPlayer>(record, s->game_server->get_base());
|
||||
auto game = create_game_generic(
|
||||
s, c, args, "", Episode::EP3, GameMode::NORMAL, 0, false, nullptr, battle_player);
|
||||
if (game) {
|
||||
@@ -740,7 +831,7 @@ static void server_command_meseta(shared_ptr<Client> c, const std::string& args)
|
||||
static void server_command_secid(shared_ptr<Client> c, const std::string& args) {
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, false);
|
||||
check_cheats_allowed(c->require_server_state());
|
||||
check_cheats_allowed(c->require_server_state(), c);
|
||||
|
||||
if (!args[0]) {
|
||||
c->config.override_section_id = 0xFF;
|
||||
@@ -751,14 +842,13 @@ static void server_command_secid(shared_ptr<Client> c, const std::string& args)
|
||||
send_text_message(c, "$C6Invalid section ID");
|
||||
} else {
|
||||
c->config.override_section_id = new_secid;
|
||||
string name = name_for_section_id(new_secid);
|
||||
send_text_message_printf(c, "$C6Override section ID\nset to %s", name.c_str());
|
||||
send_text_message_printf(c, "$C6Override section ID\nset to %s", name_for_section_id(new_secid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void proxy_command_secid(shared_ptr<ProxyServer::LinkedSession> ses, const std::string& args) {
|
||||
check_cheats_allowed(ses->require_server_state());
|
||||
check_cheats_allowed(ses->require_server_state(), ses);
|
||||
if (!args[0]) {
|
||||
ses->config.override_section_id = 0xFF;
|
||||
send_text_message(ses->client_channel, "$C6Override section ID\nremoved");
|
||||
@@ -768,8 +858,7 @@ static void proxy_command_secid(shared_ptr<ProxyServer::LinkedSession> ses, cons
|
||||
send_text_message(ses->client_channel, "$C6Invalid section ID");
|
||||
} else {
|
||||
ses->config.override_section_id = new_secid;
|
||||
string name = name_for_section_id(new_secid);
|
||||
send_text_message(ses->client_channel, "$C6Override section ID\nset to " + name);
|
||||
send_text_message_printf(ses->client_channel, "$C6Override section ID\nset to %s", name_for_section_id(new_secid));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -778,7 +867,7 @@ static void server_command_rand(shared_ptr<Client> c, const std::string& args) {
|
||||
auto s = c->require_server_state();
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, false);
|
||||
check_cheats_allowed(s);
|
||||
check_cheats_allowed(s, c);
|
||||
|
||||
if (!args[0]) {
|
||||
c->config.clear_flag(Client::Flag::USE_OVERRIDE_RANDOM_SEED);
|
||||
@@ -792,7 +881,7 @@ static void server_command_rand(shared_ptr<Client> c, const std::string& args) {
|
||||
}
|
||||
|
||||
static void proxy_command_rand(shared_ptr<ProxyServer::LinkedSession> ses, const std::string& args) {
|
||||
check_proxy_cheats_allowed(ses->require_server_state());
|
||||
check_cheats_allowed(ses->require_server_state(), ses);
|
||||
if (!args[0]) {
|
||||
ses->config.clear_flag(Client::Flag::USE_OVERRIDE_RANDOM_SEED);
|
||||
ses->config.override_random_seed = 0;
|
||||
@@ -885,9 +974,11 @@ static void server_command_edit(shared_ptr<Client> c, const std::string& args) {
|
||||
auto s = c->require_server_state();
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, false);
|
||||
check_version(c, Version::BB_V4);
|
||||
if (!is_v1_or_v2(c->version()) && (c->version() != Version::BB_V4)) {
|
||||
throw precondition_failed("$C6This command cannot\nbe used for your\nversion of PSO.");
|
||||
}
|
||||
|
||||
if (s->cheat_mode_behavior == ServerState::BehaviorSwitch::OFF) {
|
||||
if ((s->cheat_mode_behavior == ServerState::BehaviorSwitch::OFF) && !(c->license->flags & License::Flag::CHEAT_ANYWHERE)) {
|
||||
send_text_message(l, "$C6Cheats are disabled\non this server");
|
||||
return;
|
||||
}
|
||||
@@ -896,7 +987,7 @@ static void server_command_edit(shared_ptr<Client> c, const std::string& args) {
|
||||
vector<string> tokens = split(encoded_args, ' ');
|
||||
|
||||
try {
|
||||
auto p = c->game_data.character();
|
||||
auto p = c->character();
|
||||
if (tokens.at(0) == "atp") {
|
||||
p->disp.stats.char_stats.atp = stoul(tokens.at(1));
|
||||
} else if (tokens.at(0) == "mst") {
|
||||
@@ -979,69 +1070,123 @@ static void server_command_edit(shared_ptr<Client> c, const std::string& args) {
|
||||
|
||||
// Reload the client in the lobby
|
||||
send_player_leave_notification(l, c->lobby_client_id);
|
||||
send_complete_player_bb(c);
|
||||
if (c->version() == Version::BB_V4) {
|
||||
send_complete_player_bb(c);
|
||||
}
|
||||
c->v1_v2_last_reported_disp.reset();
|
||||
s->send_lobby_join_notifications(l, c);
|
||||
}
|
||||
|
||||
// TODO: implement this (and make sure the bank name is filesystem-safe)
|
||||
/* static void server_command_change_bank(shared_ptr<Client> c, const std::string&) {
|
||||
static void server_command_change_bank(shared_ptr<Client> c, const std::string& args) {
|
||||
check_version(c, Version::BB_V4);
|
||||
...
|
||||
} */
|
||||
|
||||
// TODO: This can be implemented on the proxy server too.
|
||||
static void server_command_convert_char_to_bb(shared_ptr<Client> c, const std::string& args) {
|
||||
if (c->config.check_flag(Client::Flag::AT_BANK_COUNTER)) {
|
||||
throw runtime_error("cannot change banks while at the bank counter");
|
||||
}
|
||||
if (c->has_overlay()) {
|
||||
throw runtime_error("cannot change banks while Battle or Challenge is in progress");
|
||||
}
|
||||
|
||||
ssize_t new_char_index = args.empty() ? (c->bb_character_index + 1) : stol(args, nullptr, 0);
|
||||
|
||||
if (new_char_index == 0) {
|
||||
if (c->use_shared_bank()) {
|
||||
send_text_message_printf(c, "$C6Using shared bank (0)");
|
||||
} else {
|
||||
send_text_message_printf(c, "$C6Created shared bank (0)");
|
||||
}
|
||||
} else if (new_char_index <= 4) {
|
||||
c->use_character_bank(new_char_index - 1);
|
||||
auto bp = c->current_bank_character();
|
||||
auto name = bp->disp.name.decode(c->language());
|
||||
send_text_message_printf(c, "$C6Using %s\'s bank (%zu)", name.c_str(), new_char_index);
|
||||
} else {
|
||||
throw runtime_error("invalid bank number");
|
||||
}
|
||||
|
||||
const auto& bank = c->current_bank();
|
||||
send_text_message_printf(c, "%" PRIu32 " items\n%" PRIu32 " Meseta", bank.num_items.load(), bank.meseta.load());
|
||||
}
|
||||
|
||||
static void server_command_bbchar_savechar(shared_ptr<Client> c, const std::string& args, bool is_bb_conversion) {
|
||||
auto s = c->require_server_state();
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, false);
|
||||
check_not_version(c, Version::BB_V4);
|
||||
|
||||
vector<string> tokens = split(args, ' ');
|
||||
if (tokens.size() != 3) {
|
||||
send_text_message(c, "$C6Incorrect argument count");
|
||||
return;
|
||||
auto pending_export = make_unique<Client::PendingCharacterExport>();
|
||||
pending_export->is_bb_conversion = is_bb_conversion;
|
||||
|
||||
if (is_bb_conversion) {
|
||||
vector<string> tokens = split(args, ' ');
|
||||
if (tokens.size() != 3) {
|
||||
send_text_message(c, "$C6Incorrect argument count");
|
||||
return;
|
||||
}
|
||||
|
||||
// username/password are tokens[0] and [1]
|
||||
pending_export->character_index = stoll(tokens[2]) - 1;
|
||||
if ((pending_export->character_index > 3) || (pending_export->character_index < 0)) {
|
||||
send_text_message(c, "$C6Player index must\nbe in range 1-4");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
c->pending_character_export->license = s->license_index->verify_bb(tokens[0].c_str(), tokens[1].c_str());
|
||||
} catch (const exception& e) {
|
||||
send_text_message_printf(c, "$C6Login failed: %s", e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
pending_export->character_index = stoll(args) - 1;
|
||||
if ((pending_export->character_index > 3) || (pending_export->character_index < 0)) {
|
||||
send_text_message(c, "$C6Player index must\nbe in range 1-4");
|
||||
return;
|
||||
}
|
||||
pending_export->license = c->license;
|
||||
}
|
||||
|
||||
// username/password are tokens[0] and [1]
|
||||
c->pending_bb_save_character_index = stoul(tokens[2]) - 1;
|
||||
if (c->pending_bb_save_character_index > 3) {
|
||||
send_text_message(c, "$C6Player index must be 1-4");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
s->license_index->verify_bb(tokens[0].c_str(), tokens[1].c_str());
|
||||
} catch (const exception& e) {
|
||||
send_text_message_printf(c, "$C6Login failed: %s", e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
c->pending_bb_save_username = tokens[0];
|
||||
|
||||
c->pending_character_export = std::move(pending_export);
|
||||
// Request the player data. The client will respond with a 61, and the handler
|
||||
// for that command will execute the conversion
|
||||
send_get_player_info(c);
|
||||
}
|
||||
|
||||
static void server_command_bbchar(shared_ptr<Client> c, const std::string& args) {
|
||||
server_command_bbchar_savechar(c, args, true);
|
||||
}
|
||||
|
||||
static void server_command_savechar(shared_ptr<Client> c, const std::string& args) {
|
||||
server_command_bbchar_savechar(c, args, false);
|
||||
}
|
||||
|
||||
static void server_command_loadchar(shared_ptr<Client> c, const std::string& args) {
|
||||
if (!is_v1_or_v2(c->version())) {
|
||||
send_text_message(c, "$C7This command can only\nbe used on v1 or v2");
|
||||
return;
|
||||
}
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, false);
|
||||
|
||||
size_t index = stoull(args, nullptr, 0) - 1;
|
||||
if (index > 3) {
|
||||
send_text_message(c, "$C6Player index must\nbe in range 1-4");
|
||||
return;
|
||||
}
|
||||
c->load_backup_character(c->license->serial_number, index);
|
||||
|
||||
auto s = c->require_server_state();
|
||||
send_player_leave_notification(l, c->lobby_client_id);
|
||||
s->send_lobby_join_notifications(l, c);
|
||||
}
|
||||
|
||||
static void server_command_save(shared_ptr<Client> c, const std::string&) {
|
||||
check_version(c, Version::BB_V4);
|
||||
try {
|
||||
c->game_data.save_character_file();
|
||||
send_text_message(c, "Character data saved");
|
||||
c->save_all();
|
||||
send_text_message(c, "All data saved");
|
||||
} catch (const exception& e) {
|
||||
send_text_message_printf(c, "Can\'t save character:\n%s", e.what());
|
||||
}
|
||||
try {
|
||||
c->game_data.save_system_file();
|
||||
send_text_message(c, "System data saved");
|
||||
} catch (const exception& e) {
|
||||
send_text_message_printf(c, "Can\'t save system data:\n%s", e.what());
|
||||
}
|
||||
try {
|
||||
c->game_data.save_guild_card_file();
|
||||
send_text_message(c, "Guild Card data saved");
|
||||
} catch (const exception& e) {
|
||||
send_text_message_printf(c, "Can\'t save Guild Cards:\n%s", e.what());
|
||||
send_text_message_printf(c, "Can\'t save data:\n%s", e.what());
|
||||
}
|
||||
c->reschedule_save_game_data_event();
|
||||
}
|
||||
@@ -1050,7 +1195,7 @@ static void server_command_save(shared_ptr<Client> c, const std::string&) {
|
||||
// Administration commands
|
||||
|
||||
static string name_for_client(shared_ptr<Client> c) {
|
||||
auto player = c->game_data.character(false);
|
||||
auto player = c->character(false);
|
||||
if (player.get()) {
|
||||
return player->disp.name.decode(player->inventory.language);
|
||||
}
|
||||
@@ -1166,7 +1311,7 @@ static void server_command_warp(shared_ptr<Client> c, const std::string& args, b
|
||||
auto s = c->require_server_state();
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, true);
|
||||
check_cheats_enabled(l);
|
||||
check_cheats_enabled(l, c);
|
||||
|
||||
uint32_t floor = stoul(args, nullptr, 0);
|
||||
if (c->floor == floor) {
|
||||
@@ -1198,7 +1343,7 @@ static void server_command_warpall(shared_ptr<Client> c, const std::string& args
|
||||
|
||||
static void proxy_command_warp(shared_ptr<ProxyServer::LinkedSession> ses, const std::string& args, bool is_warpall) {
|
||||
auto s = ses->require_server_state();
|
||||
check_proxy_cheats_allowed(s);
|
||||
check_cheats_allowed(s, ses);
|
||||
if (!ses->is_in_game) {
|
||||
send_text_message(ses->client_channel, "$C6You must be in a\ngame to use this\ncommand");
|
||||
return;
|
||||
@@ -1223,7 +1368,7 @@ static void server_command_next(shared_ptr<Client> c, const std::string&) {
|
||||
auto s = c->require_server_state();
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, true);
|
||||
check_cheats_enabled(l);
|
||||
check_cheats_enabled(l, c);
|
||||
|
||||
size_t limit = floor_limit_for_episode(l->episode);
|
||||
if (limit == 0) {
|
||||
@@ -1234,7 +1379,7 @@ static void server_command_next(shared_ptr<Client> c, const std::string&) {
|
||||
|
||||
static void proxy_command_next(shared_ptr<ProxyServer::LinkedSession> ses, const std::string&) {
|
||||
auto s = ses->require_server_state();
|
||||
check_proxy_cheats_allowed(s);
|
||||
check_cheats_allowed(s, ses);
|
||||
if (!ses->is_in_game) {
|
||||
send_text_message(ses->client_channel, "$C6You must be in a\ngame to use this\ncommand");
|
||||
return;
|
||||
@@ -1244,6 +1389,10 @@ static void proxy_command_next(shared_ptr<ProxyServer::LinkedSession> ses, const
|
||||
send_warp(ses->client_channel, ses->lobby_client_id, ses->floor, true);
|
||||
}
|
||||
|
||||
static void server_command_where(shared_ptr<Client> c, const std::string&) {
|
||||
send_text_message_printf(c, "$C7Floor: %02" PRIX32 "\nX: %g\nZ: %g", c->floor, c->x, c->z);
|
||||
}
|
||||
|
||||
static void server_command_what(shared_ptr<Client> c, const std::string&) {
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, true);
|
||||
@@ -1251,32 +1400,28 @@ static void server_command_what(shared_ptr<Client> c, const std::string&) {
|
||||
if (!episode_has_arpg_semantics(l->episode)) {
|
||||
return;
|
||||
}
|
||||
if (!l->check_flag(Lobby::Flag::ITEM_TRACKING_ENABLED)) {
|
||||
send_text_message(c, "$C4Item tracking is\nnot available");
|
||||
} else {
|
||||
float min_dist2 = 0.0f;
|
||||
uint32_t nearest_item_id = 0xFFFFFFFF;
|
||||
for (const auto& it : l->item_id_to_floor_item) {
|
||||
if (it.second.floor != c->floor) {
|
||||
continue;
|
||||
}
|
||||
float dx = it.second.x - c->x;
|
||||
float dz = it.second.z - c->z;
|
||||
float dist2 = (dx * dx) + (dz * dz);
|
||||
if ((nearest_item_id == 0xFFFFFFFF) || (dist2 < min_dist2)) {
|
||||
nearest_item_id = it.first;
|
||||
min_dist2 = dist2;
|
||||
}
|
||||
}
|
||||
|
||||
if (nearest_item_id == 0xFFFFFFFF) {
|
||||
send_text_message(c, "$C4No items are near you");
|
||||
} else {
|
||||
auto s = c->require_server_state();
|
||||
const auto& item = l->item_id_to_floor_item.at(nearest_item_id);
|
||||
string name = s->describe_item(c->version(), item.data, true);
|
||||
send_text_message(c, name);
|
||||
float min_dist2 = 0.0f;
|
||||
shared_ptr<const Lobby::FloorItem> nearest_fi;
|
||||
for (const auto& it : l->floor_item_managers.at(c->floor).items) {
|
||||
if (!it.second->visible_to_client(c->lobby_client_id)) {
|
||||
continue;
|
||||
}
|
||||
float dx = it.second->x - c->x;
|
||||
float dz = it.second->z - c->z;
|
||||
float dist2 = (dx * dx) + (dz * dz);
|
||||
if (!nearest_fi || (dist2 < min_dist2)) {
|
||||
nearest_fi = it.second;
|
||||
min_dist2 = dist2;
|
||||
}
|
||||
}
|
||||
|
||||
if (!nearest_fi) {
|
||||
send_text_message(c, "$C4No items are near you");
|
||||
} else {
|
||||
auto s = c->require_server_state();
|
||||
string name = s->describe_item(c->version(), nearest_fi->data, true);
|
||||
send_text_message(c, name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1300,7 +1445,7 @@ static void server_command_infinite_hp(shared_ptr<Client> c, const std::string&)
|
||||
auto s = c->require_server_state();
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, true);
|
||||
check_cheats_enabled(l);
|
||||
check_cheats_enabled(l, c);
|
||||
|
||||
c->config.toggle_flag(Client::Flag::INFINITE_HP_ENABLED);
|
||||
send_text_message_printf(c, "$C6Infinite HP %s", c->config.check_flag(Client::Flag::INFINITE_HP_ENABLED) ? "enabled" : "disabled");
|
||||
@@ -1308,7 +1453,7 @@ static void server_command_infinite_hp(shared_ptr<Client> c, const std::string&)
|
||||
|
||||
static void proxy_command_infinite_hp(shared_ptr<ProxyServer::LinkedSession> ses, const std::string&) {
|
||||
auto s = ses->require_server_state();
|
||||
check_proxy_cheats_allowed(s);
|
||||
check_cheats_allowed(s, ses);
|
||||
ses->config.toggle_flag(Client::Flag::INFINITE_HP_ENABLED);
|
||||
send_text_message_printf(ses->client_channel, "$C6Infinite HP %s",
|
||||
ses->config.check_flag(Client::Flag::INFINITE_HP_ENABLED) ? "enabled" : "disabled");
|
||||
@@ -1318,7 +1463,7 @@ static void server_command_infinite_tp(shared_ptr<Client> c, const std::string&)
|
||||
auto s = c->require_server_state();
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, true);
|
||||
check_cheats_enabled(l);
|
||||
check_cheats_enabled(l, c);
|
||||
|
||||
c->config.toggle_flag(Client::Flag::INFINITE_TP_ENABLED);
|
||||
send_text_message_printf(c, "$C6Infinite TP %s", c->config.check_flag(Client::Flag::INFINITE_TP_ENABLED) ? "enabled" : "disabled");
|
||||
@@ -1326,7 +1471,7 @@ static void server_command_infinite_tp(shared_ptr<Client> c, const std::string&)
|
||||
|
||||
static void proxy_command_infinite_tp(shared_ptr<ProxyServer::LinkedSession> ses, const std::string&) {
|
||||
auto s = ses->require_server_state();
|
||||
check_proxy_cheats_allowed(s);
|
||||
check_cheats_allowed(s, ses);
|
||||
ses->config.toggle_flag(Client::Flag::INFINITE_TP_ENABLED);
|
||||
send_text_message_printf(ses->client_channel, "$C6Infinite TP %s",
|
||||
ses->config.check_flag(Client::Flag::INFINITE_TP_ENABLED) ? "enabled" : "disabled");
|
||||
@@ -1336,7 +1481,7 @@ static void server_command_switch_assist(shared_ptr<Client> c, const std::string
|
||||
auto s = c->require_server_state();
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, true);
|
||||
check_cheats_enabled(l);
|
||||
check_cheats_enabled(l, c);
|
||||
|
||||
c->config.toggle_flag(Client::Flag::SWITCH_ASSIST_ENABLED);
|
||||
send_text_message_printf(c, "$C6Switch assist %s",
|
||||
@@ -1345,41 +1490,75 @@ static void server_command_switch_assist(shared_ptr<Client> c, const std::string
|
||||
|
||||
static void proxy_command_switch_assist(shared_ptr<ProxyServer::LinkedSession> ses, const std::string&) {
|
||||
auto s = ses->require_server_state();
|
||||
check_proxy_cheats_allowed(s);
|
||||
check_cheats_allowed(s, ses);
|
||||
ses->config.toggle_flag(Client::Flag::SWITCH_ASSIST_ENABLED);
|
||||
send_text_message_printf(ses->client_channel, "$C6Switch assist %s",
|
||||
ses->config.check_flag(Client::Flag::SWITCH_ASSIST_ENABLED) ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
static void server_command_drop(shared_ptr<Client> c, const std::string&) {
|
||||
static void server_command_dropmode(shared_ptr<Client> c, const std::string& args) {
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, true);
|
||||
check_is_leader(l, c);
|
||||
if (l->check_flag(Lobby::Flag::CANNOT_CHANGE_DROPS_ENABLED)) {
|
||||
send_text_message(c, "Drop mode cannot\nbe changed on this\nserver");
|
||||
} else {
|
||||
l->toggle_flag(Lobby::Flag::DROPS_ENABLED);
|
||||
send_text_message_printf(l, "Drops %s", l->check_flag(Lobby::Flag::DROPS_ENABLED) ? "enabled" : "disabled");
|
||||
}
|
||||
}
|
||||
if (args.empty()) {
|
||||
switch (l->drop_mode) {
|
||||
case Lobby::DropMode::DISABLED:
|
||||
send_text_message(c, "Drop mode: disabled");
|
||||
break;
|
||||
case Lobby::DropMode::CLIENT:
|
||||
send_text_message(c, "Drop mode: client");
|
||||
break;
|
||||
case Lobby::DropMode::SERVER_SHARED:
|
||||
send_text_message(c, "Drop mode: server\nshared");
|
||||
break;
|
||||
case Lobby::DropMode::SERVER_PRIVATE:
|
||||
send_text_message(c, "Drop mode: server\nprivate");
|
||||
break;
|
||||
case Lobby::DropMode::SERVER_DUPLICATE:
|
||||
send_text_message(c, "Drop mode: server\nduplicate");
|
||||
break;
|
||||
}
|
||||
|
||||
static void server_command_itemtable(shared_ptr<Client> c, const std::string&) {
|
||||
auto s = c->require_server_state();
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, true);
|
||||
check_is_leader(l, c);
|
||||
if (l->check_flag(Lobby::Flag::CANNOT_CHANGE_ITEM_TABLE)) {
|
||||
send_text_message(c, "Cannot switch item\ntables on this\nserver");
|
||||
} else if (l->base_version == Version::BB_V4) {
|
||||
send_text_message(c, "Cannot use client\nitem table on BB");
|
||||
} else if (!l->check_flag(Lobby::Flag::ITEM_TRACKING_ENABLED)) {
|
||||
send_text_message(c, "Cannot use server\nitem tables if item\ntracking is off");
|
||||
} else if (l->item_creator) {
|
||||
l->item_creator.reset();
|
||||
send_text_message(l, "Game switched to\nclient item tables");
|
||||
} else {
|
||||
l->create_item_creator();
|
||||
send_text_message(l, "Game switched to\nserver item tables");
|
||||
check_is_leader(l, c);
|
||||
Lobby::DropMode new_mode;
|
||||
if ((args == "none") || (args == "disabled")) {
|
||||
new_mode = Lobby::DropMode::DISABLED;
|
||||
} else if (args == "client") {
|
||||
new_mode = Lobby::DropMode::CLIENT;
|
||||
} else if ((args == "shared") || (args == "server")) {
|
||||
new_mode = Lobby::DropMode::SERVER_SHARED;
|
||||
} else if ((args == "private") || (args == "priv")) {
|
||||
new_mode = Lobby::DropMode::SERVER_PRIVATE;
|
||||
} else if ((args == "duplicate") || (args == "dup")) {
|
||||
new_mode = Lobby::DropMode::SERVER_DUPLICATE;
|
||||
} else {
|
||||
send_text_message(c, "Invalid drop mode");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(l->allowed_drop_modes & (1 << static_cast<size_t>(new_mode)))) {
|
||||
send_text_message(c, "Drop mode not\nallowed");
|
||||
return;
|
||||
}
|
||||
|
||||
l->set_drop_mode(new_mode);
|
||||
switch (l->drop_mode) {
|
||||
case Lobby::DropMode::DISABLED:
|
||||
send_text_message(l, "Item drops disabled");
|
||||
break;
|
||||
case Lobby::DropMode::CLIENT:
|
||||
send_text_message(l, "Item drops changed\nto client mode");
|
||||
break;
|
||||
case Lobby::DropMode::SERVER_SHARED:
|
||||
send_text_message(l, "Item drops changed\nto server shared\nmode");
|
||||
break;
|
||||
case Lobby::DropMode::SERVER_PRIVATE:
|
||||
send_text_message(l, "Item drops changed\nto server private\nmode");
|
||||
break;
|
||||
case Lobby::DropMode::SERVER_DUPLICATE:
|
||||
send_text_message(l, "Item drops changed\nto server duplicate\nmode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1387,13 +1566,18 @@ static void server_command_item(shared_ptr<Client> c, const std::string& args) {
|
||||
auto s = c->require_server_state();
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, true);
|
||||
check_cheats_enabled(l);
|
||||
check_cheats_enabled(l, c);
|
||||
|
||||
ItemData item = s->item_name_index->parse_item_description(c->version(), args);
|
||||
item.id = l->generate_item_id(c->lobby_client_id);
|
||||
|
||||
l->add_item(item, c->floor, c->x, c->z);
|
||||
send_drop_stacked_item(l, item, c->floor, c->x, c->z);
|
||||
if ((l->drop_mode == Lobby::DropMode::SERVER_PRIVATE) || (l->drop_mode == Lobby::DropMode::SERVER_DUPLICATE)) {
|
||||
l->add_item(c->floor, item, c->x, c->z, (1 << c->lobby_client_id));
|
||||
send_drop_stacked_item_to_channel(s, c->channel, item, c->floor, c->x, c->z);
|
||||
} else {
|
||||
l->add_item(c->floor, item, c->x, c->z, 0x00F);
|
||||
send_drop_stacked_item_to_lobby(l, item, c->floor, c->x, c->z);
|
||||
}
|
||||
|
||||
string name = s->describe_item(c->version(), item, true);
|
||||
send_text_message(c, "$C7Item created:\n" + name);
|
||||
@@ -1401,7 +1585,7 @@ static void server_command_item(shared_ptr<Client> c, const std::string& args) {
|
||||
|
||||
static void proxy_command_item(shared_ptr<ProxyServer::LinkedSession> ses, const std::string& args) {
|
||||
auto s = ses->require_server_state();
|
||||
check_proxy_cheats_allowed(s);
|
||||
check_cheats_allowed(s, ses);
|
||||
if (ses->version() == Version::BB_V4) {
|
||||
send_text_message(ses->client_channel, "$C6This command cannot\nbe used on the proxy\nserver in BB games");
|
||||
return;
|
||||
@@ -1427,8 +1611,8 @@ static void proxy_command_item(shared_ptr<ProxyServer::LinkedSession> ses, const
|
||||
send_text_message(ses->client_channel, "$C7Next drop:\n" + name);
|
||||
|
||||
} else {
|
||||
send_drop_stacked_item(s, ses->client_channel, item, ses->floor, ses->x, ses->z);
|
||||
send_drop_stacked_item(s, ses->server_channel, item, ses->floor, ses->x, ses->z);
|
||||
send_drop_stacked_item_to_channel(s, ses->client_channel, item, ses->floor, ses->x, ses->z);
|
||||
send_drop_stacked_item_to_channel(s, ses->server_channel, item, ses->floor, ses->x, ses->z);
|
||||
|
||||
string name = s->describe_item(ses->version(), item, true);
|
||||
send_text_message(ses->client_channel, "$C7Item created:\n" + name);
|
||||
@@ -1540,7 +1724,7 @@ static void server_command_ep3_unset_field_character(shared_ptr<Client> c, const
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, true);
|
||||
check_is_ep3(c, true);
|
||||
check_cheats_enabled(l);
|
||||
check_cheats_enabled(l, c);
|
||||
|
||||
if (l->episode != Episode::EP3) {
|
||||
throw logic_error("non-Ep3 client in Ep3 game");
|
||||
@@ -1573,7 +1757,7 @@ static void server_command_surrender(shared_ptr<Client> c, const std::string&) {
|
||||
send_text_message(c, "$C6Battle has not\nyet started");
|
||||
return;
|
||||
}
|
||||
const string& name = c->game_data.character()->disp.name.decode(c->language());
|
||||
const string& name = c->character()->disp.name.decode(c->language());
|
||||
send_text_message_printf(l, "$C6%s has\nsurrendered", name.c_str());
|
||||
for (const auto& watcher_l : l->watcher_lobbies) {
|
||||
send_text_message_printf(watcher_l, "$C6%s has\nsurrendered", name.c_str());
|
||||
@@ -1680,12 +1864,14 @@ static const unordered_map<string, ChatCommandDefinition> chat_commands({
|
||||
{"$auction", {server_command_auction, proxy_command_auction}},
|
||||
{"$ax", {server_command_ax, nullptr}},
|
||||
{"$ban", {server_command_ban, nullptr}},
|
||||
{"$bbchar", {server_command_convert_char_to_bb, nullptr}},
|
||||
{"$bank", {server_command_change_bank, nullptr}},
|
||||
{"$bbchar", {server_command_bbchar, nullptr}},
|
||||
{"$cheat", {server_command_cheat, nullptr}},
|
||||
{"$debug", {server_command_debug, nullptr}},
|
||||
{"$defrange", {server_command_ep3_set_def_dice_range, nullptr}},
|
||||
{"$drop", {server_command_drop, nullptr}},
|
||||
{"$dropmode", {server_command_dropmode, nullptr}},
|
||||
{"$edit", {server_command_edit, nullptr}},
|
||||
{"$ep3battledebug", {server_command_enable_ep3_battle_debug_menu, nullptr}},
|
||||
{"$event", {server_command_lobby_event, proxy_command_lobby_event}},
|
||||
{"$exit", {server_command_exit, proxy_command_exit}},
|
||||
{"$gc", {server_command_get_self_card, proxy_command_get_player_card}},
|
||||
@@ -1693,12 +1879,11 @@ static const unordered_map<string, ChatCommandDefinition> chat_commands({
|
||||
{"$inftime", {server_command_ep3_infinite_time, nullptr}},
|
||||
{"$inftp", {server_command_infinite_tp, proxy_command_infinite_tp}},
|
||||
{"$item", {server_command_item, proxy_command_item}},
|
||||
{"$itemtable", {server_command_itemtable, nullptr}},
|
||||
{"$i", {server_command_item, proxy_command_item}},
|
||||
{"$kick", {server_command_kick, nullptr}},
|
||||
{"$li", {server_command_lobby_info, proxy_command_lobby_info}},
|
||||
{"$ln", {server_command_lobby_type, proxy_command_lobby_type}},
|
||||
{"$ep3battledebug", {server_command_enable_ep3_battle_debug_menu, nullptr}},
|
||||
{"$loadchar", {server_command_loadchar, nullptr}},
|
||||
{"$matcount", {server_command_show_material_counts, nullptr}},
|
||||
{"$maxlevel", {server_command_max_level, nullptr}},
|
||||
{"$meseta", {server_command_meseta, nullptr}},
|
||||
@@ -1707,15 +1892,17 @@ static const unordered_map<string, ChatCommandDefinition> chat_commands({
|
||||
{"$password", {server_command_password, nullptr}},
|
||||
{"$patch", {server_command_patch, proxy_command_patch}},
|
||||
{"$persist", {server_command_persist, nullptr}},
|
||||
{"$ping", {server_command_ping, nullptr}},
|
||||
{"$ping", {server_command_ping, proxy_command_ping}},
|
||||
{"$playrec", {server_command_playrec, nullptr}},
|
||||
{"$qcall", {server_command_qcall, proxy_command_qcall}},
|
||||
{"$qclear", {server_command_qclear, nullptr}},
|
||||
{"$qset", {server_command_qset, nullptr}},
|
||||
{"$qsync", {server_command_qsync, nullptr}},
|
||||
{"$qcheck", {server_command_qcheck, nullptr}},
|
||||
{"$qclear", {server_command_qclear, proxy_command_qclear}},
|
||||
{"$qset", {server_command_qset, proxy_command_qset}},
|
||||
{"$qsync", {server_command_qsync, proxy_command_qsync}},
|
||||
{"$quest", {server_command_quest, nullptr}},
|
||||
{"$rand", {server_command_rand, proxy_command_rand}},
|
||||
{"$save", {server_command_save, nullptr}},
|
||||
{"$savechar", {server_command_savechar, nullptr}},
|
||||
{"$saverec", {server_command_saverec, nullptr}},
|
||||
{"$sc", {server_command_send_client, proxy_command_send_client}},
|
||||
{"$secid", {server_command_secid, proxy_command_secid}},
|
||||
@@ -1731,6 +1918,7 @@ static const unordered_map<string, ChatCommandDefinition> chat_commands({
|
||||
{"$warpme", {server_command_warpme, proxy_command_warpme}},
|
||||
{"$warpall", {server_command_warpall, proxy_command_warpall}},
|
||||
{"$what", {server_command_what, nullptr}},
|
||||
{"$where", {server_command_where, nullptr}},
|
||||
});
|
||||
|
||||
struct SplitCommand {
|
||||
@@ -1753,6 +1941,9 @@ struct SplitCommand {
|
||||
// command, and to execute the command and block the chat if it is.
|
||||
void on_chat_command(std::shared_ptr<Client> c, const std::string& text) {
|
||||
SplitCommand cmd(text);
|
||||
if (!cmd.name.empty() && cmd.name[0] == '@') {
|
||||
cmd.name[0] = '$';
|
||||
}
|
||||
|
||||
const ChatCommandDefinition* def = nullptr;
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
#include "ChoiceSearch.hh"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "Client.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
const vector<ChoiceSearchCategory> CHOICE_SEARCH_CATEGORIES({
|
||||
ChoiceSearchCategory{
|
||||
.id = 0x0001,
|
||||
.name = "Level",
|
||||
.choices = {
|
||||
{0x0000, "Any"},
|
||||
{0x0001, "Own level +/- 5"},
|
||||
{0x0002, "Level 1-10"},
|
||||
{0x0003, "Level 11-20"},
|
||||
{0x0004, "Level 21-40"},
|
||||
{0x0005, "Level 41-60"},
|
||||
{0x0006, "Level 61-80"},
|
||||
{0x0007, "Level 81-100"},
|
||||
{0x0008, "Level 101-120"},
|
||||
{0x0009, "Level 121-160"},
|
||||
{0x000A, "Level 161-200"},
|
||||
},
|
||||
.client_matches = +[](shared_ptr<Client> searcher_c, shared_ptr<Client> target_c, uint16_t choice_id) -> bool {
|
||||
if (choice_id == 0x0000) {
|
||||
return true;
|
||||
}
|
||||
uint32_t target_level = target_c->character()->disp.stats.level + 1;
|
||||
switch (choice_id) {
|
||||
case 0x0001:
|
||||
return (labs(static_cast<int32_t>(target_level - searcher_c->character()->disp.stats.level)) <= 5);
|
||||
case 0x0002:
|
||||
return (target_level <= 10);
|
||||
case 0x0003:
|
||||
return (target_level > 10) && (target_level <= 20);
|
||||
case 0x0004:
|
||||
return (target_level > 20) && (target_level <= 40);
|
||||
case 0x0005:
|
||||
return (target_level > 40) && (target_level <= 60);
|
||||
case 0x0006:
|
||||
return (target_level > 60) && (target_level <= 80);
|
||||
case 0x0007:
|
||||
return (target_level > 80) && (target_level <= 100);
|
||||
case 0x0008:
|
||||
return (target_level > 100) && (target_level <= 120);
|
||||
case 0x0009:
|
||||
return (target_level > 120) && (target_level <= 160);
|
||||
case 0x000A:
|
||||
return (target_level > 160) && (target_level <= 200);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
},
|
||||
ChoiceSearchCategory{
|
||||
.id = 0x0002,
|
||||
.name = "Class",
|
||||
.choices = {
|
||||
{0x0000, "Any"},
|
||||
{0x0010, "Hunter"},
|
||||
{0x0001, "HUmar"},
|
||||
{0x0002, "HUnewearl"},
|
||||
{0x0003, "HUcast"},
|
||||
{0x000A, "HUcaseal"},
|
||||
{0x0011, "Ranger"},
|
||||
{0x0004, "RAmar"},
|
||||
{0x000C, "RAmarl"},
|
||||
{0x0005, "RAcast"},
|
||||
{0x0006, "RAcaseal"},
|
||||
{0x0012, "Force"},
|
||||
{0x000B, "FOmar"},
|
||||
{0x0007, "FOmarl"},
|
||||
{0x0008, "FOnewm"},
|
||||
{0x0009, "FOnewearl"},
|
||||
},
|
||||
.client_matches = +[](shared_ptr<Client>, shared_ptr<Client> target_c, uint16_t choice_id) -> bool {
|
||||
switch (choice_id) {
|
||||
case 0x0000:
|
||||
return true;
|
||||
case 0x0010:
|
||||
return target_c->character()->disp.visual.class_flags & 0x20;
|
||||
case 0x0011:
|
||||
return target_c->character()->disp.visual.class_flags & 0x40;
|
||||
case 0x0012:
|
||||
return target_c->character()->disp.visual.class_flags & 0x80;
|
||||
default:
|
||||
return ((choice_id - 1) == target_c->character()->disp.visual.char_class);
|
||||
}
|
||||
},
|
||||
},
|
||||
ChoiceSearchCategory{
|
||||
.id = 0x0003,
|
||||
.name = "Platform",
|
||||
.choices = {
|
||||
{0x0000, "Any"},
|
||||
{0x0001, "DC betas"},
|
||||
{0x0002, "DC V1"},
|
||||
{0x0003, "DC V2 / PC"},
|
||||
{0x0004, "GC / Xbox Episodes 1&2"},
|
||||
{0x0005, "GC Episode 3"},
|
||||
{0x0006, "BB"},
|
||||
},
|
||||
.client_matches = +[](shared_ptr<Client>, shared_ptr<Client> target_c, uint16_t choice_id) -> bool {
|
||||
if (choice_id == 0x0000) {
|
||||
return true;
|
||||
}
|
||||
switch (target_c->version()) {
|
||||
case Version::DC_NTE:
|
||||
case Version::DC_V1_11_2000_PROTOTYPE:
|
||||
return (choice_id == 0x0001);
|
||||
case Version::DC_V1:
|
||||
return (choice_id == 0x0002);
|
||||
case Version::DC_V2:
|
||||
case Version::PC_NTE:
|
||||
case Version::PC_V2:
|
||||
return (choice_id == 0x0003);
|
||||
case Version::GC_NTE:
|
||||
case Version::GC_V3:
|
||||
case Version::XB_V3:
|
||||
return (choice_id == 0x0004);
|
||||
case Version::GC_EP3_TRIAL_EDITION:
|
||||
case Version::GC_EP3:
|
||||
return (choice_id == 0x0005);
|
||||
case Version::BB_V4:
|
||||
return (choice_id == 0x0006);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
},
|
||||
ChoiceSearchCategory{
|
||||
.id = 0x0204,
|
||||
.name = "Game mode",
|
||||
.choices = {
|
||||
{0x0000, "Any"},
|
||||
{0x0001, "Normal"},
|
||||
{0x0002, "Hard"},
|
||||
{0x0003, "Very Hard"},
|
||||
{0x0004, "Ultimate"},
|
||||
{0x0005, "Battle"},
|
||||
{0x0006, "Challenge"},
|
||||
},
|
||||
.client_matches = +[](shared_ptr<Client>, shared_ptr<Client> target_c, uint16_t choice_id) -> bool {
|
||||
uint16_t target_choice_id = target_c->character()->choice_search_config.get_setting(0x0204);
|
||||
return (choice_id == 0) || (target_choice_id == 0) || (choice_id == target_choice_id);
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <phosg/Encoding.hh>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Text.hh"
|
||||
|
||||
class Client;
|
||||
|
||||
struct ChoiceSearchConfig {
|
||||
le_uint32_t disabled = 1; // 0 = enabled, 1 = disabled. Unused in command C3
|
||||
struct Entry {
|
||||
le_uint16_t parent_choice_id = 0;
|
||||
le_uint16_t choice_id = 0;
|
||||
} __attribute__((packed));
|
||||
parray<Entry, 5> entries;
|
||||
|
||||
int32_t get_setting(uint16_t parent_choice_id) const {
|
||||
for (size_t z = 0; z < this->entries.size(); z++) {
|
||||
if (this->entries[z].parent_choice_id == parent_choice_id) {
|
||||
return this->entries[z].choice_id;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
} __attribute__((packed));
|
||||
|
||||
struct ChoiceSearchCategory {
|
||||
struct Choice {
|
||||
uint16_t id;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
uint16_t id;
|
||||
const char* name;
|
||||
std::vector<Choice> choices;
|
||||
std::function<bool(std::shared_ptr<Client> searcher_c, std::shared_ptr<Client> target_c, uint16_t choice_id)> client_matches;
|
||||
};
|
||||
|
||||
extern const std::vector<ChoiceSearchCategory> CHOICE_SEARCH_CATEGORIES;
|
||||
+665
-12
@@ -40,6 +40,7 @@ void Client::Config::set_flags_for_version(Version version, int64_t sub_version)
|
||||
this->set_flag(Flag::NO_D6);
|
||||
this->set_flag(Flag::SEND_FUNCTION_CALL_NO_CACHE_PATCH);
|
||||
break;
|
||||
case Version::PC_NTE:
|
||||
case Version::PC_V2:
|
||||
this->set_flag(Flag::NO_D6);
|
||||
this->set_flag(Flag::SEND_FUNCTION_CALL_CHECKSUM_ONLY);
|
||||
@@ -171,11 +172,13 @@ Client::Client(
|
||||
card_battle_table_number(-1),
|
||||
card_battle_table_seat_number(0),
|
||||
card_battle_table_seat_state(0),
|
||||
should_update_play_time(false),
|
||||
bb_character_index(-1),
|
||||
next_exp_value(0),
|
||||
can_chat(true),
|
||||
pending_bb_save_character_index(0),
|
||||
dol_base_addr(0) {
|
||||
|
||||
dol_base_addr(0),
|
||||
external_bank_character_index(-1),
|
||||
last_play_time_update(0) {
|
||||
this->config.set_flags_for_version(version, -1);
|
||||
this->config.specific_version = default_specific_version_for_version(version, -1);
|
||||
|
||||
@@ -204,6 +207,9 @@ Client::~Client() {
|
||||
}
|
||||
}
|
||||
|
||||
if ((this->version() == Version::BB_V4) && (this->character_data.get())) {
|
||||
this->save_all();
|
||||
}
|
||||
this->log.info("Deleted");
|
||||
}
|
||||
|
||||
@@ -222,11 +228,15 @@ void Client::reschedule_ping_and_timeout_events() {
|
||||
}
|
||||
|
||||
void Client::set_license(shared_ptr<License> l) {
|
||||
this->license = l;
|
||||
this->game_data.guild_card_number = this->license->serial_number;
|
||||
if (this->version() == Version::BB_V4) {
|
||||
this->game_data.bb_username = this->license->bb_username;
|
||||
// Make sure bb_username is filename-safe
|
||||
for (char ch : l->bb_username) {
|
||||
if (!isalnum(ch) && (ch != '-') && (ch != '_')) {
|
||||
throw runtime_error("invalid characters in username");
|
||||
}
|
||||
}
|
||||
}
|
||||
this->license = l;
|
||||
}
|
||||
|
||||
shared_ptr<ServerState> Client::require_server_state() const {
|
||||
@@ -245,7 +255,7 @@ shared_ptr<Lobby> Client::require_lobby() const {
|
||||
return l;
|
||||
}
|
||||
|
||||
shared_ptr<TeamIndex::Team> Client::team() {
|
||||
shared_ptr<const TeamIndex::Team> Client::team() const {
|
||||
if (!this->license) {
|
||||
throw logic_error("Client::team called on client with no license");
|
||||
}
|
||||
@@ -254,10 +264,11 @@ shared_ptr<TeamIndex::Team> Client::team() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto p = this->game_data.character(false);
|
||||
auto p = this->character(false);
|
||||
auto s = this->require_server_state();
|
||||
auto team = s->team_index->get_by_id(this->license->bb_team_id);
|
||||
if (!team) {
|
||||
this->log.info("License contains a team ID, but the team does not exist; clearing team ID from license");
|
||||
this->license->bb_team_id = 0;
|
||||
this->license->save();
|
||||
return nullptr;
|
||||
@@ -265,6 +276,7 @@ shared_ptr<TeamIndex::Team> Client::team() {
|
||||
|
||||
auto member_it = team->members.find(this->license->serial_number);
|
||||
if (member_it == team->members.end()) {
|
||||
this->log.info("License contains a team ID, but the team does not contain this member; clearing team ID from license");
|
||||
this->license->bb_team_id = 0;
|
||||
this->license->save();
|
||||
return nullptr;
|
||||
@@ -277,14 +289,49 @@ shared_ptr<TeamIndex::Team> Client::team() {
|
||||
string name = p->disp.name.decode(this->language());
|
||||
if (m.name != name) {
|
||||
this->log.info("Updating player name in team config");
|
||||
m.name = name;
|
||||
team->save_config();
|
||||
s->team_index->update_member_name(this->license->serial_number, name);
|
||||
}
|
||||
}
|
||||
|
||||
return team;
|
||||
}
|
||||
|
||||
bool Client::can_see_quest(shared_ptr<const Quest> q, uint8_t difficulty, size_t num_players) const {
|
||||
if (this->license && (this->license->flags & License::Flag::DISABLE_QUEST_REQUIREMENTS)) {
|
||||
return true;
|
||||
}
|
||||
if (!q->available_expression) {
|
||||
return true;
|
||||
}
|
||||
string expr = q->available_expression->str();
|
||||
QuestAvailabilityExpression::Env env = {
|
||||
.flags = &this->character()->quest_flags.data.at(difficulty),
|
||||
.team = this->team(),
|
||||
.num_players = num_players,
|
||||
};
|
||||
int64_t ret = q->available_expression->evaluate(env);
|
||||
this->log.info("Evaluated quest availability expression %s => %s", expr.c_str(), ret ? "TRUE" : "FALSE");
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Client::can_play_quest(shared_ptr<const Quest> q, uint8_t difficulty, size_t num_players) const {
|
||||
if (this->license && (this->license->flags & License::Flag::DISABLE_QUEST_REQUIREMENTS)) {
|
||||
return true;
|
||||
}
|
||||
if (!q->enabled_expression) {
|
||||
return true;
|
||||
}
|
||||
string expr = q->enabled_expression->str();
|
||||
QuestAvailabilityExpression::Env env = {
|
||||
.flags = &this->character()->quest_flags.data.at(difficulty),
|
||||
.team = this->team(),
|
||||
.num_players = num_players,
|
||||
};
|
||||
bool ret = q->enabled_expression->evaluate(env);
|
||||
this->log.info("Evaluating quest enabled expression %s => %s", expr.c_str(), ret ? "TRUE" : "FALSE");
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Client::dispatch_save_game_data(evutil_socket_t, short, void* ctx) {
|
||||
reinterpret_cast<Client*>(ctx)->save_game_data();
|
||||
}
|
||||
@@ -293,8 +340,8 @@ void Client::save_game_data() {
|
||||
if (this->version() != Version::BB_V4) {
|
||||
throw logic_error("save_game_data called for non-BB client");
|
||||
}
|
||||
if (this->game_data.character(false)) {
|
||||
this->game_data.save_character_file();
|
||||
if (this->character(false)) {
|
||||
this->save_all();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,3 +382,609 @@ void Client::suspend_timeouts() {
|
||||
event_del(this->idle_timeout_event.get());
|
||||
this->log.info("Timeouts suspended");
|
||||
}
|
||||
|
||||
void Client::create_battle_overlay(shared_ptr<const BattleRules> rules, shared_ptr<const LevelTable> level_table) {
|
||||
this->overlay_character_data = make_shared<PSOBBCharacterFile>(*this->character(true, false));
|
||||
|
||||
if (rules->weapon_and_armor_mode != BattleRules::WeaponAndArmorMode::ALLOW) {
|
||||
this->overlay_character_data->inventory.remove_all_items_of_type(0);
|
||||
this->overlay_character_data->inventory.remove_all_items_of_type(1);
|
||||
}
|
||||
if (rules->mag_mode == BattleRules::MagMode::FORBID_ALL) {
|
||||
this->overlay_character_data->inventory.remove_all_items_of_type(2);
|
||||
}
|
||||
if (rules->tool_mode != BattleRules::ToolMode::ALLOW) {
|
||||
this->overlay_character_data->inventory.remove_all_items_of_type(3);
|
||||
}
|
||||
if (rules->replace_char) {
|
||||
// TODO: Shouldn't we clear other material usage here? It looks like the
|
||||
// original code doesn't, but that seems wrong.
|
||||
this->overlay_character_data->inventory.hp_from_materials = 0;
|
||||
this->overlay_character_data->inventory.tp_from_materials = 0;
|
||||
|
||||
uint32_t target_level = clamp<uint32_t>(rules->char_level, 0, 199);
|
||||
uint8_t char_class = this->overlay_character_data->disp.visual.char_class;
|
||||
auto& stats = this->overlay_character_data->disp.stats;
|
||||
|
||||
stats.reset_to_base(char_class, level_table);
|
||||
stats.advance_to_level(char_class, target_level, level_table);
|
||||
|
||||
stats.unknown_a1 = 40;
|
||||
stats.meseta = 300;
|
||||
}
|
||||
if (rules->tech_disk_mode == BattleRules::TechDiskMode::LIMIT_LEVEL) {
|
||||
// TODO: Verify this is what the game actually does.
|
||||
for (uint8_t tech_num = 0; tech_num < 0x13; tech_num++) {
|
||||
uint8_t existing_level = this->overlay_character_data->get_technique_level(tech_num);
|
||||
if ((existing_level != 0xFF) && (existing_level > rules->max_tech_level)) {
|
||||
this->overlay_character_data->set_technique_level(tech_num, rules->max_tech_level);
|
||||
}
|
||||
}
|
||||
} else if (rules->tech_disk_mode == BattleRules::TechDiskMode::FORBID_ALL) {
|
||||
for (uint8_t tech_num = 0; tech_num < 0x13; tech_num++) {
|
||||
this->overlay_character_data->set_technique_level(tech_num, 0xFF);
|
||||
}
|
||||
}
|
||||
if (rules->meseta_mode != BattleRules::MesetaMode::ALLOW) {
|
||||
this->overlay_character_data->disp.stats.meseta = 0;
|
||||
}
|
||||
if (rules->forbid_scape_dolls) {
|
||||
this->overlay_character_data->inventory.remove_all_items_of_type(3, 9);
|
||||
}
|
||||
}
|
||||
|
||||
void Client::create_challenge_overlay(Version version, size_t template_index, shared_ptr<const LevelTable> level_table) {
|
||||
auto p = this->character(true, false);
|
||||
const auto& tpl = get_challenge_template_definition(version, p->disp.visual.class_flags, template_index);
|
||||
|
||||
this->overlay_character_data = make_shared<PSOBBCharacterFile>(*p);
|
||||
auto overlay = this->overlay_character_data;
|
||||
|
||||
for (size_t z = 0; z < overlay->inventory.items.size(); z++) {
|
||||
auto& i = overlay->inventory.items[z];
|
||||
i.present = 0;
|
||||
i.unknown_a1 = 0;
|
||||
i.extension_data1 = 0;
|
||||
i.extension_data2 = 0;
|
||||
i.flags = 0;
|
||||
i.data = ItemData();
|
||||
}
|
||||
|
||||
overlay->inventory.items[13].extension_data2 = 1;
|
||||
|
||||
overlay->disp.stats.reset_to_base(overlay->disp.visual.char_class, level_table);
|
||||
overlay->disp.stats.advance_to_level(overlay->disp.visual.char_class, tpl.level, level_table);
|
||||
|
||||
overlay->disp.stats.unknown_a1 = 40;
|
||||
overlay->disp.stats.unknown_a3 = 10.0;
|
||||
overlay->disp.stats.experience = level_table->stats_delta_for_level(overlay->disp.visual.char_class, overlay->disp.stats.level).experience;
|
||||
overlay->disp.stats.meseta = 0;
|
||||
overlay->clear_all_material_usage();
|
||||
for (size_t z = 0; z < 0x13; z++) {
|
||||
overlay->set_technique_level(z, 0xFF);
|
||||
}
|
||||
|
||||
for (size_t z = 0; z < tpl.items.size(); z++) {
|
||||
auto& inv_item = overlay->inventory.items[z];
|
||||
inv_item.present = tpl.items[z].present;
|
||||
inv_item.unknown_a1 = tpl.items[z].unknown_a1;
|
||||
inv_item.flags = tpl.items[z].flags;
|
||||
inv_item.data = tpl.items[z].data;
|
||||
}
|
||||
overlay->inventory.num_items = tpl.items.size();
|
||||
|
||||
for (const auto& tech_level : tpl.tech_levels) {
|
||||
overlay->set_technique_level(tech_level.tech_num, tech_level.level);
|
||||
}
|
||||
}
|
||||
|
||||
void Client::import_blocked_senders(const parray<le_uint32_t, 30>& blocked_senders) {
|
||||
this->blocked_senders.clear();
|
||||
for (size_t z = 0; z < blocked_senders.size(); z++) {
|
||||
if (blocked_senders[z]) {
|
||||
this->blocked_senders.emplace(blocked_senders[z]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shared_ptr<PSOBBBaseSystemFile> Client::system_file(bool allow_load) {
|
||||
if (!this->system_data && allow_load) {
|
||||
this->load_all_files();
|
||||
}
|
||||
return this->system_data;
|
||||
}
|
||||
|
||||
shared_ptr<const PSOBBBaseSystemFile> Client::system_file(bool allow_load) const {
|
||||
if (!this->system_data.get() && allow_load) {
|
||||
throw runtime_error("system data is not loaded");
|
||||
}
|
||||
return this->system_data;
|
||||
}
|
||||
|
||||
shared_ptr<PSOBBCharacterFile> Client::character(bool allow_load, bool allow_overlay) {
|
||||
if (this->overlay_character_data && allow_overlay) {
|
||||
return this->overlay_character_data;
|
||||
}
|
||||
if (!this->character_data && allow_load) {
|
||||
if ((this->version() == Version::BB_V4) && (this->bb_character_index < 0)) {
|
||||
throw runtime_error("character index not specified");
|
||||
}
|
||||
this->load_all_files();
|
||||
}
|
||||
return this->character_data;
|
||||
}
|
||||
|
||||
shared_ptr<const PSOBBCharacterFile> Client::character(bool allow_load, bool allow_overlay) const {
|
||||
if (allow_overlay && this->overlay_character_data) {
|
||||
return this->overlay_character_data;
|
||||
}
|
||||
if (!this->character_data && allow_load) {
|
||||
throw runtime_error("character data is not loaded");
|
||||
}
|
||||
return this->character_data;
|
||||
}
|
||||
|
||||
shared_ptr<PSOBBGuildCardFile> Client::guild_card_file(bool allow_load) {
|
||||
if (!this->guild_card_data && allow_load) {
|
||||
this->load_all_files();
|
||||
}
|
||||
return this->guild_card_data;
|
||||
}
|
||||
|
||||
shared_ptr<const PSOBBGuildCardFile> Client::guild_card_file(bool allow_load) const {
|
||||
if (!this->guild_card_data && allow_load) {
|
||||
throw runtime_error("account data is not loaded");
|
||||
}
|
||||
return this->guild_card_data;
|
||||
}
|
||||
|
||||
string Client::system_filename() const {
|
||||
if (this->version() != Version::BB_V4) {
|
||||
throw logic_error("non-BB players do not have system data");
|
||||
}
|
||||
if (!this->license) {
|
||||
throw logic_error("client is not logged in");
|
||||
}
|
||||
return string_printf("system/players/system_%s.psosys", this->license->bb_username.c_str());
|
||||
}
|
||||
|
||||
string Client::character_filename(const std::string& bb_username, int8_t index) {
|
||||
if (bb_username.empty()) {
|
||||
throw logic_error("non-BB players do not have character data");
|
||||
}
|
||||
if (index < 0) {
|
||||
throw logic_error("character index is not set");
|
||||
}
|
||||
return string_printf("system/players/player_%s_%hhd.psochar", bb_username.c_str(), index);
|
||||
}
|
||||
|
||||
string Client::backup_character_filename(uint32_t serial_number, size_t index) {
|
||||
return string_printf("system/players/backup_player_%" PRIu32 "_%zu.psochar", serial_number, index);
|
||||
}
|
||||
|
||||
string Client::character_filename(int8_t index) const {
|
||||
if (this->version() != Version::BB_V4) {
|
||||
throw logic_error("non-BB players do not have character data");
|
||||
}
|
||||
if (!this->license) {
|
||||
throw logic_error("client is not logged in");
|
||||
}
|
||||
return this->character_filename(this->license->bb_username, (index < 0) ? this->bb_character_index : index);
|
||||
}
|
||||
|
||||
string Client::guild_card_filename() const {
|
||||
if (this->version() != Version::BB_V4) {
|
||||
throw logic_error("non-BB players do not have character data");
|
||||
}
|
||||
if (!this->license) {
|
||||
throw logic_error("client is not logged in");
|
||||
}
|
||||
return string_printf("system/players/guild_cards_%s.psocard", this->license->bb_username.c_str());
|
||||
}
|
||||
|
||||
string Client::shared_bank_filename() const {
|
||||
if (this->version() != Version::BB_V4) {
|
||||
throw logic_error("non-BB players do not have character data");
|
||||
}
|
||||
if (!this->license) {
|
||||
throw logic_error("client is not logged in");
|
||||
}
|
||||
return string_printf("system/players/shared_bank_%s.psobank", this->license->bb_username.c_str());
|
||||
}
|
||||
|
||||
string Client::legacy_account_filename() const {
|
||||
if (this->version() != Version::BB_V4) {
|
||||
throw logic_error("non-BB players do not have character data");
|
||||
}
|
||||
if (!this->license) {
|
||||
throw logic_error("client is not logged in");
|
||||
}
|
||||
return string_printf("system/players/account_%s.nsa", this->license->bb_username.c_str());
|
||||
}
|
||||
|
||||
string Client::legacy_player_filename() const {
|
||||
if (this->version() != Version::BB_V4) {
|
||||
throw logic_error("non-BB players do not have character data");
|
||||
}
|
||||
if (!this->license) {
|
||||
throw logic_error("client is not logged in");
|
||||
}
|
||||
if (this->bb_character_index < 0) {
|
||||
throw logic_error("character index is not set");
|
||||
}
|
||||
return string_printf(
|
||||
"system/players/player_%s_%hhd.nsc",
|
||||
this->license->bb_username.c_str(),
|
||||
static_cast<int8_t>(this->bb_character_index + 1));
|
||||
}
|
||||
|
||||
void Client::create_character_file(
|
||||
uint32_t guild_card_number,
|
||||
uint8_t language,
|
||||
const PlayerDispDataBBPreview& preview,
|
||||
shared_ptr<const LevelTable> level_table) {
|
||||
this->character_data = PSOBBCharacterFile::create_from_preview(guild_card_number, language, preview, level_table);
|
||||
this->save_character_file();
|
||||
}
|
||||
|
||||
void Client::load_all_files() {
|
||||
if (this->version() != Version::BB_V4) {
|
||||
this->system_data = make_shared<PSOBBBaseSystemFile>();
|
||||
this->character_data = make_shared<PSOBBCharacterFile>();
|
||||
this->guild_card_data = make_shared<PSOBBGuildCardFile>();
|
||||
return;
|
||||
}
|
||||
if (!this->license) {
|
||||
throw logic_error("cannot load BB player data until client is logged in");
|
||||
}
|
||||
|
||||
this->system_data.reset();
|
||||
this->character_data.reset();
|
||||
this->guild_card_data.reset();
|
||||
|
||||
auto files_manager = this->require_server_state()->player_files_manager;
|
||||
|
||||
string sys_filename = this->system_filename();
|
||||
this->system_data = files_manager->get_system(sys_filename);
|
||||
if (this->system_data) {
|
||||
player_data_log.info("Using loaded system file %s", sys_filename.c_str());
|
||||
} else if (isfile(sys_filename)) {
|
||||
this->system_data = make_shared<PSOBBBaseSystemFile>(load_object_file<PSOBBBaseSystemFile>(sys_filename, true));
|
||||
files_manager->set_system(sys_filename, this->system_data);
|
||||
player_data_log.info("Loaded system data from %s", sys_filename.c_str());
|
||||
} else {
|
||||
player_data_log.info("System file is missing: %s", sys_filename.c_str());
|
||||
}
|
||||
|
||||
if (this->bb_character_index >= 0) {
|
||||
string char_filename = this->character_filename();
|
||||
this->character_data = files_manager->get_character(char_filename);
|
||||
if (this->character_data) {
|
||||
player_data_log.info("Using loaded character file %s", char_filename.c_str());
|
||||
} else if (isfile(char_filename)) {
|
||||
auto f = fopen_unique(char_filename, "rb");
|
||||
auto header = freadx<PSOCommandHeaderBB>(f.get());
|
||||
if (header.size != 0x399C) {
|
||||
throw runtime_error("incorrect size in character file header");
|
||||
}
|
||||
if (header.command != 0x00E7) {
|
||||
throw runtime_error("incorrect command in character file header");
|
||||
}
|
||||
if (header.flag != 0x00000000) {
|
||||
throw runtime_error("incorrect flag in character file header");
|
||||
}
|
||||
this->character_data = make_shared<PSOBBCharacterFile>(freadx<PSOBBCharacterFile>(f.get()));
|
||||
files_manager->set_character(char_filename, this->character_data);
|
||||
player_data_log.info("Loaded character data from %s", char_filename.c_str());
|
||||
|
||||
// If there was no .psosys file, load the system file from the .psochar
|
||||
// file instead
|
||||
if (!this->system_data) {
|
||||
this->system_data = make_shared<PSOBBBaseSystemFile>(freadx<PSOBBBaseSystemFile>(f.get()));
|
||||
files_manager->set_system(sys_filename, this->system_data);
|
||||
player_data_log.info("Loaded system data from %s", char_filename.c_str());
|
||||
}
|
||||
} else {
|
||||
player_data_log.info("Character file is missing: %s", char_filename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
string card_filename = this->guild_card_filename();
|
||||
this->guild_card_data = files_manager->get_guild_card(card_filename);
|
||||
if (this->guild_card_data) {
|
||||
player_data_log.info("Using loaded Guild Card file %s", card_filename.c_str());
|
||||
} else if (isfile(card_filename)) {
|
||||
this->guild_card_data = make_shared<PSOBBGuildCardFile>(load_object_file<PSOBBGuildCardFile>(card_filename));
|
||||
files_manager->set_guild_card(card_filename, this->guild_card_data);
|
||||
player_data_log.info("Loaded Guild Card data from %s", card_filename.c_str());
|
||||
} else {
|
||||
player_data_log.info("Guild Card file is missing: %s", card_filename.c_str());
|
||||
}
|
||||
|
||||
// If any of the above files were missing, try to load from .nsa/.nsc files instead
|
||||
if (!this->system_data || (!this->character_data && (this->bb_character_index >= 0)) || !this->guild_card_data) {
|
||||
string nsa_filename = this->legacy_account_filename();
|
||||
shared_ptr<LegacySavedAccountDataBB> nsa_data;
|
||||
if (isfile(nsa_filename)) {
|
||||
nsa_data = make_shared<LegacySavedAccountDataBB>(load_object_file<LegacySavedAccountDataBB>(nsa_filename));
|
||||
if (!nsa_data->signature.eq(LegacySavedAccountDataBB::SIGNATURE)) {
|
||||
throw runtime_error("account data header is incorrect");
|
||||
}
|
||||
if (!this->system_data) {
|
||||
this->system_data = make_shared<PSOBBBaseSystemFile>(nsa_data->system_file.base);
|
||||
files_manager->set_system(sys_filename, this->system_data);
|
||||
player_data_log.info("Loaded legacy system data from %s", nsa_filename.c_str());
|
||||
}
|
||||
if (!this->guild_card_data) {
|
||||
this->guild_card_data = make_shared<PSOBBGuildCardFile>(nsa_data->guild_card_file);
|
||||
files_manager->set_guild_card(card_filename, this->guild_card_data);
|
||||
player_data_log.info("Loaded legacy Guild Card data from %s", nsa_filename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->system_data) {
|
||||
this->system_data = make_shared<PSOBBBaseSystemFile>();
|
||||
files_manager->set_system(sys_filename, this->system_data);
|
||||
player_data_log.info("Created new system data");
|
||||
}
|
||||
if (!this->guild_card_data) {
|
||||
this->guild_card_data = make_shared<PSOBBGuildCardFile>();
|
||||
files_manager->set_guild_card(card_filename, this->guild_card_data);
|
||||
player_data_log.info("Created new Guild Card data");
|
||||
}
|
||||
|
||||
if (!this->character_data && (this->bb_character_index >= 0)) {
|
||||
string nsc_filename = this->legacy_player_filename();
|
||||
auto nsc_data = load_object_file<LegacySavedPlayerDataBB>(nsc_filename);
|
||||
if (nsc_data.signature == LegacySavedPlayerDataBB::SIGNATURE_V0) {
|
||||
nsc_data.signature = LegacySavedPlayerDataBB::SIGNATURE_V0;
|
||||
nsc_data.unused.clear();
|
||||
nsc_data.battle_records.place_counts.clear(0);
|
||||
nsc_data.battle_records.disconnect_count = 0;
|
||||
nsc_data.battle_records.unknown_a1.clear(0);
|
||||
} else if (nsc_data.signature != LegacySavedPlayerDataBB::SIGNATURE_V1) {
|
||||
throw runtime_error("legacy player data has incorrect signature");
|
||||
}
|
||||
|
||||
this->character_data = make_shared<PSOBBCharacterFile>();
|
||||
files_manager->set_character(this->character_filename(), this->character_data);
|
||||
this->character_data->inventory = nsc_data.inventory;
|
||||
this->character_data->disp = nsc_data.disp;
|
||||
this->character_data->play_time_seconds = nsc_data.disp.play_time;
|
||||
this->character_data->unknown_a2 = nsc_data.unknown_a2;
|
||||
this->character_data->quest_flags = nsc_data.quest_flags;
|
||||
this->character_data->death_count = nsc_data.death_count;
|
||||
this->character_data->bank = nsc_data.bank;
|
||||
this->character_data->guild_card.guild_card_number = this->license->serial_number;
|
||||
this->character_data->guild_card.name = nsc_data.disp.name;
|
||||
this->character_data->guild_card.description = nsc_data.guild_card_description;
|
||||
this->character_data->guild_card.present = 1;
|
||||
this->character_data->guild_card.language = nsc_data.inventory.language;
|
||||
this->character_data->guild_card.section_id = nsc_data.disp.visual.section_id;
|
||||
this->character_data->guild_card.char_class = nsc_data.disp.visual.char_class;
|
||||
this->character_data->auto_reply = nsc_data.auto_reply;
|
||||
this->character_data->info_board = nsc_data.info_board;
|
||||
this->character_data->battle_records = nsc_data.battle_records;
|
||||
this->character_data->challenge_records = nsc_data.challenge_records;
|
||||
this->character_data->tech_menu_config = nsc_data.tech_menu_config;
|
||||
this->character_data->quest_global_flags = nsc_data.quest_global_flags;
|
||||
if (nsa_data) {
|
||||
this->character_data->option_flags = nsa_data->option_flags;
|
||||
this->character_data->symbol_chats = nsa_data->symbol_chats;
|
||||
this->character_data->shortcuts = nsa_data->shortcuts;
|
||||
player_data_log.info("Loaded legacy player data from %s and %s", nsa_filename.c_str(), nsc_filename.c_str());
|
||||
} else {
|
||||
player_data_log.info("Loaded legacy player data from %s", nsc_filename.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this->character_data) {
|
||||
this->license->auto_reply_message = this->character_data->auto_reply.decode();
|
||||
this->license->save();
|
||||
}
|
||||
|
||||
this->blocked_senders.clear();
|
||||
for (size_t z = 0; z < this->guild_card_data->blocked.size(); z++) {
|
||||
if (this->guild_card_data->blocked[z].present) {
|
||||
this->blocked_senders.emplace(this->guild_card_data->blocked[z].guild_card_number);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->character_data) {
|
||||
this->last_play_time_update = now();
|
||||
}
|
||||
}
|
||||
|
||||
void Client::save_all() {
|
||||
if (this->system_data) {
|
||||
this->save_system_file();
|
||||
}
|
||||
if (this->character_data) {
|
||||
this->save_character_file();
|
||||
}
|
||||
if (this->guild_card_data) {
|
||||
this->save_guild_card_file();
|
||||
}
|
||||
if (this->external_bank) {
|
||||
string filename = this->shared_bank_filename();
|
||||
save_object_file<PlayerBank>(filename, *this->external_bank);
|
||||
player_data_log.info("Saved shared bank file %s", filename.c_str());
|
||||
}
|
||||
if (this->external_bank_character) {
|
||||
this->save_character_file(
|
||||
this->character_filename(this->external_bank_character_index),
|
||||
this->system_data,
|
||||
this->external_bank_character);
|
||||
}
|
||||
}
|
||||
|
||||
void Client::save_system_file() const {
|
||||
if (!this->system_data) {
|
||||
throw logic_error("no system file loaded");
|
||||
}
|
||||
string filename = this->system_filename();
|
||||
save_object_file(filename, *this->system_data);
|
||||
player_data_log.info("Saved system file %s", filename.c_str());
|
||||
}
|
||||
|
||||
void Client::save_character_file(
|
||||
const string& filename,
|
||||
shared_ptr<const PSOBBBaseSystemFile> system,
|
||||
shared_ptr<const PSOBBCharacterFile> character) {
|
||||
auto f = fopen_unique(filename, "wb");
|
||||
PSOCommandHeaderBB header = {sizeof(PSOCommandHeaderBB) + sizeof(PSOBBCharacterFile) + sizeof(PSOBBBaseSystemFile) + sizeof(PSOBBTeamMembership), 0x00E7, 0x00000000};
|
||||
fwritex(f.get(), header);
|
||||
fwritex(f.get(), *character);
|
||||
fwritex(f.get(), *system);
|
||||
// TODO: Technically, we should write the actual team membership struct to the
|
||||
// file here, but that would cause Client to depend on License, which
|
||||
// it currently does not. This data doesn't matter at all for correctness
|
||||
// within newserv, since it ignores this data entirely and instead generates
|
||||
// the membership struct from the team ID in the License and the team's state.
|
||||
// So, writing correct data here would mostly be for compatibility with other
|
||||
// PSO servers. But if the other server is newserv, then this data would be
|
||||
// used anyway, and if it's not, then it would presumably have a different set
|
||||
// of teams with a different set of team IDs anyway, so the membership struct
|
||||
// here would be useless either way.
|
||||
static const PSOBBTeamMembership empty_membership;
|
||||
fwritex(f.get(), empty_membership);
|
||||
player_data_log.info("Saved character file %s", filename.c_str());
|
||||
}
|
||||
|
||||
void Client::save_character_file() {
|
||||
if (!this->system_data.get()) {
|
||||
throw logic_error("no system file loaded");
|
||||
}
|
||||
if (!this->character_data.get()) {
|
||||
throw logic_error("no character file loaded");
|
||||
}
|
||||
if (this->should_update_play_time) {
|
||||
// This is slightly inaccurate, since fractions of a second are truncated
|
||||
// off each time we save. I'm lazy, so insert shrug emoji here.
|
||||
uint64_t t = now();
|
||||
uint64_t seconds = (t - this->last_play_time_update) / 1000000;
|
||||
this->character_data->disp.play_time += seconds;
|
||||
this->character_data->play_time_seconds = this->character_data->disp.play_time;
|
||||
player_data_log.info("Added %" PRIu64 " seconds to play time", seconds);
|
||||
this->last_play_time_update = t;
|
||||
}
|
||||
|
||||
this->save_character_file(this->character_filename(), this->system_data, this->character_data);
|
||||
}
|
||||
|
||||
void Client::save_guild_card_file() const {
|
||||
if (!this->guild_card_data.get()) {
|
||||
throw logic_error("no Guild Card file loaded");
|
||||
}
|
||||
string filename = this->guild_card_filename();
|
||||
save_object_file(filename, *this->guild_card_data);
|
||||
player_data_log.info("Saved Guild Card file %s", filename.c_str());
|
||||
}
|
||||
|
||||
void Client::load_backup_character(uint32_t serial_number, size_t index) {
|
||||
string filename = this->backup_character_filename(serial_number, index);
|
||||
auto f = fopen_unique(filename, "rb");
|
||||
auto header = freadx<PSOCommandHeaderBB>(f.get());
|
||||
if (header.size != 0x399C) {
|
||||
throw runtime_error("incorrect size in character file header");
|
||||
}
|
||||
if (header.command != 0x00E7) {
|
||||
throw runtime_error("incorrect command in character file header");
|
||||
}
|
||||
if (header.flag != 0x00000000) {
|
||||
throw runtime_error("incorrect flag in character file header");
|
||||
}
|
||||
this->character_data = make_shared<PSOBBCharacterFile>(freadx<PSOBBCharacterFile>(f.get()));
|
||||
this->v1_v2_last_reported_disp.reset();
|
||||
}
|
||||
|
||||
void Client::save_and_unload_character() {
|
||||
if (this->character_data) {
|
||||
this->save_character_file();
|
||||
this->character_data.reset();
|
||||
this->log.info("Unloaded character");
|
||||
}
|
||||
}
|
||||
|
||||
PlayerBank& Client::current_bank() {
|
||||
if (this->external_bank) {
|
||||
return *this->external_bank;
|
||||
} else if (this->external_bank_character) {
|
||||
return this->external_bank_character->bank;
|
||||
}
|
||||
return this->character()->bank;
|
||||
}
|
||||
|
||||
std::shared_ptr<PSOBBCharacterFile> Client::current_bank_character() {
|
||||
return this->external_bank_character ? this->external_bank_character : this->character();
|
||||
}
|
||||
|
||||
void Client::use_default_bank() {
|
||||
if (this->external_bank) {
|
||||
string filename = this->shared_bank_filename();
|
||||
save_object_file<PlayerBank>(filename, *this->external_bank);
|
||||
this->external_bank.reset();
|
||||
player_data_log.info("Detached shared bank %s", filename.c_str());
|
||||
}
|
||||
if (this->external_bank_character) {
|
||||
string filename = this->character_filename(this->external_bank_character_index);
|
||||
this->save_character_file(filename, this->system_data, this->external_bank_character);
|
||||
this->external_bank_character.reset();
|
||||
player_data_log.info("Detached character %s from bank", filename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
bool Client::use_shared_bank() {
|
||||
this->use_default_bank();
|
||||
|
||||
string filename = this->shared_bank_filename();
|
||||
auto files_manager = this->require_server_state()->player_files_manager;
|
||||
this->external_bank = files_manager->get_bank(filename);
|
||||
if (this->external_bank) {
|
||||
player_data_log.info("Using loaded shared bank %s", filename.c_str());
|
||||
return true;
|
||||
} else if (isfile(filename)) {
|
||||
this->external_bank = make_shared<PlayerBank>(load_object_file<PlayerBank>(filename));
|
||||
files_manager->set_bank(filename, this->external_bank);
|
||||
player_data_log.info("Loaded shared bank %s", filename.c_str());
|
||||
return true;
|
||||
} else {
|
||||
this->external_bank = make_shared<PlayerBank>();
|
||||
files_manager->set_bank(filename, this->external_bank);
|
||||
player_data_log.info("Created shared bank for %s", filename.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Client::use_character_bank(int8_t index) {
|
||||
this->use_default_bank();
|
||||
if (index != this->bb_character_index) {
|
||||
auto files_manager = this->require_server_state()->player_files_manager;
|
||||
|
||||
string filename = this->character_filename(index);
|
||||
this->external_bank_character = files_manager->get_character(filename);
|
||||
if (this->external_bank_character) {
|
||||
this->external_bank_character_index = index;
|
||||
player_data_log.info("Using loaded character file %s for external bank", filename.c_str());
|
||||
} else if (isfile(filename)) {
|
||||
auto f = fopen_unique(filename, "rb");
|
||||
auto header = freadx<PSOCommandHeaderBB>(f.get());
|
||||
if (header.size != 0x399C) {
|
||||
throw runtime_error("incorrect size in character file header");
|
||||
}
|
||||
if (header.command != 0x00E7) {
|
||||
throw runtime_error("incorrect command in character file header");
|
||||
}
|
||||
if (header.flag != 0x00000000) {
|
||||
throw runtime_error("incorrect flag in character file header");
|
||||
}
|
||||
this->external_bank_character = make_shared<PSOBBCharacterFile>(freadx<PSOBBCharacterFile>(f.get()));
|
||||
this->external_bank_character_index = index;
|
||||
files_manager->set_character(filename, this->external_bank_character);
|
||||
player_data_log.info("Loaded character data from %s for external bank", filename.c_str());
|
||||
} else {
|
||||
throw runtime_error("character does not exist");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+124
-9
@@ -15,7 +15,7 @@
|
||||
#include "PSOEncryption.hh"
|
||||
#include "PSOProtocol.hh"
|
||||
#include "PatchFileIndex.hh"
|
||||
#include "Player.hh"
|
||||
#include "Quest.hh"
|
||||
#include "QuestScript.hh"
|
||||
#include "TeamIndex.hh"
|
||||
#include "Text.hh"
|
||||
@@ -25,7 +25,8 @@ extern const uint64_t CLIENT_CONFIG_MAGIC;
|
||||
class Server;
|
||||
struct Lobby;
|
||||
|
||||
struct Client : public std::enable_shared_from_this<Client> {
|
||||
class Client : public std::enable_shared_from_this<Client> {
|
||||
public:
|
||||
enum class Flag : uint64_t {
|
||||
// clang-format off
|
||||
|
||||
@@ -54,7 +55,10 @@ struct Client : public std::enable_shared_from_this<Client> {
|
||||
HAS_EP3_MEDIA_UPDATES = 0x0000000010000000,
|
||||
USE_OVERRIDE_RANDOM_SEED = 0x0000000020000000,
|
||||
HAS_GUILD_CARD_NUMBER = 0x0000000040000000,
|
||||
ACCEPTED_TEAM_INVITATION = 0x0000000080000000,
|
||||
AT_BANK_COUNTER = 0x0000000080000000,
|
||||
SHOULD_SEND_ARTIFICIAL_ITEM_STATE = 0x0001000000000000,
|
||||
SHOULD_SEND_ARTIFICIAL_FLAG_STATE = 0x0002000000000000,
|
||||
SHOULD_SEND_ENABLE_SAVE = 0x0004000000000000,
|
||||
|
||||
// Cheat mode flags
|
||||
SWITCH_ASSIST_ENABLED = 0x0000000100000000,
|
||||
@@ -75,11 +79,15 @@ struct Client : public std::enable_shared_from_this<Client> {
|
||||
PROXY_RED_NAME_ENABLED = 0x0000200000000000,
|
||||
PROXY_BLANK_NAME_ENABLED = 0x0000400000000000,
|
||||
PROXY_BLOCK_FUNCTION_CALLS = 0x0000800000000000,
|
||||
PROXY_EP3_UNMASK_WHISPERS = 0x0008000000000000,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
static constexpr uint64_t DEFAULT_FLAGS = static_cast<uint64_t>(Flag::PROXY_CHAT_COMMANDS_ENABLED) |
|
||||
static_cast<uint64_t>(Flag::PROXY_CHAT_FILTER_ENABLED);
|
||||
|
||||
struct Config {
|
||||
uint64_t enabled_flags = 0; // Client::Flag enum
|
||||
uint64_t enabled_flags = DEFAULT_FLAGS; // Client::Flag enum
|
||||
uint32_t specific_version = 0;
|
||||
int32_t override_random_seed = 0;
|
||||
uint8_t override_section_id = 0xFF; // FF = no override
|
||||
@@ -90,6 +98,9 @@ struct Client : public std::enable_shared_from_this<Client> {
|
||||
|
||||
Config() = default;
|
||||
|
||||
bool operator==(const Config& other) const = default;
|
||||
bool operator!=(const Config& other) const = default;
|
||||
|
||||
[[nodiscard]] static inline bool check_flag(uint64_t enabled_flags, Flag flag) {
|
||||
return !!(enabled_flags & static_cast<uint64_t>(flag));
|
||||
}
|
||||
@@ -147,7 +158,6 @@ struct Client : public std::enable_shared_from_this<Client> {
|
||||
};
|
||||
|
||||
std::weak_ptr<Server> server;
|
||||
std::weak_ptr<ServerState> server_state;
|
||||
uint64_t id;
|
||||
PrefixedLogger log;
|
||||
|
||||
@@ -172,6 +182,7 @@ struct Client : public std::enable_shared_from_this<Client> {
|
||||
|
||||
// Lobby/positioning
|
||||
Config config;
|
||||
Config synced_config;
|
||||
int32_t sub_version;
|
||||
float x;
|
||||
float z;
|
||||
@@ -180,7 +191,7 @@ struct Client : public std::enable_shared_from_this<Client> {
|
||||
uint8_t lobby_client_id;
|
||||
uint8_t lobby_arrow_color;
|
||||
int64_t preferred_lobby_id; // <0 = no preference
|
||||
ClientGameData game_data;
|
||||
|
||||
std::unique_ptr<struct event, void (*)(struct event*)> save_game_data_event;
|
||||
std::unique_ptr<struct event, void (*)(struct event*)> send_ping_event;
|
||||
std::unique_ptr<struct event, void (*)(struct event*)> idle_timeout_event;
|
||||
@@ -197,12 +208,38 @@ struct Client : public std::enable_shared_from_this<Client> {
|
||||
};
|
||||
std::unique_ptr<std::deque<JoinCommand>> game_join_command_queue;
|
||||
|
||||
// Character / game data
|
||||
struct PendingItemTrade {
|
||||
uint8_t other_client_id;
|
||||
bool confirmed; // true if client has sent a D2 command
|
||||
std::vector<ItemData> items;
|
||||
};
|
||||
struct PendingCardTrade {
|
||||
uint8_t other_client_id;
|
||||
bool confirmed; // true if client has sent an EE D2 command
|
||||
std::vector<std::pair<uint32_t, uint32_t>> card_to_count;
|
||||
};
|
||||
bool should_update_play_time;
|
||||
std::unordered_set<uint32_t> blocked_senders;
|
||||
std::unique_ptr<PlayerDispDataDCPCV3> v1_v2_last_reported_disp;
|
||||
// These are null unless the client is within the trade sequence (D0-D4 or EE commands)
|
||||
std::unique_ptr<PendingItemTrade> pending_item_trade;
|
||||
std::unique_ptr<PendingCardTrade> pending_card_trade;
|
||||
std::shared_ptr<Episode3::PlayerConfig> ep3_config; // Null for non-Ep3
|
||||
int8_t bb_character_index;
|
||||
ItemData bb_identify_result;
|
||||
std::array<std::vector<ItemData>, 3> bb_shop_contents;
|
||||
|
||||
// Miscellaneous (used by chat commands)
|
||||
uint32_t next_exp_value; // next EXP value to give
|
||||
G_SwitchStateChanged_6x05 last_switch_enabled_command;
|
||||
bool can_chat;
|
||||
std::string pending_bb_save_username;
|
||||
uint8_t pending_bb_save_character_index;
|
||||
struct PendingCharacterExport {
|
||||
std::shared_ptr<const License> license;
|
||||
ssize_t character_index = -1;
|
||||
bool is_bb_conversion = false;
|
||||
};
|
||||
std::unique_ptr<PendingCharacterExport> pending_character_export;
|
||||
std::deque<std::function<void(uint32_t, uint32_t)>> function_call_response_queue;
|
||||
|
||||
// File loading state
|
||||
@@ -229,10 +266,15 @@ struct Client : public std::enable_shared_from_this<Client> {
|
||||
|
||||
void set_license(std::shared_ptr<License> l);
|
||||
|
||||
void sync_config();
|
||||
|
||||
std::shared_ptr<ServerState> require_server_state() const;
|
||||
std::shared_ptr<Lobby> require_lobby() const;
|
||||
|
||||
std::shared_ptr<TeamIndex::Team> team();
|
||||
std::shared_ptr<const TeamIndex::Team> team() const;
|
||||
|
||||
bool can_see_quest(std::shared_ptr<const Quest> q, uint8_t difficulty, size_t num_players) const;
|
||||
bool can_play_quest(std::shared_ptr<const Quest> q, uint8_t difficulty, size_t num_players) const;
|
||||
|
||||
static void dispatch_save_game_data(evutil_socket_t, short, void* ctx);
|
||||
void save_game_data();
|
||||
@@ -242,4 +284,77 @@ struct Client : public std::enable_shared_from_this<Client> {
|
||||
void idle_timeout();
|
||||
|
||||
void suspend_timeouts();
|
||||
|
||||
const std::string& get_bb_username() const;
|
||||
void set_bb_username(const std::string& bb_username);
|
||||
|
||||
void create_battle_overlay(std::shared_ptr<const BattleRules> rules, std::shared_ptr<const LevelTable> level_table);
|
||||
void create_challenge_overlay(Version version, size_t template_index, std::shared_ptr<const LevelTable> level_table);
|
||||
inline void delete_overlay() {
|
||||
this->overlay_character_data.reset();
|
||||
}
|
||||
inline bool has_overlay() const {
|
||||
return this->overlay_character_data.get() != nullptr;
|
||||
}
|
||||
|
||||
void import_blocked_senders(const parray<le_uint32_t, 30>& blocked_senders);
|
||||
|
||||
std::shared_ptr<PSOBBBaseSystemFile> system_file(bool allow_load = true);
|
||||
std::shared_ptr<PSOBBCharacterFile> character(bool allow_load = true, bool allow_overlay = true);
|
||||
std::shared_ptr<PSOBBGuildCardFile> guild_card_file(bool allow_load = true);
|
||||
std::shared_ptr<const PSOBBBaseSystemFile> system_file(bool allow_load = true) const;
|
||||
std::shared_ptr<const PSOBBCharacterFile> character(bool allow_load = true, bool allow_overlay = true) const;
|
||||
std::shared_ptr<const PSOBBGuildCardFile> guild_card_file(bool allow_load = true) const;
|
||||
|
||||
void create_character_file(
|
||||
uint32_t guild_card_number,
|
||||
uint8_t language,
|
||||
const PlayerDispDataBBPreview& preview,
|
||||
std::shared_ptr<const LevelTable> level_table);
|
||||
|
||||
std::string system_filename() const;
|
||||
static std::string character_filename(const std::string& bb_username, int8_t index);
|
||||
static std::string backup_character_filename(uint32_t serial_number, size_t index);
|
||||
std::string character_filename(int8_t index = -1) const;
|
||||
std::string guild_card_filename() const;
|
||||
std::string shared_bank_filename() const;
|
||||
|
||||
std::string legacy_player_filename() const;
|
||||
std::string legacy_account_filename() const;
|
||||
|
||||
void save_all();
|
||||
void save_system_file() const;
|
||||
static void save_character_file(
|
||||
const std::string& filename,
|
||||
std::shared_ptr<const PSOBBBaseSystemFile> sys,
|
||||
std::shared_ptr<const PSOBBCharacterFile> character);
|
||||
// Note: This function is not const because it updates the player's play time.
|
||||
void save_character_file();
|
||||
void save_guild_card_file() const;
|
||||
|
||||
void load_backup_character(uint32_t serial_number, size_t index);
|
||||
void save_and_unload_character();
|
||||
|
||||
PlayerBank& current_bank();
|
||||
std::shared_ptr<PSOBBCharacterFile> current_bank_character();
|
||||
bool use_shared_bank(); // Returns true if the bank exists; false if it was created
|
||||
void use_character_bank(int8_t bb_character_index);
|
||||
void use_default_bank();
|
||||
|
||||
private:
|
||||
// The overlay character data is used in battle and challenge modes, when
|
||||
// character data is temporarily replaced in-game. In other play modes and in
|
||||
// lobbies, overlay_character_data is null.
|
||||
std::shared_ptr<PSOBBBaseSystemFile> system_data;
|
||||
std::shared_ptr<PSOBBCharacterFile> overlay_character_data;
|
||||
std::shared_ptr<PSOBBCharacterFile> character_data;
|
||||
std::shared_ptr<PSOBBGuildCardFile> guild_card_data;
|
||||
std::shared_ptr<PlayerBank> external_bank;
|
||||
std::shared_ptr<PSOBBCharacterFile> external_bank_character;
|
||||
int8_t external_bank_character_index;
|
||||
uint64_t last_play_time_update;
|
||||
|
||||
void save_and_clear_external_bank();
|
||||
|
||||
void load_all_files();
|
||||
};
|
||||
|
||||
+329
-169
@@ -10,7 +10,7 @@
|
||||
#include "Episode3/MapState.hh"
|
||||
#include "Episode3/PlayerStateSubordinates.hh"
|
||||
#include "PSOProtocol.hh"
|
||||
#include "Player.hh"
|
||||
#include "PlayerSubordinates.hh"
|
||||
#include "SaveFileFormats.hh"
|
||||
#include "Text.hh"
|
||||
|
||||
@@ -605,9 +605,10 @@ struct SC_MeetUserExtension {
|
||||
le_uint32_t menu_id = 0;
|
||||
le_uint32_t item_id = 0;
|
||||
} __packed__;
|
||||
parray<LobbyReference, 8> lobby_refs;
|
||||
le_uint32_t unknown_a2 = 0;
|
||||
pstring<Encoding, 0x20> player_name;
|
||||
/* 00 */ parray<LobbyReference, 8> lobby_refs;
|
||||
/* 40 */ le_uint32_t unknown_a2 = 0;
|
||||
/* 44 */ pstring<Encoding, 0x20> player_name;
|
||||
/* 64 (or 84 on UTF16 versions) */
|
||||
} __packed__;
|
||||
|
||||
struct S_LegacyJoinGame_PC_0E {
|
||||
@@ -1052,7 +1053,6 @@ struct C_OpenFileConfirmation_44_A6 {
|
||||
|
||||
// 61 (C->S): Player data
|
||||
// Internal name: SndCharaDataV2 (SndCharaData in DCv1)
|
||||
// See the PSOPlayerData structs in Player.hh for this command's format.
|
||||
// header.flag specifies the format version, which is related to (but not
|
||||
// identical to) the game's major version. For example, the format version is 01
|
||||
// on DC v1, 02 on PSO PC, 03 on PSO GC, XB, and BB, and 04 on Episode 3.
|
||||
@@ -1103,7 +1103,7 @@ struct C_CharacterData_DCv2_61_98 {
|
||||
/* 0000 */ PlayerInventory inventory;
|
||||
/* 034C */ PlayerDispDataDCPCV3 disp;
|
||||
/* 041C */ PlayerRecordsEntry_DC records;
|
||||
/* 04D8 */ ChoiceSearchConfig<le_uint16_t> choice_search_config;
|
||||
/* 04D8 */ ChoiceSearchConfig choice_search_config;
|
||||
/* 04F0 */
|
||||
} __attribute__((packed));
|
||||
|
||||
@@ -1111,7 +1111,7 @@ struct C_CharacterData_PC_61_98 {
|
||||
/* 0000 */ PlayerInventory inventory;
|
||||
/* 034C */ PlayerDispDataDCPCV3 disp;
|
||||
/* 041C */ PlayerRecordsEntry_PC records;
|
||||
/* 0510 */ ChoiceSearchConfig<le_uint16_t> choice_search_config;
|
||||
/* 0510 */ ChoiceSearchConfig choice_search_config;
|
||||
/* 0528 */ parray<le_uint32_t, 0x1E> blocked_senders;
|
||||
/* 05A0 */ le_uint32_t auto_reply_enabled = 0;
|
||||
// The auto-reply message can be up to 0x200 characters. If it's shorter than
|
||||
@@ -1120,11 +1120,24 @@ struct C_CharacterData_PC_61_98 {
|
||||
/* 05A4 */ // uint16_t auto_reply[...EOF];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct C_CharacterData_GCNTE_61_98 {
|
||||
/* 0000 */ PlayerInventory inventory;
|
||||
/* 034C */ PlayerDispDataDCPCV3 disp;
|
||||
/* 041C */ PlayerRecordsEntry_DC records;
|
||||
/* 04D8 */ ChoiceSearchConfig choice_search_config;
|
||||
/* 04F0 */ parray<le_uint32_t, 0x1E> blocked_senders;
|
||||
/* 0468 */ le_uint32_t auto_reply_enabled = 0;
|
||||
// The auto-reply message can be up to 0x200 bytes. If it's shorter than that,
|
||||
// the client truncates the command after the first zero byte (rounded up to
|
||||
// the next 4-byte boundary).
|
||||
/* 046C */ // char auto_reply[...EOF];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct C_CharacterData_V3_61_98 {
|
||||
/* 0000 */ PlayerInventory inventory;
|
||||
/* 034C */ PlayerDispDataDCPCV3 disp;
|
||||
/* 041C */ PlayerRecordsEntry_V3 records;
|
||||
/* 0538 */ ChoiceSearchConfig<le_uint16_t> choice_search_config;
|
||||
/* 0538 */ ChoiceSearchConfig choice_search_config;
|
||||
/* 0550 */ pstring<TextEncoding::MARKED, 0xAC> info_board;
|
||||
/* 05FC */ parray<le_uint32_t, 0x1E> blocked_senders;
|
||||
/* 0674 */ le_uint32_t auto_reply_enabled = 0;
|
||||
@@ -1138,7 +1151,7 @@ struct C_CharacterData_GC_Ep3_61_98 {
|
||||
/* 0000 */ PlayerInventory inventory;
|
||||
/* 034C */ PlayerDispDataDCPCV3 disp;
|
||||
/* 041C */ PlayerRecordsEntry_V3 records;
|
||||
/* 0538 */ ChoiceSearchConfig<le_uint16_t> choice_search_config;
|
||||
/* 0538 */ ChoiceSearchConfig choice_search_config;
|
||||
/* 0550 */ pstring<TextEncoding::MARKED, 0xAC> info_board;
|
||||
/* 05FC */ parray<le_uint32_t, 0x1E> blocked_senders;
|
||||
/* 0674 */ le_uint32_t auto_reply_enabled = 0;
|
||||
@@ -1151,7 +1164,7 @@ struct C_CharacterData_BB_61_98 {
|
||||
/* 0000 */ PlayerInventory inventory;
|
||||
/* 034C */ PlayerDispDataBB disp;
|
||||
/* 04DC */ PlayerRecordsEntry_BB records;
|
||||
/* 0638 */ ChoiceSearchConfig<le_uint16_t> choice_search_config;
|
||||
/* 0638 */ ChoiceSearchConfig choice_search_config;
|
||||
/* 0650 */ pstring<TextEncoding::UTF16, 0xAC> info_board;
|
||||
/* 07A8 */ parray<le_uint32_t, 0x1E> blocked_senders;
|
||||
/* 0820 */ le_uint32_t auto_reply_enabled = 0;
|
||||
@@ -1752,6 +1765,9 @@ struct C_CharSaveInfo_DCv2_PC_V3_BB_96 {
|
||||
// "character data was improperly saved", and will delete the character's items
|
||||
// and challenge mode records. newserv (and all other unofficial servers) always
|
||||
// send this command with flag == 1, which causes the client to save normally.
|
||||
// If a PSO PC client receives this command multiple times during a session, the
|
||||
// player will see the "character data may be damaged" message and be asked if
|
||||
// they want to restore the pre-session backup data.
|
||||
// Client will respond with a B1 command if header.flag is nonzero.
|
||||
|
||||
// 98 (C->S): Leave game
|
||||
@@ -1983,6 +1999,15 @@ struct C_ChangeShipOrBlock_A0_A1 {
|
||||
|
||||
template <TextEncoding Encoding, size_t ShortDescLength>
|
||||
struct S_QuestMenuEntry {
|
||||
// Note: The game treats menu_id as two 8-bit fields followed by a 16-bit
|
||||
// field. In most situations, this is opaque to the server, so we treat it as
|
||||
// a single 32-bit field, but in the case of the quest menu, the second byte
|
||||
// is used to determine the icon that appears to the left of the quest name.
|
||||
// Specifically:
|
||||
// 0 = online quest icon (green diamond)
|
||||
// 1 = download quest icon (green square with outlined diamond)
|
||||
// 2 = completed download quest icon (orange square with outlined diamond)
|
||||
// Anything else = same as 1
|
||||
le_uint32_t menu_id = 0;
|
||||
le_uint32_t item_id = 0;
|
||||
pstring<Encoding, 0x20> name;
|
||||
@@ -1994,7 +2019,17 @@ struct S_QuestMenuEntry_DC_GC_A2_A4 : S_QuestMenuEntry<TextEncoding::MARKED, 0x7
|
||||
} __packed__;
|
||||
struct S_QuestMenuEntry_XB_A2_A4 : S_QuestMenuEntry<TextEncoding::MARKED, 0x80> {
|
||||
} __packed__;
|
||||
struct S_QuestMenuEntry_BB_A2_A4 : S_QuestMenuEntry<TextEncoding::UTF16, 0x7A> {
|
||||
|
||||
struct S_QuestMenuEntry_BB_A2_A4 {
|
||||
le_uint32_t menu_id = 0;
|
||||
le_uint32_t item_id = 0;
|
||||
pstring<TextEncoding::UTF16, 0x20> name;
|
||||
pstring<TextEncoding::UTF16, 0x78> short_description;
|
||||
// If this field is set, a yellow hex icon is displayed instead of the green
|
||||
// or orange diamond icon, and the quest is grayed out and cannot be selected.
|
||||
// This field is ignored if the icon type (see S_QuestMenuEntry) isn't 1 or 2.
|
||||
uint8_t disabled = 0;
|
||||
parray<uint8_t, 3> unused;
|
||||
} __packed__;
|
||||
|
||||
// A3 (S->C): Quest information
|
||||
@@ -2359,19 +2394,17 @@ struct S_TournamentMatchInformation_GC_Ep3_BB {
|
||||
// Internal name: RcvChoiceList
|
||||
|
||||
// Command is a list of these; header.flag is the entry count (incl. top-level).
|
||||
template <typename ItemIDT, TextEncoding Encoding>
|
||||
template <TextEncoding Encoding>
|
||||
struct S_ChoiceSearchEntry {
|
||||
// Category IDs are nonzero; if the high byte of the ID is nonzero then the
|
||||
// category can be set by the user at any time; otherwise it can't.
|
||||
ItemIDT parent_category_id = 0; // 0 for top-level categories
|
||||
ItemIDT category_id = 0;
|
||||
le_uint16_t parent_choice_id = 0; // 0 for top-level categories
|
||||
le_uint16_t choice_id = 0;
|
||||
pstring<Encoding, 0x1C> text;
|
||||
} __packed__;
|
||||
struct S_ChoiceSearchEntry_DC_C0 : S_ChoiceSearchEntry<le_uint32_t, TextEncoding::MARKED> {
|
||||
struct S_ChoiceSearchEntry_DC_V3_C0 : S_ChoiceSearchEntry<TextEncoding::MARKED> {
|
||||
} __packed__;
|
||||
struct S_ChoiceSearchEntry_V3_C0 : S_ChoiceSearchEntry<le_uint16_t, TextEncoding::MARKED> {
|
||||
} __packed__;
|
||||
struct S_ChoiceSearchEntry_PC_BB_C0 : S_ChoiceSearchEntry<le_uint16_t, TextEncoding::UTF16> {
|
||||
struct S_ChoiceSearchEntry_PC_BB_C0 : S_ChoiceSearchEntry<TextEncoding::UTF16> {
|
||||
} __packed__;
|
||||
|
||||
// Top-level categories are things like "Level", "Class", etc.
|
||||
@@ -2425,12 +2458,7 @@ struct C_CreateGame_BB_C1 : C_CreateGame<TextEncoding::UTF16> {
|
||||
// C2 (C->S): Set choice search parameters (DCv2 and later versions)
|
||||
// Internal name: PutChoiceList
|
||||
// Server does not respond.
|
||||
// The ChoiceSearchConfig structure is defined in PlayerSubordinates.hh.
|
||||
|
||||
struct C_ChoiceSearchSelections_DC_C2_C3 : ChoiceSearchConfig<le_uint32_t> {
|
||||
} __packed__;
|
||||
struct C_ChoiceSearchSelections_PC_V3_BB_C2_C3 : ChoiceSearchConfig<le_uint16_t> {
|
||||
} __packed__;
|
||||
// Contents is a ChoiceSearchConfig, which is defined in PlayerSubordinates.hh.
|
||||
|
||||
// C3 (C->S): Execute choice search (DCv2 and later versions)
|
||||
// Internal name: SndChoiceSeq
|
||||
@@ -2441,22 +2469,25 @@ struct C_ChoiceSearchSelections_PC_V3_BB_C2_C3 : ChoiceSearchConfig<le_uint16_t>
|
||||
// Internal name: RcvChoiceAns
|
||||
|
||||
// Command is a list of these; header.flag is the entry count
|
||||
struct S_ChoiceSearchResultEntry_V3_C4 {
|
||||
template <typename HeaderT, TextEncoding NameEncoding, TextEncoding DescEncoding, TextEncoding LocatorEncoding>
|
||||
struct S_ChoiceSearchResultEntry_C4 {
|
||||
le_uint32_t guild_card_number = 0;
|
||||
pstring<TextEncoding::ASCII, 0x10> name; // No language marker, as usual on V3
|
||||
pstring<TextEncoding::MARKED, 0x20> info_string; // Usually something like "<class> Lvl <level>"
|
||||
pstring<NameEncoding, 0x10> name;
|
||||
pstring<DescEncoding, 0x20> info_string; // Usually something like "<class> Lvl <level>"
|
||||
// Format is stricter here; this is "LOBBYNAME,BLOCKNUM,SHIPNAME"
|
||||
// If target is in game, for example, "Game Name,BLOCK01,Alexandria"
|
||||
// If target is in lobby, for example, "BLOCK01-1,BLOCK01,Alexandria"
|
||||
pstring<TextEncoding::MARKED, 0x34> locator_string;
|
||||
// Server IP and port for "meet user" option
|
||||
le_uint32_t server_ip = 0;
|
||||
le_uint16_t server_port = 0;
|
||||
le_uint16_t unused1 = 0;
|
||||
le_uint32_t menu_id = 0;
|
||||
le_uint32_t lobby_id = 0; // These two are guesses
|
||||
le_uint32_t game_id = 0; // Zero if target is in a lobby rather than a game
|
||||
parray<uint8_t, 0x58> unused2;
|
||||
pstring<LocatorEncoding, 0x30> location_string;
|
||||
HeaderT reconnect_command_header; // Ignored by the client
|
||||
S_Reconnect_19 reconnect_command;
|
||||
SC_MeetUserExtension<NameEncoding> meet_user;
|
||||
} __packed__;
|
||||
|
||||
struct S_ChoiceSearchResultEntry_DC_V3_C4 : S_ChoiceSearchResultEntry_C4<PSOCommandHeaderDCV3, TextEncoding::ASCII, TextEncoding::MARKED, TextEncoding::ASCII> {
|
||||
} __packed__;
|
||||
struct S_ChoiceSearchResultEntry_PC_C4 : S_ChoiceSearchResultEntry_C4<PSOCommandHeaderPC, TextEncoding::UTF16, TextEncoding::UTF16, TextEncoding::UTF16> {
|
||||
} __packed__;
|
||||
struct S_ChoiceSearchResultEntry_BB_C4 : S_ChoiceSearchResultEntry_C4<PSOCommandHeaderBB, TextEncoding::UTF16, TextEncoding::UTF16, TextEncoding::UTF16> {
|
||||
} __packed__;
|
||||
|
||||
// C5 (S->C): Player records update (DCv2 and later versions)
|
||||
@@ -3257,9 +3288,8 @@ struct C_AddOrRemoveTeamMember_BB_03EA_05EA {
|
||||
|
||||
struct SC_TeamChat_BB_07EA {
|
||||
pstring<TextEncoding::UTF16, 0x10> sender_name;
|
||||
// It seems there are no real limits on the message length, other than the
|
||||
// overall command length limit of 0x7C00 bytes.
|
||||
// Text follows here
|
||||
// Text follows here. The message is truncated by the client if it is longer
|
||||
// than 0x8F wchar_ts.
|
||||
} __packed__;
|
||||
|
||||
// 08EA (C->S): Get team member list
|
||||
@@ -3270,8 +3300,8 @@ struct SC_TeamChat_BB_07EA {
|
||||
struct S_TeamMemberList_BB_09EA {
|
||||
le_uint32_t entry_count = 0;
|
||||
struct Entry {
|
||||
// This is displayed as "<%04d> %s" % (value, message)
|
||||
le_uint32_t index = 0;
|
||||
// This is displayed as "<%04d> %s" % (rank, name)
|
||||
le_uint32_t rank = 0;
|
||||
le_uint32_t privilege_level = 0; // 0x10 or 0x20 = green, 0x30 = blue, 0x40 = red, anything else = white
|
||||
le_uint32_t guild_card_number = 0;
|
||||
pstring<TextEncoding::UTF16, 0x10> name;
|
||||
@@ -3281,18 +3311,19 @@ struct S_TeamMemberList_BB_09EA {
|
||||
} __packed__;
|
||||
|
||||
// 0CEA (S->C): Unknown
|
||||
// The client appears to ignore this command.
|
||||
|
||||
struct S_Unknown_BB_0CEA {
|
||||
parray<uint8_t, 0x20> unknown_a1;
|
||||
// Text follows here
|
||||
} __packed__;
|
||||
|
||||
// 0DEA (C->S): Unknown
|
||||
// 0DEA (C->S): Get team name
|
||||
// No arguments
|
||||
|
||||
// 0EEA (S->C): Unknown
|
||||
// 0EEA (S->C): Team name
|
||||
|
||||
struct S_Unknown_BB_0EEA {
|
||||
struct S_TeamName_BB_0EEA {
|
||||
parray<uint8_t, 0x10> unused;
|
||||
pstring<TextEncoding::UTF16, 0x10> team_name;
|
||||
} __packed__;
|
||||
@@ -3309,8 +3340,10 @@ struct C_SetTeamFlag_BB_0FEA {
|
||||
|
||||
// 11EA: Change team member privilege level
|
||||
// The format below is used only when the client sends this command; when the
|
||||
// server sends it, only header.flag is used.
|
||||
// server sends it, only header.flag is used. As with various other team
|
||||
// commands, header.flag specifies the error code in this case.
|
||||
// header.flag specifies the new privilege level for the specified team member.
|
||||
// Known values: 0 = normal, 0x30 = leader, 0x40 = master
|
||||
|
||||
struct C_ChangeTeamMemberPrivilegeLevel_BB_11EA {
|
||||
le_uint32_t guild_card_number = 0;
|
||||
@@ -3336,6 +3369,8 @@ struct S_TeamMembershipInformation_BB_12EA {
|
||||
// header.flag specifies the number of entries.
|
||||
|
||||
struct S_TeamInfoForPlayer_BB_13EA_15EA_Entry {
|
||||
// The client uses the first four of these to determine if the player is in a
|
||||
// team or not - if they are all zero, the player is not in a team.
|
||||
le_uint32_t guild_card_number = 0;
|
||||
le_uint32_t team_id = 0;
|
||||
le_uint32_t unknown_a3 = 0;
|
||||
@@ -3348,20 +3383,21 @@ struct S_TeamInfoForPlayer_BB_13EA_15EA_Entry {
|
||||
parray<le_uint16_t, 0x20 * 0x20> flag_data;
|
||||
} __packed__;
|
||||
|
||||
// 14EA (C->S): Unknown
|
||||
// 14EA (C->S): Get team info for lobby players
|
||||
// No arguments. Client always sends 1 in the header.flag field.
|
||||
|
||||
// 15EA (S->C): Unknown
|
||||
// 15EA (S->C): Team info for lobby players
|
||||
// header.flag specifies the number of entries. The entry format appears to be
|
||||
// the same as for the 13EA command.
|
||||
|
||||
// 16EA (S->C): Unknown
|
||||
// No arguments except header.flag.
|
||||
// 16EA (S->C): Transfer item via Simple Mail result
|
||||
// No arguments except header.flag, which is 0 if the transfer failed and
|
||||
// nonzero if it succeeded.
|
||||
|
||||
// 18EA: Team ranking information
|
||||
// 18EA: Intra-team ranking information
|
||||
// No arguments (C->S)
|
||||
|
||||
struct S_TeamRankingInformation_BB_18EA {
|
||||
struct S_IntraTeamRanking_BB_18EA {
|
||||
/* 0000 */ le_uint32_t ranking_points = 0;
|
||||
/* 0004 */ le_uint32_t unknown_a2 = 0;
|
||||
/* 0008 */ le_uint32_t points_remaining = 0;
|
||||
@@ -3381,13 +3417,7 @@ struct S_TeamRankingInformation_BB_18EA {
|
||||
// 19EA: Team reward list
|
||||
// No arguments (C->S)
|
||||
|
||||
struct S_TeamRewardList_BB_19EA {
|
||||
le_uint32_t num_rewards_unlocked = 0;
|
||||
} __packed__;
|
||||
|
||||
// 1AEA: Team rewards available for purchase
|
||||
|
||||
struct S_TeamRewardsAvailableForPurchase_BB_1AEA {
|
||||
struct S_TeamRewardList_BB_19EA_1AEA {
|
||||
le_uint32_t num_entries;
|
||||
struct Entry {
|
||||
/* 0000 */ pstring<TextEncoding::UTF16, 0x40> name;
|
||||
@@ -3400,13 +3430,28 @@ struct S_TeamRewardsAvailableForPurchase_BB_1AEA {
|
||||
// Entry entries[num_entries];
|
||||
} __packed__;
|
||||
|
||||
// 1AEA: Team rewards available for purchase
|
||||
// Same format as 19EA.
|
||||
|
||||
// 1BEA (C->S): Buy team reward
|
||||
// No arguments except header.flag, which specifies a reward_id from a preceding
|
||||
// 1AEA command.
|
||||
|
||||
// 1CEA: Ranking information
|
||||
// 1CEA: Cross-team ranking information
|
||||
// No arguments when sent by the client.
|
||||
|
||||
struct S_CrossTeamRanking_BB_1CEA {
|
||||
le_uint32_t num_entries;
|
||||
struct Entry {
|
||||
/* 00 */ pstring<TextEncoding::UTF16, 0x10> team_name;
|
||||
/* 20 */ le_uint32_t team_points = 0;
|
||||
/* 24 */ le_uint32_t unknown_a1 = 0;
|
||||
/* 28 */
|
||||
} __packed__;
|
||||
// Variable length field:
|
||||
// Entry entries[num_entries];
|
||||
} __packed__;
|
||||
|
||||
// 1DEA (S->C): Update team rewards bitmask
|
||||
// header.flag specifies the new rewards bitmask.
|
||||
|
||||
@@ -3418,10 +3463,13 @@ struct C_Unknown_BB_1EEA {
|
||||
} __packed__;
|
||||
|
||||
// 1FEA (S->C): Action result
|
||||
// This command behaves exactly like 02EA.
|
||||
// This command behaves exactly like 02EA. This command is presumably the
|
||||
// response to whatever 1EEA does.
|
||||
|
||||
// 20EA: Unknown
|
||||
// header.flag is used, but no other arguments
|
||||
// header.flag is used, but no other arguments. When sent by the server,
|
||||
// header.flag is an error code, similar to various other result commands in
|
||||
// this section.
|
||||
|
||||
// EB (S->C): Add player to spectator team (Episode 3)
|
||||
// Same format and usage as 65 and 68 commands, but sent to spectators in a
|
||||
@@ -3866,7 +3914,7 @@ struct G_VolOptBossActions_6x16 {
|
||||
|
||||
// 6x17: Vol Opt phase 2 boss actions (not valid on Episode 3)
|
||||
|
||||
struct G_Unknown_6x17 {
|
||||
struct G_VolOpt2BossActions_6x17 {
|
||||
G_ClientIDHeader header;
|
||||
le_float unknown_a2 = 0.0f;
|
||||
le_float unknown_a3 = 0.0f;
|
||||
@@ -3876,7 +3924,7 @@ struct G_Unknown_6x17 {
|
||||
|
||||
// 6x18: Vol Opt phase 2 boss actions (not valid on Episode 3)
|
||||
|
||||
struct G_Unknown_6x18 {
|
||||
struct G_VolOpt2BossActions_6x18 {
|
||||
G_ClientIDHeader header;
|
||||
parray<le_uint16_t, 4> unknown_a2;
|
||||
} __packed__;
|
||||
@@ -3908,20 +3956,24 @@ struct G_DestroyNPC_6x1C {
|
||||
// 6x1D: Invalid subcommand
|
||||
// 6x1E: Invalid subcommand
|
||||
|
||||
// 6x1F: Set player floor
|
||||
// 6x1F: Set player floor and request positions
|
||||
|
||||
struct G_SetPlayerArea_6x1F {
|
||||
struct G_SetPlayerFloor_DCNTE_6x1F {
|
||||
G_ClientIDHeader header;
|
||||
le_uint32_t floor = 0;
|
||||
} __packed__;
|
||||
|
||||
struct G_SetPlayerFloor_6x1F {
|
||||
G_ClientIDHeader header;
|
||||
le_int32_t floor = 0;
|
||||
} __packed__;
|
||||
|
||||
// 6x20: Set position
|
||||
// Existing clients send this when a new client joins a lobby/game, so the new
|
||||
// client knows where to place them.
|
||||
// Existing clients send this in response to a 6x1F command when a new client
|
||||
// joins a lobby or game, so the new client knows where to place them.
|
||||
|
||||
struct G_SetPosition_6x20 {
|
||||
G_ClientIDHeader header;
|
||||
le_uint32_t floor = 0;
|
||||
le_int32_t floor = 0;
|
||||
le_float x = 0.0f;
|
||||
le_float y = 0.0f;
|
||||
le_float z = 0.0f;
|
||||
@@ -3932,7 +3984,7 @@ struct G_SetPosition_6x20 {
|
||||
|
||||
struct G_InterLevelWarp_6x21 {
|
||||
G_ClientIDHeader header;
|
||||
le_uint32_t floor = 0;
|
||||
le_int32_t floor = 0;
|
||||
} __packed__;
|
||||
|
||||
// 6x22: Set player invisible
|
||||
@@ -4017,7 +4069,7 @@ struct G_CreateInventoryItem_DC_6x2B {
|
||||
struct G_CreateInventoryItem_PC_V3_BB_6x2B : G_CreateInventoryItem_DC_6x2B {
|
||||
uint8_t unused1 = 0;
|
||||
uint8_t unknown_a2 = 0;
|
||||
le_uint16_t unused2 = 0;
|
||||
parray<uint8_t, 2> unused2 = 0;
|
||||
} __packed__;
|
||||
|
||||
// 6x2C: Talk to NPC
|
||||
@@ -4138,9 +4190,9 @@ struct G_Unknown_6x3B {
|
||||
struct G_StopAtPosition_6x3E {
|
||||
G_ClientIDHeader header;
|
||||
le_uint16_t unknown_a1 = 0;
|
||||
le_uint16_t unknown_a2 = 0;
|
||||
le_uint16_t floor = 0;
|
||||
le_uint16_t unknown_a3 = 0;
|
||||
le_uint16_t angle = 0;
|
||||
le_int16_t floor = 0;
|
||||
le_int16_t room = 0;
|
||||
le_float x = 0.0f;
|
||||
le_float y = 0.0f;
|
||||
le_float z = 0.0f;
|
||||
@@ -4152,8 +4204,8 @@ struct G_SetPosition_6x3F {
|
||||
G_ClientIDHeader header;
|
||||
le_uint16_t unknown_a1 = 0;
|
||||
le_uint16_t angle = 0;
|
||||
le_uint16_t floor = 0;
|
||||
le_uint16_t room = 0;
|
||||
le_int16_t floor = 0;
|
||||
le_int16_t room = 0;
|
||||
le_float x = 0.0f;
|
||||
le_float y = 0.0f;
|
||||
le_float z = 0.0f;
|
||||
@@ -4404,17 +4456,18 @@ struct G_BuyShopItem_6x5E {
|
||||
// 6x5F: Drop item from box/enemy
|
||||
|
||||
struct FloorItem {
|
||||
uint8_t floor = 0;
|
||||
uint8_t from_enemy = 0;
|
||||
le_uint16_t entity_id = 0; // < 0x0B50 if from_enemy != 0; otherwise < 0x0BA0
|
||||
le_float x = 0.0f;
|
||||
le_float z = 0.0f;
|
||||
le_uint16_t unknown_a2 = 0;
|
||||
/* 00 */ uint8_t floor = 0;
|
||||
/* 01 */ uint8_t from_enemy = 0;
|
||||
/* 02 */ le_uint16_t entity_id = 0; // < 0x0B50 if from_enemy != 0; otherwise < 0x0BA0
|
||||
/* 04 */ le_float x = 0.0f;
|
||||
/* 08 */ le_float z = 0.0f;
|
||||
/* 0C */ le_uint16_t unknown_a2 = 0;
|
||||
// The drop number is scoped to the floor and increments by 1 each time an
|
||||
// item is dropped. The last item dropped in each floor has drop_number equal
|
||||
// to total_items_dropped_per_floor[floor - 1] - 1.
|
||||
le_uint16_t drop_number = 0;
|
||||
ItemData item;
|
||||
/* 0E */ le_uint16_t drop_number = 0;
|
||||
/* 10 */ ItemData item;
|
||||
/* 24 */
|
||||
} __packed__;
|
||||
|
||||
struct G_DropItem_DC_6x5F {
|
||||
@@ -4455,9 +4508,9 @@ struct G_ActivateMagEffect_6x61 {
|
||||
// 6x62: Unknown
|
||||
// This subcommand is completely ignored (at least, by PSO GC).
|
||||
|
||||
// 6x63: Destroy ground item (used when too many items have been dropped)
|
||||
// 6x63: Destroy floor item (used when too many items have been dropped)
|
||||
|
||||
struct G_DestroyGroundItem_6x63 {
|
||||
struct G_DestroyFloorItem_6x63 {
|
||||
G_UnusedHeader header;
|
||||
le_uint32_t item_id = 0;
|
||||
le_uint32_t floor = 0;
|
||||
@@ -4505,10 +4558,10 @@ struct G_CreateTelepipe_6x68 {
|
||||
|
||||
struct G_NPCControl_6x69 {
|
||||
G_UnusedHeader header;
|
||||
le_uint16_t npc_client_id = 0;
|
||||
le_uint16_t unknown_a1 = 0; // 1 if command == 0 or 3, unused otherwise
|
||||
le_uint16_t state = 0;
|
||||
le_uint16_t npc_entity_id = 0;
|
||||
le_uint16_t command = 0; // 0 = create follower NPC, 1 = stop acting, 2 = start acting, 3 = create attacker NPC
|
||||
le_uint16_t unknown_a2 = 0; // Specifies which NPC to create if command == 0 or 3, unused otherwise
|
||||
le_uint16_t npc_template_index = 0; // Specifies which NPC to create if command == 0 or 3; unused otherwise
|
||||
} __packed__;
|
||||
|
||||
// 6x6A: Use boss warp (not valid on Episode 3)
|
||||
@@ -4519,7 +4572,13 @@ struct G_UseBossWarp_6x6A {
|
||||
le_uint16_t unused = 0;
|
||||
} __packed__;
|
||||
|
||||
// 6x6B: Sync enemy state (used while loading into game; same header format as 6E)
|
||||
// 6x6B: Sync enemy state (used while loading into game)
|
||||
|
||||
struct G_SyncGameStateHeader_DCNTE_6x6B_6x6C_6x6D_6x6E {
|
||||
G_ExtendedHeader<G_UnusedHeader> header;
|
||||
le_uint32_t decompressed_size = 0;
|
||||
// BC0-compressed data follows here (see bc0_decompress)
|
||||
} __packed__;
|
||||
|
||||
struct G_SyncGameStateHeader_6x6B_6x6C_6x6D_6x6E {
|
||||
G_ExtendedHeader<G_UnusedHeader> header;
|
||||
@@ -4530,7 +4589,6 @@ struct G_SyncGameStateHeader_6x6B_6x6C_6x6D_6x6E {
|
||||
|
||||
// Decompressed format is a list of these
|
||||
struct G_SyncEnemyState_6x6B_Entry_Decompressed {
|
||||
// TODO: Verify this format on DC and PC. It appears correct for GC and BB.
|
||||
le_uint32_t flags = 0;
|
||||
le_uint16_t last_attacker = 0;
|
||||
le_uint16_t remaining_hp = 0;
|
||||
@@ -4545,7 +4603,6 @@ struct G_SyncEnemyState_6x6B_Entry_Decompressed {
|
||||
|
||||
// Decompressed format is a list of these
|
||||
struct G_SyncObjectState_6x6C_Entry_Decompressed {
|
||||
// TODO: Verify this format on DC and PC. It appears correct for GC and BB.
|
||||
le_uint16_t flags = 0;
|
||||
le_uint16_t object_index = 0;
|
||||
} __packed__;
|
||||
@@ -4577,13 +4634,12 @@ struct G_SyncObjectState_6x6C_Entry_Decompressed {
|
||||
// commands cannot be processed on the same frame.
|
||||
|
||||
struct G_SyncItemState_6x6D_Decompressed {
|
||||
// TODO: Verify this format on DC and PC. It appears correct for GC and BB.
|
||||
// Note: 16 vs. 15 is not a bug here - there really is an extra field in the
|
||||
// total drop count vs. the floor item count. Despite this, Pioneer 2 or Lab
|
||||
// (floor 0) isn't included in total_items_dropped_per_floor (so Forest 1 is
|
||||
// [0] in that array) but it is included in floor_item_count_per_floor (so
|
||||
// Forest 1 is [1] there).
|
||||
parray<le_uint16_t, 16> total_items_dropped_per_floor;
|
||||
// (floor 0) isn't included in next_drop_number_per_floor (so Forest 1 is [0]
|
||||
// in that array) but it is included in floor_item_count_per_floor (so Forest
|
||||
// 1 is [1] there).
|
||||
parray<le_uint16_t, 16> next_drop_number_per_floor;
|
||||
// Only [0]-[3] in this array are ever actually used in normal gameplay, but
|
||||
// the client fills in all 12 of these with reasonable values.
|
||||
parray<le_uint32_t, 12> next_item_id_per_player;
|
||||
@@ -4596,7 +4652,6 @@ struct G_SyncItemState_6x6D_Decompressed {
|
||||
// Compressed format is the same as 6x6B.
|
||||
|
||||
struct G_SyncFlagState_6x6E_Decompressed {
|
||||
// TODO: Verify this format on DC and PC. It appears correct for GC and BB.
|
||||
// The three unknowns here are the sizes (in bytes) of three fields
|
||||
// immediately following this structure. It is currently unknown what these
|
||||
// fields represent. The three unknown fields always sum to the size field.
|
||||
@@ -4612,23 +4667,41 @@ struct G_SyncFlagState_6x6E_Decompressed {
|
||||
|
||||
struct G_SetQuestFlags_6x6F {
|
||||
G_UnusedHeader header;
|
||||
parray<parray<uint8_t, 0x80>, 4> quest_flags_by_difficulty;
|
||||
QuestFlags quest_flags;
|
||||
} __packed__;
|
||||
|
||||
// 6x70: Sync player disp data and inventory (used while loading into game)
|
||||
// Annoyingly, they didn't use the same format as the 65/67/68 commands here,
|
||||
// and instead rearranged a bunch of things.
|
||||
// The format appears to be the same for all pre-BB PSO versions, although
|
||||
// Episode 3 does not send this command at all since the relevant data is sent
|
||||
// to the joining player in the 64 command instead.
|
||||
|
||||
struct G_SyncPlayerDispAndInventory_DC_PC_GC_6x70 {
|
||||
struct Telepipe {
|
||||
/* 00 */ le_uint16_t client_id;
|
||||
/* 02 */ le_uint16_t unknown_a1;
|
||||
/* 04 */ le_uint32_t unknown_a2;
|
||||
/* 08 */ le_float x;
|
||||
/* 0C */ le_float y;
|
||||
/* 10 */ le_float z;
|
||||
/* 14 */ le_uint32_t unknown_a3;
|
||||
/* 18 */ parray<uint8_t, 4> unknown_a4;
|
||||
/* 1C */
|
||||
} __packed__;
|
||||
|
||||
struct G_Unknown_6x70_Sub {
|
||||
// This is used in all versions of this command except DCNTE and 11/2000.
|
||||
/* 00 */ le_uint16_t unknown_a1;
|
||||
/* 02 */ le_uint16_t unknown_a2;
|
||||
/* 04 */ le_uint32_t unknown_a3;
|
||||
/* 08 */ le_uint32_t unknown_a4;
|
||||
/* 0C */ le_uint32_t unknown_a5;
|
||||
/* 10 */ le_uint32_t unknown_a6;
|
||||
/* 14 */
|
||||
} __packed__;
|
||||
|
||||
struct G_SyncPlayerDispAndInventory_DCNTE_6x70 {
|
||||
// Offsets in this struct are relative to the overall command header
|
||||
/* 0004 */ G_ExtendedHeader<G_UnusedHeader> header;
|
||||
/* 0004 */ G_ExtendedHeader<G_UnusedHeader> header = {{0x70, 0x00, 0x0000}, sizeof(G_SyncPlayerDispAndInventory_DCNTE_6x70)};
|
||||
/* 000C */ le_uint16_t client_id = 0;
|
||||
/* 000E */ le_uint16_t unknown_a1 = 0;
|
||||
// [1] and [3] in this array (and maybe [2] also) appear to be le_floats;
|
||||
// they could be the player's current (x, y, z) coords
|
||||
/* 0010 */ le_uint32_t flags1;
|
||||
/* 0014 */ le_float x;
|
||||
/* 0018 */ le_float y;
|
||||
@@ -4637,57 +4710,127 @@ struct G_SyncPlayerDispAndInventory_DC_PC_GC_6x70 {
|
||||
/* 0024 */ le_uint32_t angle_y;
|
||||
/* 0028 */ le_uint32_t angle_z;
|
||||
/* 002C */ le_uint16_t unknown_a3a;
|
||||
/* 002C */ le_uint16_t current_hp;
|
||||
/* 002C */ le_uint16_t bonus_hp_from_materials;
|
||||
/* 002C */ le_uint16_t bonus_tp_from_materials;
|
||||
/* 0034 */ parray<parray<le_uint32_t, 3>, 5> unknown_a4;
|
||||
/* 0070 */ le_uint32_t language = 0;
|
||||
/* 0074 */ le_uint32_t player_tag = 0;
|
||||
/* 0078 */ le_uint32_t guild_card_number = 0;
|
||||
/* 007C */ le_uint32_t unknown_a6;
|
||||
/* 0080 */ le_uint32_t battle_team_number;
|
||||
/* 0084 */ struct {
|
||||
/* 0084 */ le_uint16_t client_id;
|
||||
/* 0086 */ le_uint16_t unknown_a1;
|
||||
/* 0088 */ le_uint32_t unknown_a2;
|
||||
/* 008C */ le_float x;
|
||||
/* 0090 */ le_float y;
|
||||
/* 0094 */ le_float z;
|
||||
/* 0098 */ le_uint32_t unknown_a3;
|
||||
/* 009C */ parray<uint8_t, 4> unknown_a4;
|
||||
} __packed__ telepipe;
|
||||
/* 00A0 */ le_uint32_t unknown_a8 = 0;
|
||||
/* 00A4 */ struct {
|
||||
/* 00A4 */ le_uint16_t unknown_a1;
|
||||
/* 00A6 */ le_uint16_t unknown_a2;
|
||||
/* 00A8 */ le_uint32_t unknown_a3;
|
||||
/* 00AC */ le_uint32_t unknown_a4;
|
||||
/* 00B0 */ le_uint32_t unknown_a5;
|
||||
/* 00B4 */ le_uint32_t unknown_a6;
|
||||
} __packed__ unknown_a9;
|
||||
/* 00B8 */ le_uint32_t area = 0;
|
||||
/* 00BC */ le_uint32_t flags2 = 0;
|
||||
/* 00C0 */ parray<uint8_t, 0x14> technique_levels_v1; // Last byte is uninitialized
|
||||
/* 00D4 */ PlayerVisualConfig visual;
|
||||
/* 002E */ le_uint16_t current_hp;
|
||||
/* 0030 */ le_uint32_t unknown_a5;
|
||||
/* 0034 */ le_uint32_t unknown_a6;
|
||||
/* 0038 */ Telepipe telepipe;
|
||||
/* 0054 */ parray<uint8_t, 0x18> unknown_a7;
|
||||
/* 006C */ le_uint32_t flags2 = 0;
|
||||
/* 0070 */ PlayerVisualConfig visual;
|
||||
/* 00C0 */ PlayerStats stats;
|
||||
/* 00E4 */ le_uint32_t num_items = 0;
|
||||
/* 00E8 */ parray<PlayerInventoryItem, 0x1E> items;
|
||||
/* 0430 */
|
||||
} __packed__;
|
||||
|
||||
struct G_SyncPlayerDispAndInventory_DC112000_6x70 {
|
||||
// Offsets in this struct are relative to the overall command header
|
||||
/* 0004 */ G_ExtendedHeader<G_UnusedHeader> header = {{0x70, 0x00, 0x0000}, sizeof(G_SyncPlayerDispAndInventory_DC112000_6x70)};
|
||||
/* 000C */ le_uint16_t client_id = 0;
|
||||
/* 000E */ le_uint16_t unknown_a1 = 0;
|
||||
/* 0010 */ le_uint32_t flags1;
|
||||
/* 0014 */ le_float x;
|
||||
/* 0018 */ le_float y;
|
||||
/* 001C */ le_float z;
|
||||
/* 0020 */ le_uint32_t angle_x;
|
||||
/* 0024 */ le_uint32_t angle_y;
|
||||
/* 0028 */ le_uint32_t angle_z;
|
||||
/* 002C */ le_uint16_t unknown_a3a;
|
||||
/* 002E */ le_uint16_t current_hp;
|
||||
/* 0030 */ le_uint16_t bonus_hp_from_materials;
|
||||
/* 0032 */ le_uint16_t bonus_tp_from_materials;
|
||||
/* 0034 */ parray<uint8_t, 0x10> unknown_a5;
|
||||
/* 0044 */ Telepipe telepipe;
|
||||
/* 0060 */ parray<uint8_t, 0x18> unknown_a6;
|
||||
/* 0078 */ le_uint32_t flags2 = 0;
|
||||
/* 007C */ PlayerVisualConfig visual;
|
||||
/* 00CC */ PlayerStats stats;
|
||||
/* 00F0 */ le_uint32_t num_items = 0;
|
||||
/* 00F4 */ parray<PlayerInventoryItem, 0x1E> items;
|
||||
/* 043C */
|
||||
} __packed__;
|
||||
|
||||
struct G_SyncPlayerDispAndInventory_Base {
|
||||
/* 0000 */ le_uint16_t client_id = 0;
|
||||
/* 0002 */ le_uint16_t unknown_a1 = 0;
|
||||
/* 0004 */ le_uint32_t flags1;
|
||||
/* 0008 */ le_float x;
|
||||
/* 000C */ le_float y;
|
||||
/* 0010 */ le_float z;
|
||||
/* 0014 */ le_uint32_t angle_x;
|
||||
/* 0018 */ le_uint32_t angle_y;
|
||||
/* 001C */ le_uint32_t angle_z;
|
||||
/* 0020 */ le_uint16_t unknown_a3a;
|
||||
/* 0022 */ le_uint16_t current_hp;
|
||||
/* 0024 */ le_uint16_t bonus_hp_from_materials;
|
||||
/* 0026 */ le_uint16_t bonus_tp_from_materials;
|
||||
/* 0028 */ parray<parray<le_uint32_t, 3>, 5> unknown_a4;
|
||||
/* 0064 */ le_uint32_t language = 0;
|
||||
/* 0068 */ le_uint32_t player_tag = 0;
|
||||
/* 006C */ le_uint32_t guild_card_number = 0;
|
||||
/* 0070 */ le_uint32_t unknown_a6;
|
||||
/* 0074 */ le_uint32_t battle_team_number;
|
||||
/* 0078 */ Telepipe telepipe;
|
||||
/* 0094 */ le_uint32_t unknown_a8 = 0;
|
||||
/* 0098 */ G_Unknown_6x70_Sub unknown_a9;
|
||||
/* 00AC */ le_uint32_t area = 0;
|
||||
/* 00B0 */ le_uint32_t flags2 = 0;
|
||||
/* 00B4 */ parray<uint8_t, 0x14> technique_levels_v1; // Last byte is uninitialized
|
||||
/* 00C8 */ PlayerVisualConfig visual;
|
||||
/* 0118 */
|
||||
} __packed__;
|
||||
|
||||
struct G_SyncPlayerDispAndInventory_DC_PC_6x70 {
|
||||
// Offsets in this struct are relative to the overall command header
|
||||
/* 0004 */ G_ExtendedHeader<G_UnusedHeader> header = {{0x70, 0x00, 0x0000}, sizeof(G_SyncPlayerDispAndInventory_DC_PC_6x70)};
|
||||
/* 000C */ G_SyncPlayerDispAndInventory_Base base;
|
||||
/* 0124 */ PlayerStats stats;
|
||||
/* 0148 */ struct {
|
||||
le_uint32_t num_items = 0;
|
||||
// Entries >= num_items in this array contain uninitialized data (usually
|
||||
// the contents of a previous sync command)
|
||||
parray<PlayerInventoryItem, 0x1E> items;
|
||||
} __packed__ inventory;
|
||||
/* 0148 */ le_uint32_t num_items = 0;
|
||||
/* 014C */ parray<PlayerInventoryItem, 0x1E> items;
|
||||
/* 0494 */
|
||||
} __packed__;
|
||||
|
||||
// GC NTE also uses this format.
|
||||
struct G_SyncPlayerDispAndInventory_GC_6x70 {
|
||||
// Offsets in this struct are relative to the overall command header
|
||||
/* 0004 */ G_ExtendedHeader<G_UnusedHeader> header = {{0x70, 0x00, 0x0000}, sizeof(G_SyncPlayerDispAndInventory_GC_6x70)};
|
||||
/* 000C */ G_SyncPlayerDispAndInventory_Base base;
|
||||
/* 0124 */ PlayerStats stats;
|
||||
/* 0148 */ le_uint32_t num_items = 0;
|
||||
/* 014C */ parray<PlayerInventoryItem, 0x1E> items;
|
||||
/* 0494 */ le_uint32_t floor = 0;
|
||||
/* 0498 */
|
||||
} __packed__;
|
||||
|
||||
struct G_SyncPlayerDispAndInventory_XB_6x70 : G_SyncPlayerDispAndInventory_DC_PC_GC_6x70 {
|
||||
struct G_SyncPlayerDispAndInventory_XB_6x70 {
|
||||
// Offsets in this struct are relative to the overall command header
|
||||
/* 0004 */ G_ExtendedHeader<G_UnusedHeader> header = {{0x70, 0x00, 0x0000}, sizeof(G_SyncPlayerDispAndInventory_XB_6x70)};
|
||||
/* 000C */ G_SyncPlayerDispAndInventory_Base base;
|
||||
/* 0124 */ PlayerStats stats;
|
||||
/* 0148 */ le_uint32_t num_items = 0;
|
||||
/* 014C */ parray<PlayerInventoryItem, 0x1E> items;
|
||||
/* 0494 */ le_uint32_t floor = 0;
|
||||
/* 0498 */ le_uint32_t xb_user_id_high = 0;
|
||||
/* 049C */ le_uint32_t xb_user_id_low = 0;
|
||||
/* 04A0 */ le_uint32_t unknown_a16 = 0;
|
||||
/* 04A4 */
|
||||
} __packed__;
|
||||
|
||||
struct G_SyncPlayerDispAndInventory_BB_6x70 {
|
||||
// Offsets in this struct are relative to the overall command header
|
||||
/* 0008 */ G_ExtendedHeader<G_UnusedHeader> header = {{0x70, 0x00, 0x0000}, sizeof(G_SyncPlayerDispAndInventory_BB_6x70)};
|
||||
/* 0010 */ G_SyncPlayerDispAndInventory_Base base;
|
||||
/* 0128 */ pstring<TextEncoding::UTF16, 0x10> name;
|
||||
/* 0148 */ PlayerStats stats;
|
||||
/* 016C */ le_uint32_t num_items = 0;
|
||||
/* 0170 */ parray<PlayerInventoryItem, 0x1E> items;
|
||||
/* 04B8 */ le_uint32_t floor = 0;
|
||||
/* 04BC */ le_uint32_t xb_user_id_high = 0;
|
||||
/* 04C0 */ le_uint32_t xb_user_id_low = 0;
|
||||
/* 04C4 */ le_uint32_t unknown_a16 = 0;
|
||||
/* 04C8 */
|
||||
} __packed__;
|
||||
|
||||
// 6x71: Unknown (used while loading into game)
|
||||
|
||||
struct G_Unknown_6x71 {
|
||||
@@ -4727,16 +4870,15 @@ struct G_WordSelect_6x74 {
|
||||
WordSelectMessage message;
|
||||
} __packed__;
|
||||
|
||||
// 6x75: Set quest flag
|
||||
// 6x75: Update quest flag
|
||||
|
||||
struct G_SetQuestFlag_DC_PC_6x75 {
|
||||
struct G_UpdateQuestFlag_DC_PC_6x75 {
|
||||
G_UnusedHeader header;
|
||||
le_uint16_t flag = 0; // Must be < 0x400
|
||||
le_uint16_t action = 0; // 0 = set flag, 1 = clear flag
|
||||
} __packed__;
|
||||
|
||||
struct G_SetQuestFlag_V3_BB_6x75 {
|
||||
G_SetQuestFlag_DC_PC_6x75 basic_cmd;
|
||||
struct G_UpdateQuestFlag_V3_BB_6x75 : G_UpdateQuestFlag_DC_PC_6x75 {
|
||||
le_uint16_t difficulty = 0;
|
||||
le_uint16_t unused = 0;
|
||||
} __packed__;
|
||||
@@ -5257,6 +5399,12 @@ struct G_Unknown_6xB2 {
|
||||
|
||||
// 6xB3: Unknown (Xbox; voice chat)
|
||||
|
||||
struct G_Unknown_XB_6xB3 {
|
||||
G_ClientIDHeader header;
|
||||
le_uint32_t num_frames;
|
||||
// (0x0A * num_frames) bytes of data follows here.
|
||||
} __packed__;
|
||||
|
||||
// 6xB3: CARD battle server data request (Episode 3)
|
||||
|
||||
// CARD battle subcommands have multiple subsubcommands, which we name 6xBYxZZ,
|
||||
@@ -5303,6 +5451,11 @@ struct G_CardServerDataCommandHeader {
|
||||
|
||||
// 6xB4: Unknown (Xbox; voice chat)
|
||||
|
||||
struct G_Unknown_XB_6xB4 {
|
||||
G_ClientIDHeader header;
|
||||
le_uint32_t unknown_a1;
|
||||
} __packed__;
|
||||
|
||||
// 6xB4: CARD battle server response (Episode 3) - see 6xB3 above
|
||||
// 6xB5: CARD battle client command (Episode 3) - see 6xB3 above
|
||||
|
||||
@@ -5473,11 +5626,11 @@ struct G_WordSelectDuringBattle_GC_Ep3_6xBD {
|
||||
|
||||
struct G_BankAction_BB_6xBD {
|
||||
G_UnusedHeader header;
|
||||
le_uint32_t item_id = 0; // 0xFFFFFFFF = meseta; anything else = item
|
||||
le_uint32_t item_id = 0;
|
||||
le_uint32_t meseta_amount = 0;
|
||||
uint8_t action = 0; // 0 = deposit, 1 = take
|
||||
uint8_t action = 0; // 0 = deposit, 1 = take, 3 = done (close bank window)
|
||||
uint8_t item_amount = 0;
|
||||
le_uint16_t unused2 = 0;
|
||||
le_uint16_t item_index = 0; // 0xFFFF = meseta
|
||||
} __packed__;
|
||||
|
||||
// 6xBE: Sound chat (Episode 3; not Trial Edition)
|
||||
@@ -5583,9 +5736,9 @@ struct G_EnemyEXPRequest_BB_6xC8 {
|
||||
parray<uint8_t, 3> unused;
|
||||
} __packed__;
|
||||
|
||||
// 6xC9: Request meseta reward from quest (BB; handled by server)
|
||||
// 6xC9: Adjust player Meseta (BB; handled by server)
|
||||
|
||||
struct G_MesetaRewardRequest_BB_6xC9 {
|
||||
struct G_AdjustPlayerMeseta_BB_6xC9 {
|
||||
G_UnusedHeader header;
|
||||
le_int32_t amount = 0;
|
||||
} __packed__;
|
||||
@@ -5597,13 +5750,13 @@ struct G_ItemRewardRequest_BB_6xCA {
|
||||
ItemData item_data;
|
||||
} __packed__;
|
||||
|
||||
// 6xCB: Request to transfer item (BB)
|
||||
// 6xCB: Transfer item via mail message (BB)
|
||||
|
||||
struct G_ItemTransferRequest_BB_6xCB {
|
||||
struct G_TransferItemViaMailMessage_BB_6xCB {
|
||||
G_ClientIDHeader header;
|
||||
le_uint32_t unknown_a1 = 0;
|
||||
le_uint32_t unknown_a2 = 0;
|
||||
le_uint32_t unknown_a3 = 0;
|
||||
le_uint32_t item_id = 0;
|
||||
le_uint32_t amount = 0;
|
||||
le_uint32_t target_guild_card_number = 0;
|
||||
} __packed__;
|
||||
|
||||
// 6xCC: Exchange item for team points (BB)
|
||||
@@ -5701,10 +5854,10 @@ struct G_PaganiniPhotonDropExchange_BB_6xD7 {
|
||||
struct G_AddSRankWeaponSpecial_BB_6xD8 {
|
||||
G_ClientIDHeader header;
|
||||
ItemData unknown_a1; // Only data1[0]-[2] are used
|
||||
le_uint32_t unknown_a2 = 0;
|
||||
le_uint32_t unknown_a3 = 0;
|
||||
le_uint16_t unknown_a4 = 0;
|
||||
le_uint16_t unknown_a5 = 0;
|
||||
le_uint32_t item_id = 0;
|
||||
le_uint32_t special_type = 0;
|
||||
le_uint16_t success_function_id = 0;
|
||||
le_uint16_t failure_function_id = 0;
|
||||
} __packed__;
|
||||
|
||||
// 6xD9: Momoka item exchange (BB; handled by server)
|
||||
@@ -5802,19 +5955,26 @@ struct G_ExchangePhotonTickets_BB_6xE1 {
|
||||
le_uint16_t unknown_a5 = 0; // argsA[4]
|
||||
} __packed__;
|
||||
|
||||
// 6xE2: Coren actions (BB)
|
||||
// 6xE2: Get Meseta slot prize (BB)
|
||||
// The client sends this when it executes an F960 quest opcode.
|
||||
|
||||
struct G_CorenActions_BB_6xE2 {
|
||||
struct G_GetMesetaSlotPrize_BB_6xE2 {
|
||||
G_ClientIDHeader header;
|
||||
parray<uint8_t, 12> unknown_a1; // TODO: There might be uint16_ts and uint32_ts in here.
|
||||
uint8_t result_tier; // This contains the argument value from the F960 opcode
|
||||
uint8_t floor;
|
||||
uint8_t unknown_a2;
|
||||
uint8_t unused;
|
||||
le_float x; // TODO: Verify this guess
|
||||
le_float z; // TODO: Verify this guess
|
||||
} __packed__;
|
||||
|
||||
// 6xE3: Coren actions result (BB)
|
||||
// 6xE3: Set Meseta slot prize result (BB)
|
||||
// The client only uses this to populate the <meseta_slot_prize> quest text
|
||||
// replacement token.
|
||||
|
||||
struct G_CorenActionsResult_BB_6xE3 {
|
||||
struct G_SetMesetaSlotPrizeResult_BB_6xE3 {
|
||||
G_ClientIDHeader header;
|
||||
ItemData item_data;
|
||||
ItemData item;
|
||||
} __packed__;
|
||||
|
||||
// 6xE4: Invalid subcommand
|
||||
|
||||
+136
-181
@@ -6,176 +6,107 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
CommonItemSet::Table::Table(
|
||||
shared_ptr<const string> owned_data, const StringReader& r, bool is_big_endian, bool is_v3)
|
||||
: owned_data(owned_data),
|
||||
r(r),
|
||||
is_big_endian(is_big_endian),
|
||||
is_v3(is_v3) {
|
||||
CommonItemSet::Table::Table(const StringReader& r, bool is_big_endian, bool is_v3) {
|
||||
if (is_big_endian) {
|
||||
const auto& be_offsets = r.pget<Offsets<true>>(r.pget_u32b(this->r.size() - 0x10));
|
||||
this->offsets.base_weapon_type_prob_table_offset = be_offsets.base_weapon_type_prob_table_offset.load();
|
||||
this->offsets.subtype_base_table_offset = be_offsets.subtype_base_table_offset.load();
|
||||
this->offsets.subtype_area_length_table_offset = be_offsets.subtype_area_length_table_offset.load();
|
||||
this->offsets.grind_prob_table_offset = be_offsets.grind_prob_table_offset.load();
|
||||
this->offsets.armor_shield_type_index_prob_table_offset = be_offsets.armor_shield_type_index_prob_table_offset.load();
|
||||
this->offsets.armor_slot_count_prob_table_offset = be_offsets.armor_slot_count_prob_table_offset.load();
|
||||
this->offsets.enemy_meseta_ranges_offset = be_offsets.enemy_meseta_ranges_offset.load();
|
||||
this->offsets.enemy_type_drop_probs_offset = be_offsets.enemy_type_drop_probs_offset.load();
|
||||
this->offsets.enemy_item_classes_offset = be_offsets.enemy_item_classes_offset.load();
|
||||
this->offsets.box_meseta_ranges_offset = be_offsets.box_meseta_ranges_offset.load();
|
||||
this->offsets.bonus_value_prob_table_offset = be_offsets.bonus_value_prob_table_offset.load();
|
||||
this->offsets.nonrare_bonus_prob_spec_offset = be_offsets.nonrare_bonus_prob_spec_offset.load();
|
||||
this->offsets.bonus_type_prob_table_offset = be_offsets.bonus_type_prob_table_offset.load();
|
||||
this->offsets.special_mult_offset = be_offsets.special_mult_offset.load();
|
||||
this->offsets.special_percent_offset = be_offsets.special_percent_offset.load();
|
||||
this->offsets.tool_class_prob_table_offset = be_offsets.tool_class_prob_table_offset.load();
|
||||
this->offsets.technique_index_prob_table_offset = be_offsets.technique_index_prob_table_offset.load();
|
||||
this->offsets.technique_level_ranges_offset = be_offsets.technique_level_ranges_offset.load();
|
||||
this->offsets.armor_or_shield_type_bias = be_offsets.armor_or_shield_type_bias;
|
||||
this->offsets.unit_max_stars_offset = be_offsets.unit_max_stars_offset.load();
|
||||
this->offsets.box_item_class_prob_table_offset = be_offsets.box_item_class_prob_table_offset.load();
|
||||
this->parse_itempt_t<true>(r, is_v3);
|
||||
} else {
|
||||
this->offsets = r.pget<Offsets<false>>(r.pget_u32l(this->r.size() - 0x10));
|
||||
this->parse_itempt_t<false>(r, is_v3);
|
||||
}
|
||||
}
|
||||
|
||||
const parray<uint8_t, 0x0C>& CommonItemSet::Table::base_weapon_type_prob_table() const {
|
||||
return this->r.pget<parray<uint8_t, 0x0C>>(this->offsets.base_weapon_type_prob_table_offset);
|
||||
}
|
||||
const parray<int8_t, 0x0C>& CommonItemSet::Table::subtype_base_table() const {
|
||||
return this->r.pget<parray<int8_t, 0x0C>>(this->offsets.subtype_base_table_offset);
|
||||
}
|
||||
const parray<uint8_t, 0x0C>& CommonItemSet::Table::subtype_area_length_table() const {
|
||||
return this->r.pget<parray<uint8_t, 0x0C>>(this->offsets.subtype_area_length_table_offset);
|
||||
}
|
||||
const parray<parray<uint8_t, 4>, 9>& CommonItemSet::Table::grind_prob_table() const {
|
||||
return this->r.pget<parray<parray<uint8_t, 4>, 9>>(this->offsets.grind_prob_table_offset);
|
||||
}
|
||||
const parray<uint8_t, 0x05>& CommonItemSet::Table::armor_shield_type_index_prob_table() const {
|
||||
return this->r.pget<parray<uint8_t, 0x05>>(this->offsets.armor_shield_type_index_prob_table_offset);
|
||||
}
|
||||
const parray<uint8_t, 0x05>& CommonItemSet::Table::armor_slot_count_prob_table() const {
|
||||
return this->r.pget<parray<uint8_t, 0x05>>(this->offsets.armor_slot_count_prob_table_offset);
|
||||
}
|
||||
const parray<CommonItemSet::Table::Range<uint16_t>, 0x64>& CommonItemSet::Table::enemy_meseta_ranges() const {
|
||||
if (!this->parsed_enemy_meseta_ranges_populated) {
|
||||
if (this->is_big_endian) {
|
||||
const auto& data = r.pget<parray<Range<be_uint16_t>, 0x64>>(this->offsets.enemy_meseta_ranges_offset);
|
||||
for (size_t z = 0; z < data.size(); z++) {
|
||||
this->parsed_enemy_meseta_ranges[z] = Range<uint16_t>{data[z].min, data[z].max};
|
||||
}
|
||||
} else {
|
||||
const auto& data = r.pget<parray<Range<le_uint16_t>, 0x64>>(this->offsets.enemy_meseta_ranges_offset);
|
||||
for (size_t z = 0; z < data.size(); z++) {
|
||||
this->parsed_enemy_meseta_ranges[z] = Range<uint16_t>{data[z].min, data[z].max};
|
||||
template <bool IsBigEndian>
|
||||
void CommonItemSet::Table::parse_itempt_t(const StringReader& r, bool is_v3) {
|
||||
using U16T = typename std::conditional<IsBigEndian, be_uint16_t, le_uint16_t>::type;
|
||||
using U32T = typename std::conditional<IsBigEndian, be_uint32_t, le_uint32_t>::type;
|
||||
|
||||
const auto& offsets = r.pget<Offsets<IsBigEndian>>(r.pget<U32T>(r.size() - 0x10));
|
||||
|
||||
this->base_weapon_type_prob_table = r.pget<parray<uint8_t, 0x0C>>(offsets.base_weapon_type_prob_table_offset);
|
||||
this->subtype_base_table = r.pget<parray<int8_t, 0x0C>>(offsets.subtype_base_table_offset);
|
||||
this->subtype_area_length_table = r.pget<parray<uint8_t, 0x0C>>(offsets.subtype_area_length_table_offset);
|
||||
this->grind_prob_table = r.pget<parray<parray<uint8_t, 4>, 9>>(offsets.grind_prob_table_offset);
|
||||
this->armor_shield_type_index_prob_table = r.pget<parray<uint8_t, 0x05>>(offsets.armor_shield_type_index_prob_table_offset);
|
||||
this->armor_slot_count_prob_table = r.pget<parray<uint8_t, 0x05>>(offsets.armor_slot_count_prob_table_offset);
|
||||
const auto& data = r.pget<parray<Range<U16T>, 0x64>>(offsets.enemy_meseta_ranges_offset);
|
||||
for (size_t z = 0; z < data.size(); z++) {
|
||||
this->enemy_meseta_ranges[z] = Range<uint16_t>{data[z].min, data[z].max};
|
||||
}
|
||||
this->enemy_type_drop_probs = r.pget<parray<uint8_t, 0x64>>(offsets.enemy_type_drop_probs_offset);
|
||||
this->enemy_item_classes = r.pget<parray<uint8_t, 0x64>>(offsets.enemy_item_classes_offset);
|
||||
{
|
||||
const auto& data = r.pget<parray<Range<U16T>, 0x0A>>(offsets.box_meseta_ranges_offset);
|
||||
for (size_t z = 0; z < data.size(); z++) {
|
||||
this->box_meseta_ranges[z] = Range<uint16_t>{data[z].min, data[z].max};
|
||||
}
|
||||
}
|
||||
this->has_rare_bonus_value_prob_table = is_v3;
|
||||
if (!this->has_rare_bonus_value_prob_table) { // V2
|
||||
const auto& data = r.pget<parray<parray<uint8_t, 5>, 0x17>>(offsets.bonus_value_prob_table_offset);
|
||||
for (size_t z = 0; z < data.size(); z++) {
|
||||
for (size_t x = 0; x < data[z].size(); x++) {
|
||||
this->bonus_value_prob_table[z][x] = data[z][x];
|
||||
}
|
||||
}
|
||||
this->parsed_enemy_meseta_ranges_populated = true;
|
||||
}
|
||||
return this->parsed_enemy_meseta_ranges;
|
||||
}
|
||||
const parray<uint8_t, 0x64>& CommonItemSet::Table::enemy_type_drop_probs() const {
|
||||
return this->r.pget<parray<uint8_t, 0x64>>(this->offsets.enemy_type_drop_probs_offset);
|
||||
}
|
||||
const parray<uint8_t, 0x64>& CommonItemSet::Table::enemy_item_classes() const {
|
||||
return this->r.pget<parray<uint8_t, 0x64>>(this->offsets.enemy_item_classes_offset);
|
||||
}
|
||||
const parray<CommonItemSet::Table::Range<uint16_t>, 0x0A>& CommonItemSet::Table::box_meseta_ranges() const {
|
||||
if (!this->parsed_box_meseta_ranges_populated) {
|
||||
if (this->is_big_endian) {
|
||||
const auto& data = r.pget<parray<Range<be_uint16_t>, 0x0A>>(this->offsets.box_meseta_ranges_offset);
|
||||
for (size_t z = 0; z < data.size(); z++) {
|
||||
this->parsed_box_meseta_ranges[z] = Range<uint16_t>{data[z].min, data[z].max};
|
||||
}
|
||||
} else {
|
||||
const auto& data = r.pget<parray<Range<le_uint16_t>, 0x0A>>(this->offsets.box_meseta_ranges_offset);
|
||||
for (size_t z = 0; z < data.size(); z++) {
|
||||
this->parsed_box_meseta_ranges[z] = Range<uint16_t>{data[z].min, data[z].max};
|
||||
} else { // V3
|
||||
const auto& data = r.pget<parray<parray<U16T, 6>, 0x17>>(offsets.bonus_value_prob_table_offset);
|
||||
for (size_t z = 0; z < data.size(); z++) {
|
||||
for (size_t x = 0; x < data[z].size(); x++) {
|
||||
this->bonus_value_prob_table[z][x] = data[z][x];
|
||||
}
|
||||
}
|
||||
this->parsed_box_meseta_ranges_populated = true;
|
||||
}
|
||||
return this->parsed_box_meseta_ranges;
|
||||
}
|
||||
bool CommonItemSet::Table::has_rare_bonus_value_prob_table() const {
|
||||
return this->is_v3;
|
||||
}
|
||||
const parray<parray<uint16_t, 6>, 0x17>& CommonItemSet::Table::bonus_value_prob_table() const {
|
||||
if (!this->parsed_bonus_value_prob_table_populated) {
|
||||
if (!this->is_v3) { // V2
|
||||
const auto& data = r.pget<parray<parray<uint8_t, 5>, 0x17>>(this->offsets.bonus_value_prob_table_offset);
|
||||
for (size_t z = 0; z < data.size(); z++) {
|
||||
for (size_t x = 0; x < data[z].size(); x++) {
|
||||
this->parsed_bonus_value_prob_table[z][x] = data[z][x];
|
||||
}
|
||||
}
|
||||
} else if (this->is_big_endian) { // BE V3
|
||||
const auto& data = r.pget<parray<parray<be_uint16_t, 6>, 0x17>>(this->offsets.bonus_value_prob_table_offset);
|
||||
for (size_t z = 0; z < data.size(); z++) {
|
||||
for (size_t x = 0; x < data[z].size(); x++) {
|
||||
this->parsed_bonus_value_prob_table[z][x] = data[z][x];
|
||||
}
|
||||
}
|
||||
} else { // LE V3
|
||||
const auto& data = r.pget<parray<parray<le_uint16_t, 6>, 0x17>>(this->offsets.bonus_value_prob_table_offset);
|
||||
for (size_t z = 0; z < data.size(); z++) {
|
||||
for (size_t x = 0; x < data[z].size(); x++) {
|
||||
this->parsed_bonus_value_prob_table[z][x] = data[z][x];
|
||||
}
|
||||
this->nonrare_bonus_prob_spec = r.pget<parray<parray<uint8_t, 10>, 3>>(offsets.nonrare_bonus_prob_spec_offset);
|
||||
this->bonus_type_prob_table = r.pget<parray<parray<uint8_t, 10>, 6>>(offsets.bonus_type_prob_table_offset);
|
||||
this->special_mult = r.pget<parray<uint8_t, 0x0A>>(offsets.special_mult_offset);
|
||||
this->special_percent = r.pget<parray<uint8_t, 0x0A>>(offsets.special_percent_offset);
|
||||
{
|
||||
const auto& data = r.pget<parray<parray<U16T, 0x0A>, 0x1C>>(offsets.tool_class_prob_table_offset);
|
||||
for (size_t z = 0; z < data.size(); z++) {
|
||||
for (size_t x = 0; x < data[z].size(); x++) {
|
||||
this->tool_class_prob_table[z][x] = data[z][x];
|
||||
}
|
||||
}
|
||||
this->parsed_bonus_value_prob_table_populated = true;
|
||||
}
|
||||
return this->parsed_bonus_value_prob_table;
|
||||
this->technique_index_prob_table = r.pget<parray<parray<uint8_t, 0x0A>, 0x13>>(offsets.technique_index_prob_table_offset);
|
||||
this->technique_level_ranges = r.pget<parray<parray<Range<uint8_t>, 0x0A>, 0x13>>(offsets.technique_level_ranges_offset);
|
||||
this->armor_or_shield_type_bias = offsets.armor_or_shield_type_bias;
|
||||
this->unit_max_stars_table = r.pget<parray<uint8_t, 0x0A>>(offsets.unit_max_stars_offset);
|
||||
this->box_item_class_prob_table = r.pget<parray<parray<uint8_t, 10>, 7>>(offsets.box_item_class_prob_table_offset);
|
||||
}
|
||||
const parray<parray<uint8_t, 10>, 3>& CommonItemSet::Table::nonrare_bonus_prob_spec() const {
|
||||
return this->r.pget<parray<parray<uint8_t, 10>, 3>>(this->offsets.nonrare_bonus_prob_spec_offset);
|
||||
}
|
||||
const parray<parray<uint8_t, 10>, 6>& CommonItemSet::Table::bonus_type_prob_table() const {
|
||||
return this->r.pget<parray<parray<uint8_t, 10>, 6>>(this->offsets.bonus_type_prob_table_offset);
|
||||
}
|
||||
const parray<uint8_t, 0x0A>& CommonItemSet::Table::special_mult() const {
|
||||
return this->r.pget<parray<uint8_t, 0x0A>>(this->offsets.special_mult_offset);
|
||||
}
|
||||
const parray<uint8_t, 0x0A>& CommonItemSet::Table::special_percent() const {
|
||||
return this->r.pget<parray<uint8_t, 0x0A>>(this->offsets.special_percent_offset);
|
||||
}
|
||||
const parray<parray<uint16_t, 0x0A>, 0x1C>& CommonItemSet::Table::tool_class_prob_table() const {
|
||||
if (!this->parsed_tool_class_prob_table_populated) {
|
||||
if (this->is_big_endian) {
|
||||
const auto& data = r.pget<parray<parray<be_uint16_t, 0x0A>, 0x1C>>(this->offsets.tool_class_prob_table_offset);
|
||||
for (size_t z = 0; z < data.size(); z++) {
|
||||
for (size_t x = 0; x < data[z].size(); x++) {
|
||||
this->parsed_tool_class_prob_table[z][x] = data[z][x];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const auto& data = r.pget<parray<parray<le_uint16_t, 0x0A>, 0x1C>>(this->offsets.tool_class_prob_table_offset);
|
||||
for (size_t z = 0; z < data.size(); z++) {
|
||||
for (size_t x = 0; x < data[z].size(); x++) {
|
||||
this->parsed_tool_class_prob_table[z][x] = data[z][x];
|
||||
}
|
||||
}
|
||||
|
||||
void CommonItemSet::Table::print_enemy_table(FILE* stream) const {
|
||||
const auto& meseta_ranges = this->enemy_meseta_ranges;
|
||||
const auto& drop_probs = this->enemy_type_drop_probs;
|
||||
const auto& item_classes = this->enemy_item_classes;
|
||||
// const parray<Range<uint16_t>, 0x64>& enemy_meseta_ranges() const;
|
||||
// const parray<uint8_t, 0x64>& enemy_type_drop_probs() const;
|
||||
// const parray<uint8_t, 0x64>& enemy_item_classes() const;
|
||||
fprintf(stream, "## $_LOW $_HIGH DAR ITEM\n");
|
||||
for (size_t z = 0; z < 0x64; z++) {
|
||||
const char* item_class_name = "__UNKNOWN__";
|
||||
switch (item_classes[z]) {
|
||||
case 0x00:
|
||||
item_class_name = "WEAPON";
|
||||
break;
|
||||
case 0x01:
|
||||
item_class_name = "ARMOR";
|
||||
break;
|
||||
case 0x02:
|
||||
item_class_name = "SHIELD";
|
||||
break;
|
||||
case 0x03:
|
||||
item_class_name = "UNIT";
|
||||
break;
|
||||
case 0x04:
|
||||
item_class_name = "TOOL";
|
||||
break;
|
||||
case 0x05:
|
||||
item_class_name = "MESETA";
|
||||
break;
|
||||
}
|
||||
this->parsed_tool_class_prob_table_populated = true;
|
||||
fprintf(stream, "%02zX %5hu %5hu %3hhu %02hX (%s)\n",
|
||||
z, meseta_ranges[z].min, meseta_ranges[z].max, drop_probs[z], item_classes[z], item_class_name);
|
||||
}
|
||||
return this->parsed_tool_class_prob_table;
|
||||
}
|
||||
const parray<parray<uint8_t, 0x0A>, 0x13>& CommonItemSet::Table::technique_index_prob_table() const {
|
||||
return this->r.pget<parray<parray<uint8_t, 0x0A>, 0x13>>(this->offsets.technique_index_prob_table_offset);
|
||||
}
|
||||
const parray<parray<CommonItemSet::Table::Range<uint8_t>, 0x0A>, 0x13>& CommonItemSet::Table::technique_level_ranges() const {
|
||||
return this->r.pget<parray<parray<Range<uint8_t>, 0x0A>, 0x13>>(this->offsets.technique_level_ranges_offset);
|
||||
}
|
||||
uint8_t CommonItemSet::Table::armor_or_shield_type_bias() const {
|
||||
return this->offsets.armor_or_shield_type_bias;
|
||||
}
|
||||
const parray<uint8_t, 0x0A>& CommonItemSet::Table::unit_max_stars_table() const {
|
||||
return this->r.pget<parray<uint8_t, 0x0A>>(this->offsets.unit_max_stars_offset);
|
||||
}
|
||||
const parray<parray<uint8_t, 10>, 7>& CommonItemSet::Table::box_item_class_prob_table() const {
|
||||
return this->r.pget<parray<parray<uint8_t, 10>, 7>>(this->offsets.box_item_class_prob_table_offset);
|
||||
}
|
||||
|
||||
uint16_t CommonItemSet::key_for_table(Episode episode, GameMode mode, uint8_t difficulty, uint8_t secid) {
|
||||
@@ -205,7 +136,7 @@ AFSV2CommonItemSet::AFSV2CommonItemSet(
|
||||
for (size_t section_id = 0; section_id < 10; section_id++) {
|
||||
auto entry = pt_afs.get(difficulty * 10 + section_id);
|
||||
StringReader r(entry.first, entry.second);
|
||||
shared_ptr<Table> table(new Table(pt_afs_data, r, false, false));
|
||||
auto table = make_shared<Table>(r, false, false);
|
||||
this->tables.emplace(this->key_for_table(Episode::EP1, GameMode::NORMAL, difficulty, section_id), table);
|
||||
this->tables.emplace(this->key_for_table(Episode::EP1, GameMode::BATTLE, difficulty, section_id), table);
|
||||
this->tables.emplace(this->key_for_table(Episode::EP1, GameMode::SOLO, difficulty, section_id), table);
|
||||
@@ -217,48 +148,72 @@ AFSV2CommonItemSet::AFSV2CommonItemSet(
|
||||
AFSArchive ct_afs(ct_afs_data);
|
||||
for (size_t difficulty = 0; difficulty < 4; difficulty++) {
|
||||
auto r = ct_afs.get_reader(difficulty * 10);
|
||||
shared_ptr<Table> table(new Table(ct_afs_data, r, false, false));
|
||||
auto table = make_shared<Table>(r, false, false);
|
||||
for (size_t section_id = 0; section_id < 10; section_id++) {
|
||||
this->tables.emplace(this->key_for_table(Episode::EP1, GameMode::CHALLENGE, difficulty, section_id), table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GSLV3CommonItemSet::GSLV3CommonItemSet(std::shared_ptr<const std::string> gsl_data, bool is_big_endian) {
|
||||
GSLV3V4CommonItemSet::GSLV3V4CommonItemSet(std::shared_ptr<const std::string> gsl_data, bool is_big_endian) {
|
||||
GSLArchive gsl(gsl_data, is_big_endian);
|
||||
|
||||
vector<Episode> episodes = {Episode::EP1, Episode::EP2};
|
||||
auto filename_for_table = +[](Episode episode, uint8_t difficulty, uint8_t section_id, bool is_challenge) -> string {
|
||||
const char* episode_token = "";
|
||||
switch (episode) {
|
||||
case Episode::EP1:
|
||||
episode_token = "";
|
||||
break;
|
||||
case Episode::EP2:
|
||||
episode_token = "l";
|
||||
break;
|
||||
case Episode::EP4:
|
||||
episode_token = "s";
|
||||
break;
|
||||
default:
|
||||
throw runtime_error("invalid episode");
|
||||
}
|
||||
return string_printf(
|
||||
"ItemPT%s%s%c%1hhu.rel",
|
||||
is_challenge ? "c" : "",
|
||||
episode_token,
|
||||
tolower(abbreviation_for_difficulty(difficulty)),
|
||||
section_id);
|
||||
};
|
||||
|
||||
vector<Episode> episodes = {Episode::EP1, Episode::EP2, Episode::EP4};
|
||||
for (Episode episode : episodes) {
|
||||
for (size_t difficulty = 0; difficulty < 4; difficulty++) {
|
||||
for (size_t section_id = 0; section_id < 10; section_id++) {
|
||||
string filename = string_printf(
|
||||
"ItemPT%s%c%1zu.rel",
|
||||
((episode == Episode::EP2) ? "l" : ""),
|
||||
tolower(abbreviation_for_difficulty(difficulty)),
|
||||
section_id);
|
||||
auto r = gsl.get_reader(filename);
|
||||
shared_ptr<Table> table(new Table(gsl_data, r, is_big_endian, true));
|
||||
StringReader r;
|
||||
try {
|
||||
r = gsl.get_reader(filename_for_table(episode, difficulty, section_id, false));
|
||||
} catch (const exception&) {
|
||||
// Fall back to Episode 1 if Episode 4 data is missing
|
||||
if (episode == Episode::EP4) {
|
||||
auto ep1_table = this->tables.at(this->key_for_table(Episode::EP1, GameMode::NORMAL, difficulty, section_id));
|
||||
this->tables.emplace(this->key_for_table(episode, GameMode::NORMAL, difficulty, section_id), ep1_table);
|
||||
this->tables.emplace(this->key_for_table(episode, GameMode::BATTLE, difficulty, section_id), ep1_table);
|
||||
this->tables.emplace(this->key_for_table(episode, GameMode::SOLO, difficulty, section_id), ep1_table);
|
||||
continue;
|
||||
} else {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
auto table = make_shared<Table>(r, is_big_endian, true);
|
||||
this->tables.emplace(this->key_for_table(episode, GameMode::NORMAL, difficulty, section_id), table);
|
||||
this->tables.emplace(this->key_for_table(episode, GameMode::BATTLE, difficulty, section_id), table);
|
||||
this->tables.emplace(this->key_for_table(episode, GameMode::SOLO, difficulty, section_id), table);
|
||||
// TODO: These tables don't exist for Episode 4, and the GC version is
|
||||
// the closest we have, so we use the Ep1 data from GC for Ep4.
|
||||
if (episode == Episode::EP1) {
|
||||
this->tables.emplace(this->key_for_table(Episode::EP4, GameMode::NORMAL, difficulty, section_id), table);
|
||||
this->tables.emplace(this->key_for_table(Episode::EP4, GameMode::BATTLE, difficulty, section_id), table);
|
||||
this->tables.emplace(this->key_for_table(Episode::EP4, GameMode::SOLO, difficulty, section_id), table);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (size_t difficulty = 0; difficulty < 4; difficulty++) {
|
||||
string filename = string_printf(
|
||||
"ItemPTc%s%c0.rel",
|
||||
((episode == Episode::EP2) ? "l" : ""),
|
||||
tolower(abbreviation_for_difficulty(difficulty)));
|
||||
auto r = gsl.get_reader(filename);
|
||||
shared_ptr<Table> table(new Table(gsl_data, r, is_big_endian, true));
|
||||
for (size_t section_id = 0; section_id < 10; section_id++) {
|
||||
this->tables.emplace(this->key_for_table(episode, GameMode::CHALLENGE, difficulty, section_id), table);
|
||||
|
||||
if (episode != Episode::EP4) {
|
||||
for (size_t difficulty = 0; difficulty < 4; difficulty++) {
|
||||
auto r = gsl.get_reader(filename_for_table(episode, difficulty, 0, true));
|
||||
auto table = make_shared<Table>(r, is_big_endian, true);
|
||||
for (size_t section_id = 0; section_id < 10; section_id++) {
|
||||
this->tables.emplace(this->key_for_table(episode, GameMode::CHALLENGE, difficulty, section_id), table);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+30
-41
@@ -13,7 +13,7 @@ public:
|
||||
class Table {
|
||||
public:
|
||||
Table() = delete;
|
||||
Table(std::shared_ptr<const std::string> owned_data, const StringReader& r, bool big_endian, bool is_v3);
|
||||
Table(const StringReader& r, bool big_endian, bool is_v3);
|
||||
|
||||
template <typename IntT>
|
||||
struct Range {
|
||||
@@ -21,30 +21,35 @@ public:
|
||||
IntT max;
|
||||
} __attribute__((packed));
|
||||
|
||||
const parray<uint8_t, 0x0C>& base_weapon_type_prob_table() const;
|
||||
const parray<int8_t, 0x0C>& subtype_base_table() const;
|
||||
const parray<uint8_t, 0x0C>& subtype_area_length_table() const;
|
||||
const parray<parray<uint8_t, 4>, 9>& grind_prob_table() const;
|
||||
const parray<uint8_t, 0x05>& armor_shield_type_index_prob_table() const;
|
||||
const parray<uint8_t, 0x05>& armor_slot_count_prob_table() const;
|
||||
const parray<Range<uint16_t>, 0x64>& enemy_meseta_ranges() const;
|
||||
const parray<uint8_t, 0x64>& enemy_type_drop_probs() const;
|
||||
const parray<uint8_t, 0x64>& enemy_item_classes() const;
|
||||
const parray<Range<uint16_t>, 0x0A>& box_meseta_ranges() const;
|
||||
bool has_rare_bonus_value_prob_table() const;
|
||||
const parray<parray<uint16_t, 6>, 0x17>& bonus_value_prob_table() const;
|
||||
const parray<parray<uint8_t, 10>, 3>& nonrare_bonus_prob_spec() const;
|
||||
const parray<parray<uint8_t, 10>, 6>& bonus_type_prob_table() const;
|
||||
const parray<uint8_t, 0x0A>& special_mult() const;
|
||||
const parray<uint8_t, 0x0A>& special_percent() const;
|
||||
const parray<parray<uint16_t, 0x0A>, 0x1C>& tool_class_prob_table() const;
|
||||
const parray<parray<uint8_t, 0x0A>, 0x13>& technique_index_prob_table() const;
|
||||
const parray<parray<Range<uint8_t>, 0x0A>, 0x13>& technique_level_ranges() const;
|
||||
uint8_t armor_or_shield_type_bias() const;
|
||||
const parray<uint8_t, 0x0A>& unit_max_stars_table() const;
|
||||
const parray<parray<uint8_t, 10>, 7>& box_item_class_prob_table() const;
|
||||
parray<uint8_t, 0x0C> base_weapon_type_prob_table;
|
||||
parray<int8_t, 0x0C> subtype_base_table;
|
||||
parray<uint8_t, 0x0C> subtype_area_length_table;
|
||||
parray<parray<uint8_t, 4>, 9> grind_prob_table;
|
||||
parray<uint8_t, 0x05> armor_shield_type_index_prob_table;
|
||||
parray<uint8_t, 0x05> armor_slot_count_prob_table;
|
||||
parray<Range<uint16_t>, 0x64> enemy_meseta_ranges;
|
||||
parray<uint8_t, 0x64> enemy_type_drop_probs;
|
||||
parray<uint8_t, 0x64> enemy_item_classes;
|
||||
parray<Range<uint16_t>, 0x0A> box_meseta_ranges;
|
||||
bool has_rare_bonus_value_prob_table;
|
||||
parray<parray<uint16_t, 6>, 0x17> bonus_value_prob_table;
|
||||
parray<parray<uint8_t, 10>, 3> nonrare_bonus_prob_spec;
|
||||
parray<parray<uint8_t, 10>, 6> bonus_type_prob_table;
|
||||
parray<uint8_t, 0x0A> special_mult;
|
||||
parray<uint8_t, 0x0A> special_percent;
|
||||
parray<parray<uint16_t, 0x0A>, 0x1C> tool_class_prob_table;
|
||||
parray<parray<uint8_t, 0x0A>, 0x13> technique_index_prob_table;
|
||||
parray<parray<Range<uint8_t>, 0x0A>, 0x13> technique_level_ranges;
|
||||
uint8_t armor_or_shield_type_bias;
|
||||
parray<uint8_t, 0x0A> unit_max_stars_table;
|
||||
parray<parray<uint8_t, 10>, 7> box_item_class_prob_table;
|
||||
|
||||
void print_enemy_table(FILE* stream) const;
|
||||
|
||||
private:
|
||||
template <bool IsBigEndian>
|
||||
void parse_itempt_t(const StringReader& r, bool is_v3);
|
||||
|
||||
template <bool IsBigEndian>
|
||||
struct Offsets {
|
||||
using U16T = typename std::conditional<IsBigEndian, be_uint16_t, le_uint16_t>::type;
|
||||
@@ -248,22 +253,6 @@ public:
|
||||
|
||||
// There are several unused fields here.
|
||||
} __attribute__((packed));
|
||||
|
||||
std::shared_ptr<const std::string> owned_data;
|
||||
StringReader r;
|
||||
bool is_big_endian;
|
||||
bool is_v3;
|
||||
|
||||
Offsets<false> offsets;
|
||||
|
||||
mutable parray<Range<uint16_t>, 0x64> parsed_enemy_meseta_ranges;
|
||||
mutable bool parsed_enemy_meseta_ranges_populated = false;
|
||||
mutable parray<Range<uint16_t>, 0x0A> parsed_box_meseta_ranges;
|
||||
mutable bool parsed_box_meseta_ranges_populated = false;
|
||||
mutable parray<parray<uint16_t, 6>, 0x17> parsed_bonus_value_prob_table;
|
||||
mutable bool parsed_bonus_value_prob_table_populated = false;
|
||||
mutable parray<parray<uint16_t, 0x0A>, 0x1C> parsed_tool_class_prob_table;
|
||||
mutable bool parsed_tool_class_prob_table_populated = false;
|
||||
};
|
||||
|
||||
std::shared_ptr<const Table> get_table(Episode episode, GameMode mode, uint8_t difficulty, uint8_t secid) const;
|
||||
@@ -281,9 +270,9 @@ public:
|
||||
AFSV2CommonItemSet(std::shared_ptr<const std::string> pt_afs_data, std::shared_ptr<const std::string> ct_afs_data);
|
||||
};
|
||||
|
||||
class GSLV3CommonItemSet : public CommonItemSet {
|
||||
class GSLV3V4CommonItemSet : public CommonItemSet {
|
||||
public:
|
||||
GSLV3CommonItemSet(std::shared_ptr<const std::string> gsl_data, bool is_big_endian);
|
||||
GSLV3V4CommonItemSet(std::shared_ptr<const std::string> gsl_data, bool is_big_endian);
|
||||
};
|
||||
|
||||
// Note: There are clearly better ways of doing this, but this implementation
|
||||
|
||||
+1
-2
@@ -31,7 +31,6 @@ private:
|
||||
uint32_t local_connect_address;
|
||||
uint32_t external_connect_address;
|
||||
|
||||
static void dispatch_on_receive_message(evutil_socket_t fd, short events,
|
||||
void* ctx);
|
||||
static void dispatch_on_receive_message(evutil_socket_t fd, short events, void* ctx);
|
||||
void on_receive_message(int fd, short event);
|
||||
};
|
||||
|
||||
+29
-23
@@ -618,10 +618,10 @@ uint8_t battle_param_index_for_enemy_type(Episode episode, EnemyType enemy_type)
|
||||
return 0x20;
|
||||
case EnemyType::VOL_OPT_2:
|
||||
return 0x25;
|
||||
case EnemyType::POUILLY_SLIME:
|
||||
return 0x2F;
|
||||
case EnemyType::POFUILLY_SLIME:
|
||||
return 0x30;
|
||||
case EnemyType::POUILLY_SLIME:
|
||||
return 0x2F;
|
||||
case EnemyType::PAN_ARMS:
|
||||
return 0x31;
|
||||
case EnemyType::HIDOOM:
|
||||
@@ -852,9 +852,9 @@ uint8_t rare_table_index_for_enemy_type(EnemyType enemy_type) {
|
||||
case EnemyType::AL_RAPPY:
|
||||
return 0x06;
|
||||
case EnemyType::ASTARK:
|
||||
return 0x01;
|
||||
return 0x41;
|
||||
case EnemyType::BA_BOOTA:
|
||||
return 0x0B;
|
||||
return 0x4F;
|
||||
case EnemyType::BARBA_RAY:
|
||||
return 0x49;
|
||||
case EnemyType::BARBAROUS_WOLF:
|
||||
@@ -862,7 +862,7 @@ uint8_t rare_table_index_for_enemy_type(EnemyType enemy_type) {
|
||||
case EnemyType::BOOMA:
|
||||
return 0x09;
|
||||
case EnemyType::BOOTA:
|
||||
return 0x09;
|
||||
return 0x4D;
|
||||
case EnemyType::BULCLAW:
|
||||
return 0x28;
|
||||
case EnemyType::CANADINE:
|
||||
@@ -889,8 +889,9 @@ uint8_t rare_table_index_for_enemy_type(EnemyType enemy_type) {
|
||||
case EnemyType::DEL_LILY:
|
||||
return 0x53;
|
||||
case EnemyType::DEL_RAPPY:
|
||||
return 0x57;
|
||||
case EnemyType::DEL_RAPPY_ALT:
|
||||
return 0x12;
|
||||
return 0x58;
|
||||
case EnemyType::DELBITER:
|
||||
return 0x48;
|
||||
case EnemyType::DELDEPTH:
|
||||
@@ -904,9 +905,9 @@ uint8_t rare_table_index_for_enemy_type(EnemyType enemy_type) {
|
||||
case EnemyType::DOLMOLM:
|
||||
return 0x40;
|
||||
case EnemyType::DORPHON:
|
||||
return 0x0C;
|
||||
return 0x50;
|
||||
case EnemyType::DORPHON_ECLAIR:
|
||||
return 0x0D;
|
||||
return 0x51;
|
||||
case EnemyType::DRAGON:
|
||||
return 0x2C;
|
||||
case EnemyType::DUBCHIC:
|
||||
@@ -932,15 +933,15 @@ uint8_t rare_table_index_for_enemy_type(EnemyType enemy_type) {
|
||||
case EnemyType::GILLCHIC:
|
||||
return 0x32;
|
||||
case EnemyType::GIRTABLULU:
|
||||
return 0x06;
|
||||
return 0x48;
|
||||
case EnemyType::GOBOOMA:
|
||||
return 0x0A;
|
||||
case EnemyType::GOL_DRAGON:
|
||||
return 0x4C;
|
||||
case EnemyType::GORAN:
|
||||
return 0x0E;
|
||||
return 0x52;
|
||||
case EnemyType::GORAN_DETONATOR:
|
||||
return 0x0F;
|
||||
return 0x53;
|
||||
case EnemyType::GRASS_ASSASSIN:
|
||||
return 0x0C;
|
||||
case EnemyType::GUIL_SHARK:
|
||||
@@ -956,7 +957,7 @@ uint8_t rare_table_index_for_enemy_type(EnemyType enemy_type) {
|
||||
case EnemyType::ILL_GILL:
|
||||
return 0x52;
|
||||
case EnemyType::KONDRIEU:
|
||||
return 0x15;
|
||||
return 0x5B;
|
||||
case EnemyType::LA_DIMENIAN:
|
||||
return 0x2A;
|
||||
case EnemyType::LOVE_RAPPY:
|
||||
@@ -972,9 +973,9 @@ uint8_t rare_table_index_for_enemy_type(EnemyType enemy_type) {
|
||||
case EnemyType::MERILTAS:
|
||||
return 0x35;
|
||||
case EnemyType::MERISSA_A:
|
||||
return 0x04;
|
||||
return 0x46;
|
||||
case EnemyType::MERISSA_AA:
|
||||
return 0x05;
|
||||
return 0x47;
|
||||
case EnemyType::MIGIUM:
|
||||
return 0x16;
|
||||
case EnemyType::MONEST:
|
||||
@@ -994,8 +995,9 @@ uint8_t rare_table_index_for_enemy_type(EnemyType enemy_type) {
|
||||
case EnemyType::PAN_ARMS:
|
||||
return 0x15;
|
||||
case EnemyType::PAZUZU:
|
||||
return 0x4B;
|
||||
case EnemyType::PAZUZU_ALT:
|
||||
return 0x08;
|
||||
return 0x4C;
|
||||
case EnemyType::POFUILLY_SLIME:
|
||||
return 0x13;
|
||||
case EnemyType::POUILLY_SLIME:
|
||||
@@ -1003,7 +1005,7 @@ uint8_t rare_table_index_for_enemy_type(EnemyType enemy_type) {
|
||||
case EnemyType::POISON_LILY:
|
||||
return 0x0D;
|
||||
case EnemyType::PYRO_GORAN:
|
||||
return 0x10;
|
||||
return 0x54;
|
||||
case EnemyType::RAG_RAPPY:
|
||||
return 0x05;
|
||||
case EnemyType::RECOBOX:
|
||||
@@ -1013,17 +1015,19 @@ uint8_t rare_table_index_for_enemy_type(EnemyType enemy_type) {
|
||||
case EnemyType::SAINT_RAPPY:
|
||||
return 0x4F;
|
||||
case EnemyType::SAINT_MILLION:
|
||||
return 0x13;
|
||||
return 0x59;
|
||||
case EnemyType::SAND_RAPPY:
|
||||
return 0x55;
|
||||
case EnemyType::SAND_RAPPY_ALT:
|
||||
return 0x11;
|
||||
return 0x56;
|
||||
case EnemyType::SATELLITE_LIZARD:
|
||||
return 0x44;
|
||||
case EnemyType::SATELLITE_LIZARD_ALT:
|
||||
return 0x03;
|
||||
return 0x45;
|
||||
case EnemyType::SAVAGE_WOLF:
|
||||
return 0x07;
|
||||
case EnemyType::SHAMBERTIN:
|
||||
return 0x14;
|
||||
return 0x5A;
|
||||
case EnemyType::SINOW_BEAT:
|
||||
return 0x1A;
|
||||
case EnemyType::SINOW_BERILL:
|
||||
@@ -1043,15 +1047,17 @@ uint8_t rare_table_index_for_enemy_type(EnemyType enemy_type) {
|
||||
case EnemyType::VOL_OPT_2:
|
||||
return 0x2E;
|
||||
case EnemyType::YOWIE:
|
||||
return 0x42;
|
||||
case EnemyType::YOWIE_ALT:
|
||||
return 0x02;
|
||||
return 0x43;
|
||||
case EnemyType::ZE_BOOTA:
|
||||
return 0x0A;
|
||||
return 0x4E;
|
||||
case EnemyType::ZOL_GIBBON:
|
||||
return 0x3C;
|
||||
case EnemyType::ZU:
|
||||
return 0x49;
|
||||
case EnemyType::ZU_ALT:
|
||||
return 0x07;
|
||||
return 0x4A;
|
||||
default:
|
||||
throw runtime_error(string_printf("%s does not have a rare table entry", name_for_enum(enemy_type)));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
#include "../Player.hh"
|
||||
#include "../PlayerSubordinates.hh"
|
||||
|
||||
struct Lobby;
|
||||
|
||||
|
||||
@@ -789,13 +789,16 @@ CardSpecial::AttackEnvStats CardSpecial::compute_attack_env_stats(
|
||||
ast.card_cost = ce->def.self_cost;
|
||||
ast.defined_max_hp = ast.max_hp;
|
||||
|
||||
size_t z;
|
||||
size_t z = 0;
|
||||
|
||||
uint16_t z_ref = pa.attacker_card_ref;
|
||||
// Note: The (z < 9) conditions in these two loops are not present in the
|
||||
// original code.
|
||||
for (z = 0;
|
||||
((target_card_ref != pa.attacker_card_ref) && (z < 9) && (pa.action_card_refs[z] != 0xFFFF));
|
||||
((target_card_ref != z_ref) && (z < 9) && ((z_ref = pa.action_card_refs[z]) != 0xFFFF));
|
||||
z++) {
|
||||
}
|
||||
|
||||
ast.action_cards_ap = 0;
|
||||
ast.action_cards_tp = 0;
|
||||
for (; (z < 9) && (pa.action_card_refs[z] != 0xFFFF); z++) {
|
||||
|
||||
@@ -2261,7 +2261,7 @@ CardIndex::CardIndex(
|
||||
continue;
|
||||
}
|
||||
|
||||
shared_ptr<CardEntry> entry(new CardEntry({defs[x], "", "", "", {}}));
|
||||
auto entry = make_shared<CardEntry>(CardEntry{defs[x], "", "", "", {}});
|
||||
if (!this->card_definitions.emplace(entry->def.card_id, entry).second) {
|
||||
throw runtime_error(string_printf(
|
||||
"duplicate card id: %08" PRIX32, entry->def.card_id.load()));
|
||||
@@ -2391,12 +2391,12 @@ MapIndex::VersionedMap::VersionedMap(std::string&& compressed_data, uint8_t lang
|
||||
"decompressed data size is incorrect (expected %zu bytes, read %zu bytes)",
|
||||
sizeof(MapDefinition), decompressed.size()));
|
||||
}
|
||||
this->map.reset(new MapDefinition(*reinterpret_cast<const MapDefinition*>(decompressed.data())));
|
||||
this->map = make_shared<MapDefinition>(*reinterpret_cast<const MapDefinition*>(decompressed.data()));
|
||||
}
|
||||
|
||||
shared_ptr<const MapDefinitionTrial> MapIndex::VersionedMap::trial() const {
|
||||
if (!this->trial_map) {
|
||||
this->trial_map.reset(new MapDefinitionTrial(*this->map));
|
||||
this->trial_map = make_shared<MapDefinitionTrial>(*this->map);
|
||||
}
|
||||
return this->trial_map;
|
||||
}
|
||||
@@ -2465,7 +2465,7 @@ MapIndex::MapIndex(const string& directory) {
|
||||
string compressed_data;
|
||||
shared_ptr<MapDefinition> decompressed_data;
|
||||
if (ends_with(filename, ".mnmd") || ends_with(filename, ".bind")) {
|
||||
decompressed_data.reset(new MapDefinition(load_object_file<MapDefinition>(directory + "/" + filename)));
|
||||
decompressed_data = make_shared<MapDefinition>(load_object_file<MapDefinition>(directory + "/" + filename));
|
||||
base_filename = filename.substr(0, filename.size() - 5);
|
||||
} else if (ends_with(filename, ".mnm") || ends_with(filename, ".bin")) {
|
||||
compressed_data = load_file(directory + "/" + filename);
|
||||
@@ -2502,9 +2502,9 @@ MapIndex::MapIndex(const string& directory) {
|
||||
|
||||
shared_ptr<VersionedMap> vm;
|
||||
if (decompressed_data) {
|
||||
vm.reset(new VersionedMap(decompressed_data, language));
|
||||
vm = make_shared<VersionedMap>(decompressed_data, language);
|
||||
} else if (!compressed_data.empty()) {
|
||||
vm.reset(new VersionedMap(std::move(compressed_data), language));
|
||||
vm = make_shared<VersionedMap>(std::move(compressed_data), language);
|
||||
} else {
|
||||
throw runtime_error("unknown map file format");
|
||||
}
|
||||
@@ -2512,7 +2512,7 @@ MapIndex::MapIndex(const string& directory) {
|
||||
string name = vm->map->name.decode(vm->language);
|
||||
auto map_it = this->maps.find(vm->map->map_number);
|
||||
if (map_it == this->maps.end()) {
|
||||
map_it = this->maps.emplace(vm->map->map_number, new Map(vm)).first;
|
||||
map_it = this->maps.emplace(vm->map->map_number, make_shared<Map>(vm)).first;
|
||||
static_game_data_log.info("(%s) Created Episode 3 map %08" PRIX32 " %c (%s; %s)",
|
||||
filename.c_str(),
|
||||
vm->map->map_number.load(),
|
||||
@@ -2640,7 +2640,7 @@ COMDeckIndex::COMDeckIndex(const string& filename) {
|
||||
try {
|
||||
auto json = JSON::parse(load_file(filename));
|
||||
for (const auto& def_json : json.as_list()) {
|
||||
auto& def = this->decks.emplace_back(new COMDeckDefinition());
|
||||
auto& def = this->decks.emplace_back(make_shared<COMDeckDefinition>());
|
||||
def->index = this->decks.size() - 1;
|
||||
def->player_name = def_json->at(0).as_string();
|
||||
def->deck_name = def_json->at(1).as_string();
|
||||
|
||||
@@ -1440,9 +1440,9 @@ public:
|
||||
const std::string& filename,
|
||||
const std::string& decompressed_filename,
|
||||
const std::string& text_filename = "",
|
||||
const std::string& deecompressed_text_filename = "",
|
||||
const std::string& decompressed_text_filename = "",
|
||||
const std::string& dice_text_filename = "",
|
||||
const std::string& deecompressed_dice_text_filename = "");
|
||||
const std::string& decompressed_dice_text_filename = "");
|
||||
|
||||
struct CardEntry {
|
||||
CardDefinition def;
|
||||
|
||||
@@ -48,10 +48,7 @@ void PlayerState::init() {
|
||||
throw logic_error("replacing a player state object is not permitted");
|
||||
}
|
||||
|
||||
this->deck_state.reset(new DeckState(
|
||||
this->client_id,
|
||||
s->deck_entries[client_id]->card_ids,
|
||||
s->options.random_crypt));
|
||||
this->deck_state = make_shared<DeckState>(this->client_id, s->deck_entries[client_id]->card_ids, s->options.random_crypt);
|
||||
if (s->map_and_rules->rules.disable_deck_shuffle) {
|
||||
this->deck_state->disable_shuffle();
|
||||
}
|
||||
@@ -77,10 +74,10 @@ void PlayerState::init() {
|
||||
throw runtime_error("SC card is not a Hunters or Arkz SC");
|
||||
}
|
||||
|
||||
this->hand_and_equip.reset(new HandAndEquipState());
|
||||
this->card_short_statuses.reset(new parray<CardShortStatus, 0x10>());
|
||||
this->set_card_action_chains.reset(new parray<ActionChainWithConds, 9>());
|
||||
this->set_card_action_metadatas.reset(new parray<ActionMetadata, 9>());
|
||||
this->hand_and_equip = make_shared<HandAndEquipState>();
|
||||
this->card_short_statuses = make_shared<parray<CardShortStatus, 0x10>>();
|
||||
this->set_card_action_chains = make_shared<parray<ActionChainWithConds, 9>>();
|
||||
this->set_card_action_metadatas = make_shared<parray<ActionMetadata, 9>>();
|
||||
|
||||
this->hand_and_equip->clear_FF();
|
||||
for (size_t z = 0; z < 0x10; z++) {
|
||||
@@ -91,11 +88,7 @@ void PlayerState::init() {
|
||||
this->set_card_action_metadatas->at(z).clear_FF();
|
||||
}
|
||||
|
||||
this->sc_card.reset(new Card(
|
||||
this->deck_state->sc_card_id(),
|
||||
this->sc_card_ref,
|
||||
this->client_id,
|
||||
s));
|
||||
this->sc_card = make_shared<Card>(this->deck_state->sc_card_id(), this->sc_card_ref, this->client_id, s);
|
||||
this->sc_card->init();
|
||||
this->draw_initial_hand();
|
||||
|
||||
@@ -1232,8 +1225,7 @@ bool PlayerState::set_card_from_hand(
|
||||
auto s = this->server();
|
||||
|
||||
if (!skip_error_checks_and_atk_sub) {
|
||||
int32_t code = this->error_code_for_client_setting_card(
|
||||
card_ref, card_index, loc, assist_target_client_id);
|
||||
int32_t code = this->error_code_for_client_setting_card(card_ref, card_index, loc, assist_target_client_id);
|
||||
if (code) {
|
||||
s->ruler_server->error_code1 = code;
|
||||
this->update_hand_and_equip_state_and_send_6xB4x02_if_needed();
|
||||
@@ -1248,8 +1240,7 @@ bool PlayerState::set_card_from_hand(
|
||||
}
|
||||
|
||||
if (!skip_error_checks_and_atk_sub) {
|
||||
int16_t cost = s->ruler_server->set_cost_for_card(
|
||||
this->client_id, card_ref);
|
||||
int16_t cost = s->ruler_server->set_cost_for_card(this->client_id, card_ref);
|
||||
this->subtract_atk_points(cost);
|
||||
}
|
||||
|
||||
@@ -1261,11 +1252,7 @@ bool PlayerState::set_card_from_hand(
|
||||
return 0;
|
||||
}
|
||||
this->card_refs[card_index + 1] = card_ref;
|
||||
this->set_cards[card_index - 7].reset(new Card(
|
||||
s->card_id_for_card_ref(card_ref),
|
||||
card_ref,
|
||||
this->client_id,
|
||||
s));
|
||||
this->set_cards[card_index - 7] = make_shared<Card>(s->card_id_for_card_ref(card_ref), card_ref, this->client_id, s);
|
||||
auto new_card = this->set_cards[card_index - 7];
|
||||
new_card->init();
|
||||
|
||||
|
||||
@@ -75,32 +75,32 @@ Server::~Server() noexcept(false) {
|
||||
}
|
||||
|
||||
void Server::init() {
|
||||
this->map_and_rules.reset(new MapAndRulesState());
|
||||
this->map_and_rules = make_shared<MapAndRulesState>();
|
||||
this->num_clients_present = 0;
|
||||
this->overlay_state.clear();
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
this->presence_entries[z].clear();
|
||||
this->deck_entries[z].reset(new DeckEntry());
|
||||
this->deck_entries[z] = make_shared<DeckEntry>();
|
||||
this->name_entries[z].clear();
|
||||
this->name_entries_valid[z] = false;
|
||||
}
|
||||
|
||||
this->card_special.reset(new CardSpecial(this->shared_from_this()));
|
||||
this->card_special = make_shared<CardSpecial>(this->shared_from_this());
|
||||
|
||||
// Note: The original implementation calls the default PSOV2Encryption
|
||||
// constructor for random_crypt, which just uses 0 as the seed. It then
|
||||
// re-seeds the generator later. We instead expect the caller to provide a
|
||||
// seeded generator, and we don't re-seed it at all.
|
||||
// this->random_crypt.reset(new PSOV2Encryption(0));
|
||||
// this->random_crypt = make_shared<PSOV2Encryption>(0);
|
||||
|
||||
this->state_flags.reset(new StateFlags());
|
||||
this->state_flags = make_shared<StateFlags>();
|
||||
|
||||
this->clear_player_flags_after_dice_phase();
|
||||
|
||||
this->update_battle_state_flags_and_send_6xB4x03_if_needed();
|
||||
|
||||
this->assist_server.reset(new AssistServer(this->shared_from_this()));
|
||||
this->ruler_server.reset(new RulerServer(this->shared_from_this()));
|
||||
this->assist_server = make_shared<AssistServer>(this->shared_from_this());
|
||||
this->ruler_server = make_shared<RulerServer>(this->shared_from_this());
|
||||
this->ruler_server->link_objects(this->map_and_rules, this->state_flags, this->assist_server);
|
||||
|
||||
this->send_6xB4x46();
|
||||
@@ -1403,7 +1403,7 @@ void Server::setup_and_start_battle() {
|
||||
if (!this->check_presence_entry(z)) {
|
||||
this->name_entries[z].clear();
|
||||
} else {
|
||||
this->player_states[z].reset(new PlayerState(z, this->shared_from_this()));
|
||||
this->player_states[z] = make_shared<PlayerState>(z, this->shared_from_this());
|
||||
this->player_states[z]->init();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ Tournament::PlayerEntry::PlayerEntry(uint32_t serial_number, const string& playe
|
||||
Tournament::PlayerEntry::PlayerEntry(shared_ptr<Client> c)
|
||||
: serial_number(c->license->serial_number),
|
||||
client(c),
|
||||
player_name(c->game_data.character()->disp.name.decode(c->language())) {}
|
||||
player_name(c->character()->disp.name.decode(c->language())) {}
|
||||
|
||||
Tournament::PlayerEntry::PlayerEntry(
|
||||
shared_ptr<const COMDeckDefinition> com_deck)
|
||||
@@ -364,10 +364,8 @@ void Tournament::init() {
|
||||
is_registration_complete = this->source_json.get_bool("is_registration_complete");
|
||||
|
||||
for (const auto& team_json : this->source_json.get_list("teams")) {
|
||||
auto& team = this->teams.emplace_back(new Team(
|
||||
this->shared_from_this(),
|
||||
this->teams.size(),
|
||||
team_json->get_int("max_players")));
|
||||
auto& team = this->teams.emplace_back(make_shared<Team>(
|
||||
this->shared_from_this(), this->teams.size(), team_json->get_int("max_players")));
|
||||
team->name = team_json->get_string("name");
|
||||
team->password = team_json->get_string("password");
|
||||
team_index_to_rounds_cleared.emplace_back(team_json->get_int("num_rounds_cleared"));
|
||||
@@ -806,7 +804,7 @@ TournamentIndex::TournamentIndex(
|
||||
}
|
||||
for (size_t z = 0; z < min<size_t>(json.size(), 0x20); z++) {
|
||||
if (!json.at(z).is_null()) {
|
||||
shared_ptr<Tournament> tourn(new Tournament(this->map_index, this->com_deck_index, json.at(z)));
|
||||
auto tourn = make_shared<Tournament>(this->map_index, this->com_deck_index, json.at(z));
|
||||
tourn->init();
|
||||
if (!this->name_to_tournament.emplace(tourn->get_name(), tourn).second) {
|
||||
throw runtime_error("multiple tournaments have the same name: " + tourn->get_name());
|
||||
@@ -820,7 +818,7 @@ TournamentIndex::TournamentIndex(
|
||||
throw runtime_error("tournament JSON dict length is incorrect");
|
||||
}
|
||||
for (const auto& it : json.as_dict()) {
|
||||
shared_ptr<Tournament> tourn(new Tournament(this->map_index, this->com_deck_index, *it.second));
|
||||
auto tourn = make_shared<Tournament>(this->map_index, this->com_deck_index, *it.second);
|
||||
tourn->init();
|
||||
if (!this->name_to_tournament.emplace(tourn->get_name(), tourn).second) {
|
||||
// This is logic_error instead of runtime_error because JSON dicts are
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "../Player.hh"
|
||||
#include "DataIndexes.hh"
|
||||
|
||||
struct Lobby;
|
||||
struct Client;
|
||||
class Client;
|
||||
struct ServerState;
|
||||
|
||||
namespace Episode3 {
|
||||
|
||||
@@ -14,7 +14,7 @@ FileContentsCache::File::File(
|
||||
string&& data,
|
||||
uint64_t load_time)
|
||||
: name(name),
|
||||
data(new string(std::move(data))),
|
||||
data(make_shared<string>(std::move(data))),
|
||||
load_time(load_time) {}
|
||||
|
||||
shared_ptr<const FileContentsCache::File> FileContentsCache::replace(
|
||||
@@ -22,7 +22,7 @@ shared_ptr<const FileContentsCache::File> FileContentsCache::replace(
|
||||
if (t == 0) {
|
||||
t = now();
|
||||
}
|
||||
shared_ptr<File> new_file(new File(name, std::move(data), t));
|
||||
auto new_file = make_shared<File>(name, std::move(data), t);
|
||||
auto emplace_ret = this->name_to_file.emplace(name, new_file);
|
||||
if (!emplace_ret.second) {
|
||||
emplace_ret.first->second = new_file;
|
||||
|
||||
+31
-16
@@ -127,9 +127,9 @@ shared_ptr<CompiledFunctionCode> compile_function_code(
|
||||
throw runtime_error("function compiler is not available");
|
||||
|
||||
#else
|
||||
shared_ptr<CompiledFunctionCode> ret(new CompiledFunctionCode());
|
||||
auto ret = make_shared<CompiledFunctionCode>();
|
||||
ret->arch = arch;
|
||||
ret->name = name;
|
||||
ret->short_name = name;
|
||||
ret->index = 0;
|
||||
ret->hide_from_patches_menu = false;
|
||||
|
||||
@@ -137,6 +137,22 @@ shared_ptr<CompiledFunctionCode> compile_function_code(
|
||||
auto assembled = PPC32Emulator::assemble(text, {directory});
|
||||
ret->code = std::move(assembled.code);
|
||||
ret->label_offsets = std::move(assembled.label_offsets);
|
||||
for (const auto& it : assembled.metadata_keys) {
|
||||
if (it.first == "hide_from_patches_menu") {
|
||||
ret->hide_from_patches_menu = true;
|
||||
} else if (it.first == "index") {
|
||||
if (it.second.size() != 1) {
|
||||
throw runtime_error("invalid index value in .meta directive");
|
||||
}
|
||||
ret->index = it.second[0];
|
||||
} else if (it.first == "name") {
|
||||
ret->long_name = it.second;
|
||||
} else if (it.first == "description") {
|
||||
ret->description = it.second;
|
||||
} else {
|
||||
throw runtime_error("unknown metadata key: " + it.first);
|
||||
}
|
||||
}
|
||||
} else if (arch == CompiledFunctionCode::Architecture::X86) {
|
||||
throw runtime_error("x86 assembler is not implemented");
|
||||
}
|
||||
@@ -145,10 +161,6 @@ shared_ptr<CompiledFunctionCode> compile_function_code(
|
||||
for (const auto& it : ret->label_offsets) {
|
||||
if (starts_with(it.first, "reloc")) {
|
||||
reloc_indexes.emplace(it.second / 4);
|
||||
} else if (starts_with(it.first, "newserv_index_")) {
|
||||
ret->index = stoul(it.first.substr(14), nullptr, 16);
|
||||
} else if (it.first == "hide_from_patches_menu") {
|
||||
ret->hide_from_patches_menu = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +200,7 @@ FunctionCodeIndex::FunctionCodeIndex(const string& directory) {
|
||||
|
||||
// Check for specific_version token
|
||||
uint32_t specific_version = 0;
|
||||
string patch_name = name;
|
||||
string short_name = name;
|
||||
if (is_patch &&
|
||||
(filename.size() >= 13) &&
|
||||
(filename[filename.size() - 13] == '.') &&
|
||||
@@ -197,14 +209,13 @@ FunctionCodeIndex::FunctionCodeIndex(const string& directory) {
|
||||
(filename[filename.size() - 10] == 'E' || filename[filename.size() - 10] == 'J' || filename[filename.size() - 10] == 'P') &&
|
||||
(isdigit(filename[filename.size() - 9]) || filename[filename.size() - 9] == 'T')) {
|
||||
specific_version = 0x33000000 | (filename[filename.size() - 11] << 16) | (filename[filename.size() - 10] << 8) | filename[filename.size() - 9];
|
||||
patch_name = filename.substr(0, filename.size() - 13);
|
||||
short_name = filename.substr(0, filename.size() - 13);
|
||||
}
|
||||
|
||||
try {
|
||||
string path = directory + "/" + filename;
|
||||
string text = load_file(path);
|
||||
auto code = compile_function_code(
|
||||
CompiledFunctionCode::Architecture::POWERPC, directory, name, text);
|
||||
auto code = compile_function_code(CompiledFunctionCode::Architecture::POWERPC, directory, name, text);
|
||||
if (code->index != 0) {
|
||||
if (!this->index_to_function.emplace(code->index, code).second) {
|
||||
throw runtime_error(string_printf(
|
||||
@@ -212,14 +223,14 @@ FunctionCodeIndex::FunctionCodeIndex(const string& directory) {
|
||||
}
|
||||
}
|
||||
code->specific_version = specific_version;
|
||||
code->patch_name = patch_name;
|
||||
code->short_name = short_name;
|
||||
this->name_to_function.emplace(name, code);
|
||||
if (is_patch) {
|
||||
code->menu_item_id = next_menu_item_id++;
|
||||
this->menu_item_id_and_specific_version_to_patch_function.emplace(
|
||||
static_cast<uint64_t>(code->menu_item_id) << 32 | specific_version, code);
|
||||
this->name_and_specific_version_to_patch_function.emplace(
|
||||
string_printf("%s-%08" PRIX32, patch_name.c_str(), specific_version), code);
|
||||
string_printf("%s-%08" PRIX32, short_name.c_str(), specific_version), code);
|
||||
}
|
||||
|
||||
string index_prefix = code->index ? string_printf("%02X => ", code->index) : "";
|
||||
@@ -236,12 +247,16 @@ FunctionCodeIndex::FunctionCodeIndex(const string& directory) {
|
||||
shared_ptr<const Menu> FunctionCodeIndex::patch_menu(uint32_t specific_version) const {
|
||||
auto suffix = string_printf("-%08" PRIX32, specific_version);
|
||||
|
||||
shared_ptr<Menu> ret(new Menu(MenuID::PATCHES, "Patches"));
|
||||
auto ret = make_shared<Menu>(MenuID::PATCHES, "Patches");
|
||||
ret->items.emplace_back(PatchesMenuItemID::GO_BACK, "Go back", "Return to the\nmain menu", 0);
|
||||
for (const auto& it : this->name_and_specific_version_to_patch_function) {
|
||||
const auto& fn = it.second;
|
||||
if (!fn->hide_from_patches_menu && ends_with(it.first, suffix)) {
|
||||
ret->items.emplace_back(fn->menu_item_id, fn->patch_name, "", MenuItem::Flag::REQUIRES_SEND_FUNCTION_CALL);
|
||||
ret->items.emplace_back(
|
||||
fn->menu_item_id,
|
||||
fn->long_name.empty() ? fn->short_name : fn->long_name,
|
||||
fn->description,
|
||||
MenuItem::Flag::REQUIRES_SEND_FUNCTION_CALL);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -266,7 +281,7 @@ DOLFileIndex::DOLFileIndex(const string& directory) {
|
||||
return;
|
||||
}
|
||||
|
||||
shared_ptr<Menu> menu(new Menu(MenuID::PROGRAMS, "Programs"));
|
||||
auto menu = make_shared<Menu>(MenuID::PROGRAMS, "Programs");
|
||||
this->menu = menu;
|
||||
menu->items.emplace_back(ProgramsMenuItemID::GO_BACK, "Go back", "Return to the\nmain menu", 0);
|
||||
|
||||
@@ -280,7 +295,7 @@ DOLFileIndex::DOLFileIndex(const string& directory) {
|
||||
string name = filename.substr(0, filename.size() - (is_compressed_dol ? 8 : 4));
|
||||
|
||||
try {
|
||||
shared_ptr<File> dol(new File());
|
||||
auto dol = make_shared<File>();
|
||||
dol->menu_item_id = next_menu_item_id++;
|
||||
dol->name = name;
|
||||
|
||||
|
||||
@@ -27,9 +27,10 @@ struct CompiledFunctionCode {
|
||||
std::vector<uint16_t> relocation_deltas;
|
||||
std::unordered_map<std::string, uint32_t> label_offsets;
|
||||
uint32_t entrypoint_offset_offset;
|
||||
std::string name;
|
||||
std::string patch_name; // Blank if not a patch
|
||||
uint32_t index; // 0 = unused (not registered in index_to_function)
|
||||
std::string short_name; // Based on filename
|
||||
std::string long_name; // From .meta name directive
|
||||
std::string description; // From .meta description directive
|
||||
uint8_t index; // 0 = unused (not registered in index_to_function)
|
||||
uint32_t menu_item_id;
|
||||
bool hide_from_patches_menu;
|
||||
uint32_t specific_version;
|
||||
@@ -60,7 +61,7 @@ struct FunctionCodeIndex {
|
||||
explicit FunctionCodeIndex(const std::string& directory);
|
||||
|
||||
std::unordered_map<std::string, std::shared_ptr<CompiledFunctionCode>> name_to_function;
|
||||
std::unordered_map<uint32_t, std::shared_ptr<CompiledFunctionCode>> index_to_function;
|
||||
std::unordered_map<uint8_t, std::shared_ptr<CompiledFunctionCode>> index_to_function;
|
||||
std::unordered_map<uint64_t, std::shared_ptr<CompiledFunctionCode>> menu_item_id_and_specific_version_to_patch_function;
|
||||
// Key here is e.g. "PATCHNAME-SPECIFICVERSION", with the latter in hex
|
||||
std::map<std::string, std::shared_ptr<CompiledFunctionCode>> name_and_specific_version_to_patch_function;
|
||||
|
||||
+137
-100
@@ -13,120 +13,130 @@ static inline uint16_t collapse_checksum(uint32_t sum) {
|
||||
return (sum & 0xFFFF) + (sum >> 16);
|
||||
}
|
||||
|
||||
FrameInfo::FrameInfo()
|
||||
: ether(nullptr),
|
||||
ether_protocol(0),
|
||||
ipv4(nullptr),
|
||||
arp(nullptr),
|
||||
udp(nullptr),
|
||||
tcp(nullptr),
|
||||
header_start(nullptr),
|
||||
payload(nullptr),
|
||||
total_size(0),
|
||||
tcp_options_size(0),
|
||||
payload_size(0) {}
|
||||
FrameInfo::FrameInfo(LinkType link_type, const string& data)
|
||||
: FrameInfo(link_type, data.data(), data.size()) {}
|
||||
|
||||
FrameInfo::FrameInfo(const string& data) : FrameInfo(data.data(), data.size()) {}
|
||||
FrameInfo::FrameInfo(LinkType link_type, const void* header_start, size_t size)
|
||||
: FrameInfo() {
|
||||
this->link_type = link_type;
|
||||
this->header_start = header_start;
|
||||
this->total_size = size;
|
||||
this->payload_size = size;
|
||||
|
||||
FrameInfo::FrameInfo(const void* header_start, size_t size)
|
||||
: ether(nullptr),
|
||||
ether_protocol(0),
|
||||
ipv4(nullptr),
|
||||
arp(nullptr),
|
||||
udp(nullptr),
|
||||
tcp(nullptr),
|
||||
header_start(header_start),
|
||||
payload(nullptr),
|
||||
total_size(size),
|
||||
tcp_options_size(0),
|
||||
payload_size(size) {
|
||||
StringReader r(header_start, size);
|
||||
|
||||
// Parse ethernet header
|
||||
if (this->payload_size < sizeof(EthernetHeader)) {
|
||||
throw invalid_argument("frame is too small for ethernet");
|
||||
}
|
||||
this->payload_size -= sizeof(EthernetHeader);
|
||||
this->ether = reinterpret_cast<const EthernetHeader*>(header_start);
|
||||
this->ether_protocol = this->ether->protocol;
|
||||
// Parse link-layer header
|
||||
Protocol proto = Protocol::NONE;
|
||||
switch (this->link_type) {
|
||||
case LinkType::ETHERNET:
|
||||
this->payload_size -= sizeof(EthernetHeader);
|
||||
this->ether = &r.get<EthernetHeader>();
|
||||
this->ether_protocol = this->ether->protocol;
|
||||
// Unwrap VLAN tags if necessary
|
||||
while ((this->ether_protocol == 0x8100) || (this->ether_protocol == 0x88A8)) {
|
||||
r.skip(2);
|
||||
this->ether_protocol = r.get_u16b();
|
||||
this->payload_size -= 4;
|
||||
}
|
||||
switch (this->ether_protocol) {
|
||||
case 0x0800:
|
||||
proto = Protocol::IPV4;
|
||||
break;
|
||||
case 0x0806:
|
||||
proto = Protocol::ARP;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
// Figure out the protocol
|
||||
const be_uint16_t* u16data = reinterpret_cast<const be_uint16_t*>(this->ether + 1);
|
||||
while ((this->ether_protocol == 0x8100) || (this->ether_protocol == 0x88A8)) {
|
||||
if (this->payload_size < 4) {
|
||||
throw invalid_argument("VLAN tags exceed frame size");
|
||||
}
|
||||
this->ether_protocol = u16data[1];
|
||||
u16data += 2;
|
||||
this->payload_size -= 4;
|
||||
case LinkType::HDLC:
|
||||
this->payload_size -= (sizeof(HDLCHeader) + 3); // Trim off checksum and end sentinel
|
||||
this->hdlc = &r.get<HDLCHeader>();
|
||||
this->hdlc_checksum = r.pget_u16b(r.where() + this->payload_size);
|
||||
switch (this->hdlc->protocol) {
|
||||
case 0xC021:
|
||||
proto = Protocol::LCP;
|
||||
break;
|
||||
case 0xC023:
|
||||
proto = Protocol::PAP;
|
||||
break;
|
||||
case 0x8021:
|
||||
proto = Protocol::IPCP;
|
||||
break;
|
||||
case 0x0021:
|
||||
proto = Protocol::IPV4;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
throw logic_error("invalid link type");
|
||||
}
|
||||
|
||||
// TODO: Some less-common protocols that we might want to support:
|
||||
// 0x8035 = RARP
|
||||
// 0x809B = AppleTalk
|
||||
// 0x80F3 = AppleTalk ARP
|
||||
// 0x8137 = IPX
|
||||
// 0x9000 = loopback
|
||||
|
||||
// Parse protocol headers if possible
|
||||
if (this->ether_protocol == 0x0800) { // IPv4
|
||||
if (this->payload_size < sizeof(IPv4Header)) {
|
||||
throw invalid_argument("frame is too small for ipv4 header");
|
||||
}
|
||||
this->ipv4 = reinterpret_cast<const IPv4Header*>(u16data);
|
||||
if (this->payload_size < this->ipv4->size) {
|
||||
throw invalid_argument("ipv4 header specifies size larger than frame");
|
||||
}
|
||||
this->payload_size = this->ipv4->size - sizeof(IPv4Header);
|
||||
|
||||
if (this->ipv4->protocol == 0x06) {
|
||||
if (this->payload_size < sizeof(TCPHeader)) {
|
||||
throw invalid_argument("frame is too small for tcp4 header");
|
||||
// Parse inner protocol headers
|
||||
switch (proto) {
|
||||
case Protocol::NONE:
|
||||
throw runtime_error("unknown protocol");
|
||||
case Protocol::LCP:
|
||||
this->payload_size -= sizeof(LCPHeader);
|
||||
this->lcp = &r.get<LCPHeader>();
|
||||
break;
|
||||
case Protocol::PAP:
|
||||
this->payload_size -= sizeof(PAPHeader);
|
||||
this->pap = &r.get<PAPHeader>();
|
||||
break;
|
||||
case Protocol::IPCP:
|
||||
this->payload_size -= sizeof(IPCPHeader);
|
||||
this->ipcp = &r.get<IPCPHeader>();
|
||||
break;
|
||||
case Protocol::IPV4:
|
||||
this->ipv4 = &r.get<IPv4Header>();
|
||||
if (this->payload_size < this->ipv4->size) {
|
||||
throw invalid_argument("ipv4 header specifies size larger than frame");
|
||||
}
|
||||
this->tcp = reinterpret_cast<const TCPHeader*>(this->ipv4 + 1);
|
||||
size_t tcp_header_size = (this->tcp->flags >> 12) * 4;
|
||||
if (tcp_header_size < sizeof(TCPHeader) || tcp_header_size > this->payload_size) {
|
||||
throw invalid_argument("frame is too small for tcp4 header with options");
|
||||
this->payload_size = this->ipv4->size - sizeof(IPv4Header);
|
||||
|
||||
if (this->ipv4->protocol == 0x06) {
|
||||
this->tcp = &r.get<TCPHeader>();
|
||||
size_t tcp_header_size = (this->tcp->flags >> 12) * 4;
|
||||
if (tcp_header_size < sizeof(TCPHeader) || tcp_header_size > this->payload_size) {
|
||||
throw invalid_argument("frame is too small for tcp4 header with options");
|
||||
}
|
||||
this->tcp_options_size = tcp_header_size - sizeof(TCPHeader);
|
||||
this->payload_size -= tcp_header_size;
|
||||
r.skip(tcp_header_size - sizeof(TCPHeader));
|
||||
|
||||
} else if (this->ipv4->protocol == 0x11) {
|
||||
this->payload_size -= sizeof(UDPHeader);
|
||||
this->udp = &r.get<UDPHeader>();
|
||||
}
|
||||
this->tcp_options_size = tcp_header_size - sizeof(TCPHeader);
|
||||
this->payload_size -= tcp_header_size;
|
||||
this->payload = reinterpret_cast<const uint8_t*>(this->tcp) + tcp_header_size;
|
||||
|
||||
} else if (this->ipv4->protocol == 0x11) {
|
||||
if (this->payload_size < sizeof(UDPHeader)) {
|
||||
throw invalid_argument("frame is too small for udp4 header");
|
||||
}
|
||||
this->payload_size -= sizeof(UDPHeader);
|
||||
this->udp = reinterpret_cast<const UDPHeader*>(this->ipv4 + 1);
|
||||
this->payload = this->udp + 1;
|
||||
|
||||
} else {
|
||||
this->payload = this->ipv4 + 1;
|
||||
}
|
||||
|
||||
} else if (this->ether_protocol == 0x0806) { // ARP
|
||||
if (this->payload_size < sizeof(const ARPHeader)) {
|
||||
throw invalid_argument("frame is too small for arp header");
|
||||
}
|
||||
this->payload_size -= sizeof(ARPHeader);
|
||||
this->arp = reinterpret_cast<const ARPHeader*>(u16data);
|
||||
this->payload = this->arp + 1;
|
||||
|
||||
} else {
|
||||
throw runtime_error("unknown protocol");
|
||||
break;
|
||||
case Protocol::ARP:
|
||||
this->payload_size -= sizeof(ARPHeader);
|
||||
this->arp = &r.get<ARPHeader>();
|
||||
break;
|
||||
}
|
||||
|
||||
this->payload = r.getv(this->payload_size);
|
||||
}
|
||||
|
||||
string FrameInfo::header_str() const {
|
||||
if (!this->ether) {
|
||||
if (!this->ether && !this->hdlc) {
|
||||
return "<invalid-frame-info>";
|
||||
}
|
||||
|
||||
string ret = string_printf(
|
||||
"%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX->%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX",
|
||||
this->ether->src_mac[0], this->ether->src_mac[1], this->ether->src_mac[2],
|
||||
this->ether->src_mac[3], this->ether->src_mac[4], this->ether->src_mac[5],
|
||||
this->ether->dest_mac[0], this->ether->dest_mac[1], this->ether->dest_mac[2],
|
||||
this->ether->dest_mac[3], this->ether->dest_mac[4], this->ether->dest_mac[5]);
|
||||
string ret;
|
||||
if (this->ether) {
|
||||
ret = string_printf(
|
||||
"ETHER:%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX->%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX",
|
||||
this->ether->src_mac[0], this->ether->src_mac[1], this->ether->src_mac[2],
|
||||
this->ether->src_mac[3], this->ether->src_mac[4], this->ether->src_mac[5],
|
||||
this->ether->dest_mac[0], this->ether->dest_mac[1], this->ether->dest_mac[2],
|
||||
this->ether->dest_mac[3], this->ether->dest_mac[4], this->ether->dest_mac[5]);
|
||||
} else if (this->hdlc) {
|
||||
ret = string_printf("HDLC:%02hhX/%02hhX", this->hdlc->address, this->hdlc->control);
|
||||
} else {
|
||||
return "<invalid-frame-info>";
|
||||
}
|
||||
|
||||
if (this->arp) {
|
||||
ret += string_printf(
|
||||
@@ -169,7 +179,11 @@ string FrameInfo::header_str() const {
|
||||
}
|
||||
|
||||
} else {
|
||||
ret += string_printf(",proto=%04hX", this->ether->protocol.load());
|
||||
if (this->ether) {
|
||||
ret += string_printf(",proto=%04hX", this->ether->protocol.load());
|
||||
} else if (this->hdlc) {
|
||||
ret += string_printf(",proto=%04hX", this->hdlc->protocol.load());
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -292,3 +306,26 @@ uint16_t FrameInfo::computed_tcp4_checksum() const {
|
||||
*this->ipv4, *this->tcp, this->tcp + 1,
|
||||
this->payload_size + this->tcp_options_size);
|
||||
}
|
||||
|
||||
uint16_t FrameInfo::computed_hdlc_checksum(const void* vdata, size_t size) {
|
||||
const uint8_t* data = reinterpret_cast<const uint8_t*>(vdata);
|
||||
uint16_t crc = 0xFFFF;
|
||||
for (size_t z = 0; z < size; z++) {
|
||||
crc ^= data[z];
|
||||
for (size_t b = 0; b < 8; b++) {
|
||||
crc = (crc & 1) ? ((crc >> 1) ^ 0x8408) : (crc >> 1);
|
||||
}
|
||||
}
|
||||
return ~crc;
|
||||
}
|
||||
|
||||
uint16_t FrameInfo::computed_hdlc_checksum() const {
|
||||
if (!this->hdlc) {
|
||||
throw logic_error("cannot compute HDLC checksum for non-HDLC frame");
|
||||
}
|
||||
return this->computed_hdlc_checksum(&this->hdlc->address, this->total_size - 4);
|
||||
}
|
||||
|
||||
uint16_t FrameInfo::stored_hdlc_checksum() const {
|
||||
return *reinterpret_cast<const le_uint16_t*>(reinterpret_cast<const uint8_t*>(this->header_start) + (this->total_size - 3));
|
||||
}
|
||||
|
||||
+80
-19
@@ -3,9 +3,35 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <phosg/Encoding.hh>
|
||||
#include <phosg/Strings.hh>
|
||||
|
||||
#include "Text.hh"
|
||||
|
||||
struct HDLCHeader {
|
||||
uint8_t start_sentinel1; // 0x7E
|
||||
uint8_t address; // 0xFF usually
|
||||
uint8_t control; // 0x03 for PPP
|
||||
be_uint16_t protocol;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct LCPHeader {
|
||||
uint8_t command;
|
||||
uint8_t request_id;
|
||||
be_uint16_t size;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct PAPHeader {
|
||||
uint8_t command;
|
||||
uint8_t request_id;
|
||||
be_uint16_t size;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct IPCPHeader {
|
||||
uint8_t command;
|
||||
uint8_t request_id;
|
||||
be_uint16_t size;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct EthernetHeader {
|
||||
parray<uint8_t, 6> dest_mac;
|
||||
parray<uint8_t, 6> src_mac;
|
||||
@@ -82,40 +108,75 @@ struct DHCPHeader {
|
||||
} __attribute__((packed));
|
||||
|
||||
struct FrameInfo {
|
||||
// This is always valid
|
||||
const EthernetHeader* ether;
|
||||
uint16_t ether_protocol;
|
||||
enum class LinkType {
|
||||
ETHERNET = 0,
|
||||
HDLC,
|
||||
};
|
||||
|
||||
enum class Protocol {
|
||||
NONE = 0,
|
||||
LCP,
|
||||
PAP,
|
||||
IPCP,
|
||||
IPV4,
|
||||
ARP,
|
||||
// TODO: Some less-common protocols that we might want to support:
|
||||
// Ether / HDLC = proto
|
||||
// 0x8035 / ?????? = RARP
|
||||
// 0x809B / 0x0029 = AppleTalk
|
||||
// 0x80F3 / ?????? = AppleTalk ARP
|
||||
// 0x8137 / 0x002B = IPX
|
||||
};
|
||||
|
||||
LinkType link_type = LinkType::ETHERNET;
|
||||
|
||||
// Exactly one of these headers is valid
|
||||
const EthernetHeader* ether = nullptr;
|
||||
uint16_t ether_protocol = 0;
|
||||
const HDLCHeader* hdlc = nullptr;
|
||||
uint16_t hdlc_checksum = 0;
|
||||
|
||||
// One of these may be non-null if hdlc is valid
|
||||
const LCPHeader* lcp = nullptr;
|
||||
const PAPHeader* pap = nullptr;
|
||||
const IPCPHeader* ipcp = nullptr;
|
||||
|
||||
// At most one of these is not null
|
||||
const IPv4Header* ipv4;
|
||||
const ARPHeader* arp;
|
||||
const IPv4Header* ipv4 = nullptr;
|
||||
const ARPHeader* arp = nullptr;
|
||||
|
||||
// One of these may be not null if this->ipv4 is not null
|
||||
const UDPHeader* udp;
|
||||
const TCPHeader* tcp;
|
||||
const UDPHeader* udp = nullptr;
|
||||
const TCPHeader* tcp = nullptr;
|
||||
|
||||
const void* header_start;
|
||||
const void* payload;
|
||||
size_t total_size;
|
||||
size_t tcp_options_size;
|
||||
size_t payload_size;
|
||||
const void* header_start = nullptr;
|
||||
const void* payload = nullptr;
|
||||
size_t total_size = 0;
|
||||
size_t tcp_options_size = 0;
|
||||
size_t payload_size = 0;
|
||||
|
||||
FrameInfo();
|
||||
FrameInfo(const std::string& data);
|
||||
FrameInfo(const void* data, size_t size);
|
||||
FrameInfo() = default;
|
||||
FrameInfo(LinkType link_type, const std::string& data);
|
||||
FrameInfo(LinkType link_type, const void* data, size_t size);
|
||||
|
||||
std::string header_str() const;
|
||||
|
||||
inline StringReader read_payload() const {
|
||||
return StringReader(this->payload, this->payload_size);
|
||||
}
|
||||
|
||||
void truncate(size_t new_total_size);
|
||||
|
||||
size_t size_from_header() const;
|
||||
|
||||
static uint16_t computed_ipv4_header_checksum(const IPv4Header& ipv4);
|
||||
uint16_t computed_ipv4_header_checksum() const;
|
||||
static uint16_t computed_udp4_checksum(
|
||||
const IPv4Header& ipv4, const UDPHeader& udp, const void* data, size_t size);
|
||||
static uint16_t computed_udp4_checksum(const IPv4Header& ipv4, const UDPHeader& udp, const void* data, size_t size);
|
||||
uint16_t computed_udp4_checksum() const;
|
||||
static uint16_t computed_tcp4_checksum(
|
||||
const IPv4Header& ip, const TCPHeader& tcp, const void* data, size_t size);
|
||||
static uint16_t computed_tcp4_checksum(const IPv4Header& ip, const TCPHeader& tcp, const void* data, size_t size);
|
||||
uint16_t computed_tcp4_checksum() const;
|
||||
|
||||
static uint16_t computed_hdlc_checksum(const void* data, size_t size);
|
||||
uint16_t computed_hdlc_checksum() const;
|
||||
uint16_t stored_hdlc_checksum() const;
|
||||
};
|
||||
|
||||
+494
-115
@@ -21,6 +21,65 @@ using namespace std;
|
||||
|
||||
static const size_t DEFAULT_RESEND_PUSH_USECS = 200000; // 200ms
|
||||
|
||||
static string unescape_hdlc_frame(const void* data, size_t size) {
|
||||
StringReader r(data, size);
|
||||
if (r.get_u8(data) != 0x7E) {
|
||||
throw runtime_error("HDLC frame does not begin with 7E");
|
||||
}
|
||||
string ret("\x7E", 1);
|
||||
|
||||
while (r.get_u8(false) != 0x7E) {
|
||||
uint8_t ch = r.get_u8();
|
||||
if (ch == 0x7D) {
|
||||
ch = r.get_u8();
|
||||
if (ch == 0x7E) {
|
||||
throw runtime_error("abort sequence received");
|
||||
}
|
||||
ret.push_back(ch ^ 0x20);
|
||||
} else {
|
||||
ret.push_back(ch);
|
||||
}
|
||||
}
|
||||
ret.push_back(0x7E);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static string unescape_hdlc_frame(const string& data) {
|
||||
return unescape_hdlc_frame(data.data(), data.size());
|
||||
}
|
||||
|
||||
static string escape_hdlc_frame(const void* data, size_t size, uint32_t escape_control_character_flags = 0xFFFFFFFF) {
|
||||
if (size < 2) {
|
||||
throw runtime_error("HDLC frame too small for start and end sentinels");
|
||||
}
|
||||
|
||||
StringReader r(data, size);
|
||||
if (r.pget_u8(size - 1) != 0x7E) {
|
||||
throw runtime_error("HDLC frame does not end with 7E");
|
||||
}
|
||||
r.truncate(size - 1);
|
||||
if (r.get_u8() != 0x7E) {
|
||||
throw runtime_error("HDLC frame does not begin with 7E");
|
||||
}
|
||||
string ret("\x7E", 1);
|
||||
|
||||
while (!r.eof()) {
|
||||
uint8_t ch = r.get_u8();
|
||||
if ((ch == 0x7D) || (ch == 0x7E) || ((ch < 0x20) && ((escape_control_character_flags >> ch) & 1))) {
|
||||
ret.push_back(0x7D);
|
||||
ret.push_back(ch ^ 0x20);
|
||||
} else {
|
||||
ret.push_back(ch);
|
||||
}
|
||||
}
|
||||
ret.push_back(0x7E);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static string escape_hdlc_frame(const string& data, uint32_t escape_control_character_flags = 0xFFFFFFFF) {
|
||||
return escape_hdlc_frame(data.data(), data.size(), escape_control_character_flags);
|
||||
}
|
||||
|
||||
// Note: these functions exist because seq nums are allowed to wrap around the
|
||||
// 32-bit integer space by design. We have to do the subtraction before the
|
||||
// comparison to allow integer overflow to occur if needed.
|
||||
@@ -51,8 +110,7 @@ string IPStackSimulator::str_for_ipv4_netloc(uint32_t addr, uint16_t port) {
|
||||
}
|
||||
}
|
||||
|
||||
string IPStackSimulator::str_for_tcp_connection(shared_ptr<const IPClient> c,
|
||||
const IPClient::TCPConnection& conn) {
|
||||
string IPStackSimulator::str_for_tcp_connection(shared_ptr<const IPClient> c, const IPClient::TCPConnection& conn) {
|
||||
uint64_t key = IPStackSimulator::tcp_conn_key_for_connection(conn);
|
||||
string server_netloc_str = str_for_ipv4_netloc(conn.server_addr, conn.server_port);
|
||||
string client_netloc_str = str_for_ipv4_netloc(c->ipv4_addr, conn.client_port);
|
||||
@@ -77,28 +135,28 @@ IPStackSimulator::~IPStackSimulator() {
|
||||
}
|
||||
}
|
||||
|
||||
void IPStackSimulator::listen(const string& name, const string& socket_path) {
|
||||
void IPStackSimulator::listen(const string& name, const string& socket_path, FrameInfo::LinkType link_type) {
|
||||
int fd = ::listen(socket_path, 0, SOMAXCONN);
|
||||
ip_stack_simulator_log.info("Listening on Unix socket %s on fd %d as %s", socket_path.c_str(), fd, name.c_str());
|
||||
this->add_socket(name, fd);
|
||||
this->add_socket(name, fd, link_type);
|
||||
}
|
||||
|
||||
void IPStackSimulator::listen(const string& name, const string& addr, int port) {
|
||||
void IPStackSimulator::listen(const string& name, const string& addr, int port, FrameInfo::LinkType link_type) {
|
||||
if (port == 0) {
|
||||
this->listen(name, addr);
|
||||
this->listen(name, addr, link_type);
|
||||
} else {
|
||||
int fd = ::listen(addr, port, SOMAXCONN);
|
||||
string netloc_str = render_netloc(addr, port);
|
||||
ip_stack_simulator_log.info("Listening on TCP interface %s on fd %d as %s", netloc_str.c_str(), fd, name.c_str());
|
||||
this->add_socket(name, fd);
|
||||
this->add_socket(name, fd, link_type);
|
||||
}
|
||||
}
|
||||
|
||||
void IPStackSimulator::listen(const string& name, int port) {
|
||||
this->listen(name, "", port);
|
||||
void IPStackSimulator::listen(const string& name, int port, FrameInfo::LinkType link_type) {
|
||||
this->listen(name, "", port, link_type);
|
||||
}
|
||||
|
||||
void IPStackSimulator::add_socket(const string& name, int fd) {
|
||||
void IPStackSimulator::add_socket(const string& name, int fd, FrameInfo::LinkType link_type) {
|
||||
unique_listener l(
|
||||
evconnlistener_new(
|
||||
this->base.get(),
|
||||
@@ -108,7 +166,7 @@ void IPStackSimulator::add_socket(const string& name, int fd) {
|
||||
0,
|
||||
fd),
|
||||
evconnlistener_free);
|
||||
this->listening_sockets.emplace(piecewise_construct, forward_as_tuple(fd), forward_as_tuple(name, std::move(l)));
|
||||
this->listening_sockets.emplace(piecewise_construct, forward_as_tuple(fd), forward_as_tuple(name, link_type, std::move(l)));
|
||||
}
|
||||
|
||||
uint32_t IPStackSimulator::connect_address_for_remote_address(uint32_t remote_addr) {
|
||||
@@ -122,9 +180,10 @@ uint32_t IPStackSimulator::connect_address_for_remote_address(uint32_t remote_ad
|
||||
}
|
||||
}
|
||||
|
||||
IPStackSimulator::IPClient::IPClient(shared_ptr<IPStackSimulator> sim, struct bufferevent* bev)
|
||||
IPStackSimulator::IPClient::IPClient(shared_ptr<IPStackSimulator> sim, FrameInfo::LinkType link_type, struct bufferevent* bev)
|
||||
: sim(sim),
|
||||
bev(bev, bufferevent_free),
|
||||
link_type(link_type),
|
||||
mac_addr(0),
|
||||
ipv4_addr(0),
|
||||
idle_timeout_event(event_new(sim->base.get(), -1, EV_TIMEOUT, &IPStackSimulator::IPClient::dispatch_on_idle_timeout, this), event_free) {
|
||||
@@ -196,7 +255,7 @@ void IPStackSimulator::on_listen_accept(struct evconnlistener* listener,
|
||||
|
||||
struct bufferevent* bev = bufferevent_socket_new(this->base.get(), fd,
|
||||
BEV_OPT_CLOSE_ON_FREE | BEV_OPT_DEFER_CALLBACKS);
|
||||
shared_ptr<IPClient> c(new IPClient(this->shared_from_this(), bev));
|
||||
auto c = make_shared<IPClient>(this->shared_from_this(), listening_socket->link_type, bev);
|
||||
this->bev_to_client.emplace(make_pair(bev, c));
|
||||
|
||||
bufferevent_setcb(bev, &IPStackSimulator::dispatch_on_client_input, nullptr,
|
||||
@@ -274,21 +333,143 @@ void IPStackSimulator::on_client_error(struct bufferevent* bev, short events) {
|
||||
}
|
||||
}
|
||||
|
||||
void IPStackSimulator::on_client_frame(
|
||||
shared_ptr<IPClient> c, const string& frame) {
|
||||
if (ip_stack_simulator_log.debug("Virtual network sent frame")) {
|
||||
print_data(stderr, frame);
|
||||
fputc('\n', stderr);
|
||||
}
|
||||
this->log_frame(frame);
|
||||
void IPStackSimulator::send_layer3_frame(shared_ptr<IPClient> c, FrameInfo::Protocol proto, const string& data) const {
|
||||
this->send_layer3_frame(c, proto, data.data(), data.size());
|
||||
}
|
||||
|
||||
FrameInfo fi(frame);
|
||||
void IPStackSimulator::send_layer3_frame(shared_ptr<IPClient> c, FrameInfo::Protocol proto, const void* data, size_t size) const {
|
||||
struct evbuffer* out_buf = bufferevent_get_output(c->bev.get());
|
||||
|
||||
switch (c->link_type) {
|
||||
case FrameInfo::LinkType::ETHERNET: {
|
||||
EthernetHeader ether;
|
||||
ether.dest_mac = c->mac_addr;
|
||||
ether.src_mac = this->host_mac_address_bytes;
|
||||
switch (proto) {
|
||||
case FrameInfo::Protocol::NONE:
|
||||
throw logic_error("layer 3 protocol not specified");
|
||||
case FrameInfo::Protocol::LCP:
|
||||
throw logic_error("cannot send LCP frame over Ethernet");
|
||||
case FrameInfo::Protocol::IPV4:
|
||||
ether.protocol = 0x0800;
|
||||
break;
|
||||
case FrameInfo::Protocol::ARP:
|
||||
ether.protocol = 0x0806;
|
||||
break;
|
||||
default:
|
||||
throw logic_error("unknown layer 3 protocol");
|
||||
}
|
||||
|
||||
le_uint16_t frame_size = size + sizeof(EthernetHeader);
|
||||
evbuffer_add(out_buf, &frame_size, 2);
|
||||
evbuffer_add(out_buf, ðer, sizeof(ether));
|
||||
evbuffer_add(out_buf, data, size);
|
||||
if (this->pcap_text_log_file) {
|
||||
StringWriter w;
|
||||
w.write(ðer, sizeof(ether));
|
||||
w.write(data, size);
|
||||
this->log_frame(w.str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case FrameInfo::LinkType::HDLC: {
|
||||
HDLCHeader hdlc;
|
||||
hdlc.start_sentinel1 = 0x7E;
|
||||
hdlc.address = 0xFF;
|
||||
hdlc.control = 0x03;
|
||||
switch (proto) {
|
||||
case FrameInfo::Protocol::NONE:
|
||||
throw logic_error("layer 3 protocol not specified");
|
||||
case FrameInfo::Protocol::LCP:
|
||||
hdlc.protocol = 0xC021;
|
||||
break;
|
||||
case FrameInfo::Protocol::PAP:
|
||||
hdlc.protocol = 0xC023;
|
||||
break;
|
||||
case FrameInfo::Protocol::IPCP:
|
||||
hdlc.protocol = 0x8021;
|
||||
break;
|
||||
case FrameInfo::Protocol::IPV4:
|
||||
hdlc.protocol = 0x0021;
|
||||
break;
|
||||
case FrameInfo::Protocol::ARP:
|
||||
throw runtime_error("cannot send ARP packets over HDLC");
|
||||
default:
|
||||
throw logic_error("unknown layer 3 protocol");
|
||||
}
|
||||
|
||||
StringWriter w;
|
||||
w.put(hdlc);
|
||||
w.write(data, size);
|
||||
w.put_u16l(FrameInfo::computed_hdlc_checksum(w.str().data() + 1, w.size() - 1));
|
||||
w.put_u8(0x7E);
|
||||
|
||||
string escaped = escape_hdlc_frame(w.str(), c->hdlc_escape_control_character_flags);
|
||||
if (ip_stack_simulator_log.debug("Sending HDLC frame to virtual network (escaped to %zX bytes)", escaped.size())) {
|
||||
print_data(stderr, w.str());
|
||||
}
|
||||
|
||||
le_uint16_t frame_size = escaped.size();
|
||||
evbuffer_add(out_buf, &frame_size, 2);
|
||||
evbuffer_add(out_buf, escaped.data(), escaped.size());
|
||||
if (this->pcap_text_log_file) {
|
||||
this->log_frame(escaped);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw logic_error("unknown link type");
|
||||
}
|
||||
}
|
||||
|
||||
void IPStackSimulator::on_client_frame(shared_ptr<IPClient> c, const string& frame) {
|
||||
const string* effective_data = &frame;
|
||||
string hdlc_unescaped_data;
|
||||
if (c->link_type == FrameInfo::LinkType::HDLC) {
|
||||
hdlc_unescaped_data = unescape_hdlc_frame(frame);
|
||||
effective_data = &hdlc_unescaped_data;
|
||||
}
|
||||
if (ip_stack_simulator_log.debug("Virtual network sent frame")) {
|
||||
print_data(stderr, *effective_data);
|
||||
}
|
||||
this->log_frame(*effective_data);
|
||||
|
||||
FrameInfo fi(c->link_type, *effective_data);
|
||||
if (ip_stack_simulator_log.should_log(LogLevel::DEBUG)) {
|
||||
string fi_header = fi.header_str();
|
||||
ip_stack_simulator_log.debug("Frame header: %s", fi_header.c_str());
|
||||
}
|
||||
|
||||
if (fi.arp) {
|
||||
if (fi.ether) {
|
||||
if (c->mac_addr.is_filled_with(0)) {
|
||||
c->mac_addr = fi.ether->src_mac;
|
||||
} else if ((fi.ether->src_mac != c->mac_addr) && (fi.ether->src_mac != this->broadcast_mac_address_bytes)) {
|
||||
throw runtime_error("client sent IPv4 packet from different MAC address");
|
||||
}
|
||||
} else if (fi.hdlc) {
|
||||
uint16_t expected_checksum = fi.computed_hdlc_checksum();
|
||||
uint16_t stored_checksum = fi.stored_hdlc_checksum();
|
||||
if (expected_checksum != stored_checksum) {
|
||||
throw runtime_error(string_printf(
|
||||
"HDLC checksum is incorrect (%04hX expected, %04hX received)",
|
||||
expected_checksum, stored_checksum));
|
||||
}
|
||||
} else {
|
||||
throw runtime_error("frame is not Ethernet or HDLC");
|
||||
}
|
||||
|
||||
if (fi.lcp) {
|
||||
this->on_client_lcp_frame(c, fi);
|
||||
|
||||
} else if (fi.pap) {
|
||||
this->on_client_pap_frame(c, fi);
|
||||
|
||||
} else if (fi.ipcp) {
|
||||
this->on_client_ipcp_frame(c, fi);
|
||||
|
||||
} else if (fi.arp) {
|
||||
this->on_client_arp_frame(c, fi);
|
||||
|
||||
} else if (fi.ipv4) {
|
||||
@@ -299,12 +480,6 @@ void IPStackSimulator::on_client_frame(
|
||||
expected_ipv4_checksum, fi.ipv4->checksum.load()));
|
||||
}
|
||||
|
||||
// Populate the client's addresses if needed
|
||||
if (c->mac_addr.is_filled_with(0)) {
|
||||
c->mac_addr = fi.ether->src_mac;
|
||||
} else if ((fi.ether->src_mac != c->mac_addr) && (fi.ether->src_mac != this->broadcast_mac_address_bytes)) {
|
||||
throw runtime_error("client sent IPv4 packet from different MAC address");
|
||||
}
|
||||
if ((fi.ipv4->src_addr != c->ipv4_addr) && (fi.ipv4->src_addr != 0)) {
|
||||
throw runtime_error("client sent IPv4 packet from different IPv4 address");
|
||||
}
|
||||
@@ -336,6 +511,261 @@ void IPStackSimulator::on_client_frame(
|
||||
}
|
||||
}
|
||||
|
||||
void IPStackSimulator::on_client_lcp_frame(shared_ptr<IPClient> c, const FrameInfo& fi) {
|
||||
switch (fi.lcp->command) {
|
||||
case 0x01: { // Configure-Request
|
||||
auto opts_r = fi.read_payload();
|
||||
while (!opts_r.eof()) {
|
||||
uint8_t opt = opts_r.get_u8();
|
||||
string opt_data = opts_r.read(opts_r.get_u8() - 2);
|
||||
StringReader opt_data_r(opt_data);
|
||||
switch (opt) {
|
||||
case 0x01: // Maximum receive unit
|
||||
// TODO: Currently we ignore this, but we probably should use it.
|
||||
opt_data_r.get_u16b();
|
||||
break;
|
||||
case 0x02: // Escaped control character flags
|
||||
c->hdlc_escape_control_character_flags = opt_data_r.get_u32b();
|
||||
break;
|
||||
case 0x05: // Magic-Number
|
||||
c->hdlc_remote_magic_number = opt_data_r.get_u32b();
|
||||
break;
|
||||
case 0x00: // RESERVED
|
||||
case 0x03: // Authentication protocol
|
||||
case 0x04: // Quality protocol
|
||||
case 0x07: // Protocol field compression
|
||||
case 0x08: // Address and control field compression
|
||||
throw runtime_error(string_printf("unimplemented LCP option %02hhX (%zu bytes)", opt, opt_data.size()));
|
||||
default:
|
||||
throw runtime_error("unknown LCP option");
|
||||
}
|
||||
}
|
||||
// Technically, we should implement the LCP state machine, but I'm too
|
||||
// lazy to do this right now. In our situation, it should suffice to
|
||||
// simply always send a Configure-Request to the client with a magic
|
||||
// number not equal to the one we received.
|
||||
StringWriter opts_w;
|
||||
opts_w.put_u8(0x01); // Maximum receive unit
|
||||
opts_w.put_u8(0x04);
|
||||
opts_w.put_u16b(1500);
|
||||
opts_w.put_u8(0x02); // Escaped control character flags (we don't require any)
|
||||
opts_w.put_u8(0x06);
|
||||
opts_w.put_u32(0);
|
||||
opts_w.put_u8(0x03); // Authentication protocol
|
||||
opts_w.put_u8(0x04);
|
||||
opts_w.put_u16b(0xC023); // Password authentication protocol
|
||||
opts_w.put_u8(0x05); // Magic number (bitwise inverse of the remote end's)
|
||||
opts_w.put_u8(0x06);
|
||||
opts_w.put_u32b(~c->hdlc_remote_magic_number);
|
||||
StringWriter request_w;
|
||||
request_w.put<LCPHeader>(LCPHeader{
|
||||
.command = 0x01, // Configure-Request
|
||||
.request_id = fi.lcp->request_id,
|
||||
.size = static_cast<uint16_t>(sizeof(LCPHeader) + opts_w.size()),
|
||||
});
|
||||
request_w.write(opts_w.str());
|
||||
this->send_layer3_frame(c, FrameInfo::Protocol::LCP, request_w.str());
|
||||
|
||||
StringWriter ack_w;
|
||||
ack_w.put<LCPHeader>(LCPHeader{
|
||||
.command = 0x02, // Configure-Ack
|
||||
.request_id = fi.lcp->request_id,
|
||||
.size = fi.lcp->size,
|
||||
});
|
||||
ack_w.write(fi.payload, fi.payload_size);
|
||||
this->send_layer3_frame(c, FrameInfo::Protocol::LCP, ack_w.str());
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x05: { // Terminate-Request
|
||||
c->ipv4_addr = 0;
|
||||
c->tcp_connections.clear();
|
||||
string response(reinterpret_cast<const char*>(fi.payload), fi.payload_size);
|
||||
response.at(0) = 0x06; // Terminate-Ack
|
||||
this->send_layer3_frame(c, FrameInfo::Protocol::LCP, response);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x09: { // Echo-Request
|
||||
string response(reinterpret_cast<const char*>(fi.payload), fi.payload_size);
|
||||
response.at(0) = 0x0A; // Echo-Reply
|
||||
this->send_layer3_frame(c, FrameInfo::Protocol::LCP, response);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x0B: // Discard-Request
|
||||
case 0x02: // Configure-Ack
|
||||
break;
|
||||
|
||||
case 0x03: // Configure-Nak
|
||||
case 0x04: // Configure-Reject
|
||||
case 0x06: // Terminate-Ack
|
||||
case 0x07: // Code-Reject
|
||||
case 0x08: // Protocol-Reject
|
||||
case 0x0A: // Echo-Reply
|
||||
throw runtime_error("unimplemented LCP command");
|
||||
default:
|
||||
throw runtime_error("unknown LCP command");
|
||||
}
|
||||
}
|
||||
|
||||
void IPStackSimulator::on_client_pap_frame(shared_ptr<IPClient> c, const FrameInfo& fi) {
|
||||
if (fi.pap->command != 0x01) { // Authenticate-Request
|
||||
throw runtime_error("client sent incorrect PAP command");
|
||||
}
|
||||
|
||||
auto r = fi.read_payload();
|
||||
string username = r.read(r.get_u8());
|
||||
string password = r.read(r.get_u8());
|
||||
ip_stack_simulator_log.info("Client logged in with username \"%s\" and password", username.c_str());
|
||||
|
||||
static const string login_message = "newserv PPP simulator";
|
||||
StringWriter w;
|
||||
w.put<PAPHeader>(PAPHeader{
|
||||
.command = 0x02, // Authenticate-Ack
|
||||
.request_id = fi.pap->request_id,
|
||||
.size = login_message.size() + sizeof(PAPHeader) + 1,
|
||||
});
|
||||
w.put_u8(login_message.size());
|
||||
w.write(login_message);
|
||||
this->send_layer3_frame(c, FrameInfo::Protocol::PAP, w.str());
|
||||
}
|
||||
|
||||
void IPStackSimulator::on_client_ipcp_frame(shared_ptr<IPClient> c, const FrameInfo& fi) {
|
||||
switch (fi.ipcp->command) {
|
||||
case 0x01: { // Configure-Request
|
||||
auto opts_r = fi.read_payload();
|
||||
|
||||
uint32_t remote_ip = 0;
|
||||
uint32_t remote_primary_dns = 0;
|
||||
uint32_t remote_secondary_dns = 0;
|
||||
StringWriter rejected_opts_w;
|
||||
while (!opts_r.eof()) {
|
||||
uint8_t opt = opts_r.get_u8();
|
||||
string opt_data = opts_r.read(opts_r.get_u8() - 2);
|
||||
StringReader opt_data_r(opt_data);
|
||||
switch (opt) {
|
||||
case 0x01: // IP addresses (deprecated as of 1992; we don't support it at all)
|
||||
throw runtime_error("IPCP client sent IP-Addresses option");
|
||||
case 0x02: // IP compression protocol
|
||||
rejected_opts_w.put_u8(0x02);
|
||||
rejected_opts_w.put_u8(opt_data_r.size() + 2);
|
||||
rejected_opts_w.write(opt_data);
|
||||
break;
|
||||
case 0x03: // IP address
|
||||
remote_ip = opt_data_r.get_u32b();
|
||||
break;
|
||||
case 0x81: // Primary DNS server address
|
||||
remote_primary_dns = opt_data_r.get_u32b();
|
||||
break;
|
||||
case 0x83: // Secondary DNS server address
|
||||
remote_secondary_dns = opt_data_r.get_u32b();
|
||||
break;
|
||||
case 0x82: // Primary NBNS server address
|
||||
case 0x84: // Secondary NBNS server address
|
||||
case 0x04: // Mobile IP address
|
||||
throw runtime_error(string_printf("unimplemented IPCP option %02hhX (%zu bytes)", opt, opt_data.size()));
|
||||
default:
|
||||
throw runtime_error("unknown IPCP option");
|
||||
}
|
||||
}
|
||||
|
||||
if (!rejected_opts_w.str().empty()) {
|
||||
// Send a Configure-Reject if the client specified IP header compression
|
||||
StringWriter reject_w;
|
||||
reject_w.put<IPCPHeader>(IPCPHeader{
|
||||
.command = 0x04, // Configure-Reject
|
||||
.request_id = fi.ipcp->request_id,
|
||||
.size = sizeof(IPCPHeader) + rejected_opts_w.size(),
|
||||
});
|
||||
reject_w.write(rejected_opts_w.str());
|
||||
this->send_layer3_frame(c, FrameInfo::Protocol::IPCP, reject_w.str());
|
||||
|
||||
} else if ((remote_ip != 0x1E1E1E1E) ||
|
||||
(remote_primary_dns != 0x23232323) ||
|
||||
(remote_secondary_dns != 0x24242424)) {
|
||||
// Send a Configure-Nak if the client's request doesn't exactly match
|
||||
// what we want them to use.
|
||||
StringWriter opts_w;
|
||||
opts_w.put_u8(0x03); // IP address
|
||||
opts_w.put_u8(0x06);
|
||||
opts_w.put_u32b(0x1E1E1E1E);
|
||||
opts_w.put_u8(0x81); // Primary DNS server address
|
||||
opts_w.put_u8(0x06);
|
||||
opts_w.put_u32b(0x23232323);
|
||||
opts_w.put_u8(0x83); // Secondary DNS server address
|
||||
opts_w.put_u8(0x06);
|
||||
opts_w.put_u32b(0x24242424);
|
||||
|
||||
StringWriter nak_w;
|
||||
nak_w.put<IPCPHeader>(IPCPHeader{
|
||||
.command = 0x03, // Configure-Nak
|
||||
.request_id = fi.ipcp->request_id,
|
||||
.size = static_cast<uint16_t>(opts_w.size() + sizeof(IPCPHeader)),
|
||||
});
|
||||
nak_w.write(opts_w.str());
|
||||
this->send_layer3_frame(c, FrameInfo::Protocol::IPCP, nak_w.str());
|
||||
|
||||
} else { // Options OK
|
||||
c->ipv4_addr = remote_ip;
|
||||
|
||||
// As with LCP, we technically should implement the state machine, but I
|
||||
// continue to be lazy.
|
||||
StringWriter opts_w;
|
||||
opts_w.put_u8(0x03); // IP address
|
||||
opts_w.put_u8(0x06);
|
||||
opts_w.put_u32b(0x39393939);
|
||||
opts_w.put_u8(0x81); // Primary DNS server address
|
||||
opts_w.put_u8(0x06);
|
||||
opts_w.put_u32b(0x23232323);
|
||||
opts_w.put_u8(0x83); // Secondary DNS server address
|
||||
opts_w.put_u8(0x06);
|
||||
opts_w.put_u32b(0x24242424);
|
||||
|
||||
StringWriter request_w;
|
||||
request_w.put<IPCPHeader>(IPCPHeader{
|
||||
.command = 0x01, // Configure-Request
|
||||
.request_id = fi.ipcp->request_id,
|
||||
.size = static_cast<uint16_t>(opts_w.size() + sizeof(IPCPHeader)),
|
||||
});
|
||||
request_w.write(opts_w.str());
|
||||
this->send_layer3_frame(c, FrameInfo::Protocol::IPCP, request_w.str());
|
||||
|
||||
StringWriter ack_w;
|
||||
ack_w.put<IPCPHeader>(IPCPHeader{
|
||||
.command = 0x02, // Configure-Ack
|
||||
.request_id = fi.ipcp->request_id,
|
||||
.size = fi.ipcp->size,
|
||||
});
|
||||
ack_w.write(fi.payload, fi.payload_size);
|
||||
this->send_layer3_frame(c, FrameInfo::Protocol::IPCP, ack_w.str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x05: { // Terminate-Request
|
||||
c->ipv4_addr = 0;
|
||||
c->tcp_connections.clear();
|
||||
string response(reinterpret_cast<const char*>(fi.payload), fi.payload_size);
|
||||
response.at(0) = 0x06; // Terminate-Ack
|
||||
this->send_layer3_frame(c, FrameInfo::Protocol::LCP, response);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x02: // Configure-Ack
|
||||
break;
|
||||
|
||||
case 0x03: // Configure-Nak
|
||||
case 0x04: // Configure-Reject
|
||||
case 0x06: // Terminate-Ack
|
||||
case 0x07: // Code-Reject
|
||||
throw runtime_error("unimplemented IPCP command");
|
||||
default:
|
||||
throw runtime_error("unknown LCP command");
|
||||
}
|
||||
}
|
||||
|
||||
void IPStackSimulator::on_client_arp_frame(
|
||||
shared_ptr<IPClient> c, const FrameInfo& fi) {
|
||||
if (fi.arp->hwaddr_len != 6 ||
|
||||
@@ -353,17 +783,14 @@ void IPStackSimulator::on_client_arp_frame(
|
||||
reinterpret_cast<const uint8_t*>(fi.payload) + 6);
|
||||
}
|
||||
|
||||
EthernetHeader r_ether;
|
||||
r_ether.dest_mac = fi.ether->src_mac;
|
||||
r_ether.src_mac = this->host_mac_address_bytes;
|
||||
r_ether.protocol = fi.ether->protocol;
|
||||
|
||||
ARPHeader r_arp;
|
||||
r_arp.hardware_type = fi.arp->hardware_type;
|
||||
r_arp.protocol_type = fi.arp->protocol_type;
|
||||
r_arp.hwaddr_len = 6;
|
||||
r_arp.paddr_len = 4;
|
||||
r_arp.operation = 0x0002;
|
||||
StringWriter w;
|
||||
w.put<ARPHeader>(ARPHeader{
|
||||
.hardware_type = fi.arp->hardware_type,
|
||||
.protocol_type = fi.arp->protocol_type,
|
||||
.hwaddr_len = 6,
|
||||
.paddr_len = 4,
|
||||
.operation = 0x0002,
|
||||
});
|
||||
|
||||
// The incoming payload is:
|
||||
// uint8_t src_mac[6]; // MAC address of client
|
||||
@@ -375,43 +802,19 @@ void IPStackSimulator::on_client_arp_frame(
|
||||
// uint8_t dest_ip[4]; // IP address of host
|
||||
// uint8_t src_mac[6]; // MAC address of client
|
||||
// uint8_t src_ip[4]; // IP address of client
|
||||
|
||||
const char* payload_bytes = reinterpret_cast<const char*>(fi.payload);
|
||||
w.write(this->host_mac_address_bytes.data(), 6);
|
||||
w.write(payload_bytes + 16, 4);
|
||||
w.write(payload_bytes, 10);
|
||||
|
||||
uint8_t r_payload[20];
|
||||
memcpy(&r_payload[0], this->host_mac_address_bytes.data(), 6);
|
||||
memcpy(&r_payload[6], payload_bytes + 16, 4);
|
||||
memcpy(&r_payload[10], payload_bytes, 10);
|
||||
|
||||
struct evbuffer* out_buf = bufferevent_get_output(c->bev.get());
|
||||
|
||||
uint16_t frame_size = sizeof(r_ether) + sizeof(r_arp) + sizeof(r_payload);
|
||||
evbuffer_add(out_buf, &frame_size, 2);
|
||||
evbuffer_add(out_buf, &r_ether, sizeof(r_ether));
|
||||
evbuffer_add(out_buf, &r_arp, sizeof(r_arp));
|
||||
evbuffer_add(out_buf, r_payload, sizeof(r_payload));
|
||||
|
||||
ip_stack_simulator_log.debug("Sending ARP response");
|
||||
|
||||
if (this->pcap_text_log_file) {
|
||||
StringWriter w;
|
||||
w.write(&r_ether, sizeof(r_ether));
|
||||
w.write(&r_arp, sizeof(r_arp));
|
||||
w.write(r_payload, sizeof(r_payload));
|
||||
this->log_frame(w.str());
|
||||
}
|
||||
this->send_layer3_frame(c, FrameInfo::Protocol::ARP, w.str());
|
||||
}
|
||||
|
||||
void IPStackSimulator::on_client_udp_frame(
|
||||
shared_ptr<IPClient> c, const FrameInfo& fi) {
|
||||
// We only implement DHCP and newserv's DNS server here
|
||||
void IPStackSimulator::on_client_udp_frame(shared_ptr<IPClient> c, const FrameInfo& fi) {
|
||||
// We only implement DHCP and newserv's DNS server here.
|
||||
|
||||
// Every received UDP packet will elicit exactly one UDP response from
|
||||
// newserv, so we prepare the response headers in advance
|
||||
EthernetHeader r_ether;
|
||||
r_ether.dest_mac = fi.ether->src_mac;
|
||||
r_ether.src_mac = this->host_mac_address_bytes;
|
||||
r_ether.protocol = fi.ether->protocol;
|
||||
|
||||
IPv4Header r_ipv4;
|
||||
r_ipv4.version_ihl = 0x45;
|
||||
@@ -433,7 +836,7 @@ void IPStackSimulator::on_client_udp_frame(
|
||||
|
||||
string r_data;
|
||||
if (fi.udp->dest_port == 67) { // DHCP
|
||||
StringReader r(fi.payload, fi.payload_size);
|
||||
auto r = fi.read_payload();
|
||||
const auto& dhcp = r.get<DHCPHeader>();
|
||||
if (dhcp.hardware_type != 1) {
|
||||
throw runtime_error("unknown DHCP hardware type");
|
||||
@@ -566,29 +969,18 @@ void IPStackSimulator::on_client_udp_frame(
|
||||
r_udp.checksum = FrameInfo::computed_udp4_checksum(
|
||||
r_ipv4, r_udp, r_data.data(), r_data.size());
|
||||
|
||||
struct evbuffer* out_buf = bufferevent_get_output(c->bev.get());
|
||||
|
||||
if (ip_stack_simulator_log.should_log(LogLevel::DEBUG)) {
|
||||
string remote_str = this->str_for_ipv4_netloc(fi.ipv4->src_addr, fi.udp->src_port);
|
||||
ip_stack_simulator_log.debug("Sending UDP response to %s", remote_str.c_str());
|
||||
print_data(stderr, r_data);
|
||||
}
|
||||
|
||||
uint16_t frame_size = sizeof(r_ether) + sizeof(r_ipv4) + sizeof(r_udp) + r_data.size();
|
||||
evbuffer_add(out_buf, &frame_size, 2);
|
||||
evbuffer_add(out_buf, &r_ether, sizeof(r_ether));
|
||||
evbuffer_add(out_buf, &r_ipv4, sizeof(r_ipv4));
|
||||
evbuffer_add(out_buf, &r_udp, sizeof(r_udp));
|
||||
evbuffer_add(out_buf, r_data.data(), r_data.size());
|
||||
StringWriter w;
|
||||
w.put(r_ipv4);
|
||||
w.put(r_udp);
|
||||
w.write(r_data);
|
||||
|
||||
if (this->pcap_text_log_file) {
|
||||
StringWriter w;
|
||||
w.write(&r_ether, sizeof(r_ether));
|
||||
w.write(&r_ipv4, sizeof(r_ipv4));
|
||||
w.write(&r_udp, sizeof(r_udp));
|
||||
w.write(r_data.data(), r_data.size());
|
||||
this->log_frame(w.str());
|
||||
}
|
||||
this->send_layer3_frame(c, FrameInfo::Protocol::IPV4, w.str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -863,8 +1255,7 @@ void IPStackSimulator::on_client_tcp_frame(
|
||||
}
|
||||
}
|
||||
|
||||
void IPStackSimulator::open_server_connection(
|
||||
shared_ptr<IPClient> c, IPClient::TCPConnection& conn) {
|
||||
void IPStackSimulator::open_server_connection(shared_ptr<IPClient> c, IPClient::TCPConnection& conn) {
|
||||
if (conn.server_bev.get()) {
|
||||
throw logic_error("server connection is already open");
|
||||
}
|
||||
@@ -913,20 +1304,25 @@ void IPStackSimulator::open_server_connection(
|
||||
}
|
||||
}
|
||||
|
||||
void IPStackSimulator::send_pending_push_frame(
|
||||
shared_ptr<IPClient> c, IPClient::TCPConnection& conn) {
|
||||
void IPStackSimulator::send_pending_push_frame(shared_ptr<IPClient> c, IPClient::TCPConnection& conn) {
|
||||
size_t pending_bytes = evbuffer_get_length(conn.pending_data.get());
|
||||
if (!pending_bytes) {
|
||||
return;
|
||||
}
|
||||
|
||||
size_t bytes_to_send = min<size_t>(pending_bytes, conn.next_push_max_frame_size);
|
||||
if ((c->link_type == FrameInfo::LinkType::HDLC) && (bytes_to_send > 200)) {
|
||||
// There is a bug in Dolphin's modem implementation (which I wrote, so it's
|
||||
// my fault) that causes commands to be dropped when too much data is sent
|
||||
// at once. To work around this, we only send up to 200 bytes in each push
|
||||
// frame.
|
||||
bytes_to_send = 200;
|
||||
}
|
||||
|
||||
ip_stack_simulator_log.debug("Sending PSH frame with seq_num %08" PRIX32 ", 0x%zX/0x%zX data bytes",
|
||||
conn.acked_server_seq, bytes_to_send, pending_bytes);
|
||||
|
||||
this->send_tcp_frame(c, conn, TCPHeader::Flag::PSH, conn.pending_data.get(),
|
||||
bytes_to_send);
|
||||
this->send_tcp_frame(c, conn, TCPHeader::Flag::PSH, conn.pending_data.get(), bytes_to_send);
|
||||
struct timeval resend_push_timeout = usecs_to_timeval(conn.resend_push_usecs);
|
||||
event_add(conn.resend_push_event.get(), &resend_push_timeout);
|
||||
|
||||
@@ -953,11 +1349,6 @@ void IPStackSimulator::send_tcp_frame(
|
||||
throw logic_error("data should be given if and only if PSH is given");
|
||||
}
|
||||
|
||||
EthernetHeader ether;
|
||||
ether.dest_mac = c->mac_addr;
|
||||
ether.src_mac = this->host_mac_address_bytes;
|
||||
ether.protocol = 0x0800; // IPv4
|
||||
|
||||
IPv4Header ipv4;
|
||||
ipv4.version_ihl = 0x45;
|
||||
ipv4.tos = 0;
|
||||
@@ -984,28 +1375,16 @@ void IPStackSimulator::send_tcp_frame(
|
||||
ipv4.checksum = FrameInfo::computed_ipv4_header_checksum(ipv4);
|
||||
|
||||
const void* linear_data = src_bytes ? evbuffer_pullup(src_buf, src_bytes) : nullptr;
|
||||
tcp.checksum = FrameInfo::computed_tcp4_checksum(
|
||||
ipv4, tcp, linear_data, src_bytes);
|
||||
tcp.checksum = FrameInfo::computed_tcp4_checksum(ipv4, tcp, linear_data, src_bytes);
|
||||
|
||||
struct evbuffer* out_buf = bufferevent_get_output(c->bev.get());
|
||||
|
||||
uint16_t frame_size = sizeof(ether) + sizeof(ipv4) + sizeof(tcp) + src_bytes;
|
||||
evbuffer_add(out_buf, &frame_size, 2);
|
||||
evbuffer_add(out_buf, ðer, sizeof(ether));
|
||||
evbuffer_add(out_buf, &ipv4, sizeof(ipv4));
|
||||
evbuffer_add(out_buf, &tcp, sizeof(tcp));
|
||||
StringWriter w;
|
||||
w.put(ipv4);
|
||||
w.put(tcp);
|
||||
if (src_bytes) {
|
||||
evbuffer_add(out_buf, linear_data, src_bytes);
|
||||
w.write(linear_data, src_bytes);
|
||||
}
|
||||
|
||||
if (this->pcap_text_log_file) {
|
||||
StringWriter w;
|
||||
w.write(ðer, sizeof(ether));
|
||||
w.write(&ipv4, sizeof(ipv4));
|
||||
w.write(&tcp, sizeof(tcp));
|
||||
w.write(linear_data, src_bytes);
|
||||
this->log_frame(w.str());
|
||||
}
|
||||
this->send_layer3_frame(c, FrameInfo::Protocol::IPV4, w.str());
|
||||
}
|
||||
|
||||
void IPStackSimulator::dispatch_on_resend_push(evutil_socket_t, short, void* ctx) {
|
||||
|
||||
+20
-7
@@ -1,3 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -19,10 +21,10 @@ public:
|
||||
std::shared_ptr<ServerState> state);
|
||||
~IPStackSimulator();
|
||||
|
||||
void listen(const std::string& name, const std::string& socket_path);
|
||||
void listen(const std::string& name, const std::string& addr, int port);
|
||||
void listen(const std::string& name, int port);
|
||||
void add_socket(const std::string& name, int fd);
|
||||
void listen(const std::string& name, const std::string& socket_path, FrameInfo::LinkType link_type);
|
||||
void listen(const std::string& name, const std::string& addr, int port, FrameInfo::LinkType link_type);
|
||||
void listen(const std::string& name, int port, FrameInfo::LinkType link_type);
|
||||
void add_socket(const std::string& name, int fd, FrameInfo::LinkType link_type);
|
||||
|
||||
static uint32_t connect_address_for_remote_address(uint32_t remote_addr);
|
||||
|
||||
@@ -39,7 +41,10 @@ private:
|
||||
std::weak_ptr<IPStackSimulator> sim;
|
||||
|
||||
unique_bufferevent bev;
|
||||
parray<uint8_t, 6> mac_addr;
|
||||
FrameInfo::LinkType link_type;
|
||||
uint32_t hdlc_escape_control_character_flags = 0xFFFFFFFF;
|
||||
uint32_t hdlc_remote_magic_number = 0;
|
||||
parray<uint8_t, 6> mac_addr; // Only used for LinkType::ETHERNET
|
||||
uint32_t ipv4_addr;
|
||||
|
||||
struct TCPConnection {
|
||||
@@ -75,7 +80,7 @@ private:
|
||||
|
||||
unique_event idle_timeout_event;
|
||||
|
||||
IPClient(std::shared_ptr<IPStackSimulator> sim, struct bufferevent* bev);
|
||||
IPClient(std::shared_ptr<IPStackSimulator> sim, FrameInfo::LinkType link_type, struct bufferevent* bev);
|
||||
|
||||
static void dispatch_on_idle_timeout(evutil_socket_t fd, short events, void* ctx);
|
||||
void on_idle_timeout();
|
||||
@@ -83,10 +88,12 @@ private:
|
||||
|
||||
struct ListeningSocket {
|
||||
std::string name;
|
||||
FrameInfo::LinkType link_type;
|
||||
unique_listener listener;
|
||||
|
||||
ListeningSocket(const std::string& name, unique_listener&& l)
|
||||
ListeningSocket(const std::string& name, FrameInfo::LinkType link_type, unique_listener&& l)
|
||||
: name(name),
|
||||
link_type(link_type),
|
||||
listener(std::move(l)) {}
|
||||
};
|
||||
|
||||
@@ -120,7 +127,13 @@ private:
|
||||
static void dispatch_on_client_error(struct bufferevent* bev, short events, void* ctx);
|
||||
void on_client_error(struct bufferevent* bev, short events);
|
||||
|
||||
void send_layer3_frame(std::shared_ptr<IPClient> c, FrameInfo::Protocol proto, const std::string& data) const;
|
||||
void send_layer3_frame(std::shared_ptr<IPClient> c, FrameInfo::Protocol proto, const void* data, size_t size) const;
|
||||
|
||||
void on_client_frame(std::shared_ptr<IPClient> c, const std::string& frame);
|
||||
void on_client_lcp_frame(std::shared_ptr<IPClient> c, const FrameInfo& fi);
|
||||
void on_client_pap_frame(std::shared_ptr<IPClient> c, const FrameInfo& fi);
|
||||
void on_client_ipcp_frame(std::shared_ptr<IPClient> c, const FrameInfo& fi);
|
||||
void on_client_arp_frame(std::shared_ptr<IPClient> c, const FrameInfo& fi);
|
||||
void on_client_udp_frame(std::shared_ptr<IPClient> c, const FrameInfo& fi);
|
||||
void on_client_tcp_frame(std::shared_ptr<IPClient> c, const FrameInfo& fi);
|
||||
|
||||
+64
-38
@@ -3,6 +3,8 @@
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
|
||||
#include "Loggers.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
static const array<uint8_t, 10> favored_weapon_by_section_id = {
|
||||
@@ -23,7 +25,7 @@ ItemCreator::ItemCreator(
|
||||
uint8_t section_id,
|
||||
uint32_t random_seed,
|
||||
shared_ptr<const BattleRules> restrictions)
|
||||
: log(string_printf("[ItemCreator:%s/%s/%s/%c/%hhu] ", name_for_enum(version), abbreviation_for_episode(episode), abbreviation_for_mode(mode), abbreviation_for_difficulty(difficulty), section_id)),
|
||||
: log(string_printf("[ItemCreator:%s/%s/%s/%c/%hhu] ", name_for_enum(version), abbreviation_for_episode(episode), abbreviation_for_mode(mode), abbreviation_for_difficulty(difficulty), section_id), lobby_log.min_level),
|
||||
version(version),
|
||||
episode(episode),
|
||||
mode(mode),
|
||||
@@ -41,6 +43,23 @@ ItemCreator::ItemCreator(
|
||||
this->generate_unit_stars_tables();
|
||||
}
|
||||
|
||||
void ItemCreator::set_random_state(uint32_t seed, uint32_t absolute_offset) {
|
||||
if ((this->random_crypt.seed() != seed) || (this->random_crypt.absolute_offset() > absolute_offset)) {
|
||||
this->random_crypt = PSOV2Encryption(seed);
|
||||
}
|
||||
while (this->random_crypt.absolute_offset() < absolute_offset) {
|
||||
this->random_crypt.next();
|
||||
}
|
||||
}
|
||||
|
||||
void ItemCreator::set_box_destroyed(uint16_t entity_id) {
|
||||
this->destroyed_boxes.emplace(entity_id);
|
||||
}
|
||||
|
||||
void ItemCreator::set_monster_destroyed(uint16_t entity_id) {
|
||||
this->destroyed_monsters.emplace(entity_id);
|
||||
}
|
||||
|
||||
void ItemCreator::clear_destroyed_entities() {
|
||||
this->destroyed_monsters.clear();
|
||||
this->destroyed_boxes.clear();
|
||||
@@ -116,15 +135,15 @@ uint8_t ItemCreator::normalize_area_number(uint8_t area) const {
|
||||
}
|
||||
|
||||
ItemData ItemCreator::on_box_item_drop(uint16_t entity_id, uint8_t area) {
|
||||
return this->destroyed_boxes.emplace(entity_id).second
|
||||
? this->on_box_item_drop_with_area_norm(this->normalize_area_number(area))
|
||||
: ItemData();
|
||||
return this->destroyed_boxes.count(entity_id)
|
||||
? ItemData()
|
||||
: this->on_box_item_drop_with_area_norm(this->normalize_area_number(area));
|
||||
}
|
||||
|
||||
ItemData ItemCreator::on_monster_item_drop(uint16_t entity_id, uint32_t enemy_type, uint8_t area) {
|
||||
return this->destroyed_monsters.emplace(entity_id).second
|
||||
? this->on_monster_item_drop_with_area_norm(enemy_type, this->normalize_area_number(area))
|
||||
: ItemData();
|
||||
return this->destroyed_monsters.count(entity_id)
|
||||
? ItemData()
|
||||
: this->on_monster_item_drop_with_area_norm(enemy_type, this->normalize_area_number(area));
|
||||
}
|
||||
|
||||
ItemData ItemCreator::on_box_item_drop_with_area_norm(uint8_t area_norm) {
|
||||
@@ -132,7 +151,7 @@ ItemData ItemCreator::on_box_item_drop_with_area_norm(uint8_t area_norm) {
|
||||
area_norm, this->random_crypt.seed(), this->random_crypt.absolute_offset());
|
||||
ItemData item = this->check_rare_specs_and_create_rare_box_item(area_norm);
|
||||
if (item.empty()) {
|
||||
uint8_t item_class = this->get_rand_from_weighted_tables_2d_vertical(this->pt->box_item_class_prob_table(), area_norm);
|
||||
uint8_t item_class = this->get_rand_from_weighted_tables_2d_vertical(this->pt->box_item_class_prob_table, area_norm);
|
||||
this->log.info("Item class is %02hhX", item_class);
|
||||
switch (item_class) {
|
||||
case 0: // Weapon
|
||||
@@ -175,11 +194,13 @@ ItemData ItemCreator::on_monster_item_drop_with_area_norm(uint32_t enemy_type, u
|
||||
}
|
||||
this->log.info("Enemy type: %" PRIX32 "; random state: %08" PRIX32 " %08" PRIX32, enemy_type, this->random_crypt.seed(), this->random_crypt.absolute_offset());
|
||||
|
||||
uint8_t type_drop_prob = this->pt->enemy_type_drop_probs().at(enemy_type);
|
||||
uint8_t type_drop_prob = this->pt->enemy_type_drop_probs.at(enemy_type);
|
||||
uint8_t drop_sample = this->rand_int(100);
|
||||
if (drop_sample >= type_drop_prob) {
|
||||
this->log.info("Drop not chosen (%hhu >= %hhu)", drop_sample, type_drop_prob);
|
||||
return ItemData();
|
||||
} else {
|
||||
this->log.info("Drop chosen (%hhu < %hhu)", drop_sample, type_drop_prob);
|
||||
}
|
||||
|
||||
ItemData item = this->check_rare_spec_and_create_rare_enemy_item(enemy_type, area_norm);
|
||||
@@ -198,7 +219,7 @@ ItemData ItemCreator::on_monster_item_drop_with_area_norm(uint32_t enemy_type, u
|
||||
item_class = 4;
|
||||
break;
|
||||
case 2:
|
||||
item_class = this->pt->enemy_item_classes().at(enemy_type);
|
||||
item_class = this->pt->enemy_item_classes.at(enemy_type);
|
||||
break;
|
||||
default:
|
||||
throw logic_error("invalid item class determinant");
|
||||
@@ -224,7 +245,7 @@ ItemData ItemCreator::on_monster_item_drop_with_area_norm(uint32_t enemy_type, u
|
||||
break;
|
||||
case 5: // Meseta
|
||||
item.data1[0] = 0x04;
|
||||
item.data2d = this->choose_meseta_amount(this->pt->enemy_meseta_ranges(), enemy_type) & 0xFFFF;
|
||||
item.data2d = this->choose_meseta_amount(this->pt->enemy_meseta_ranges, enemy_type) & 0xFFFF;
|
||||
break;
|
||||
default:
|
||||
return item;
|
||||
@@ -277,12 +298,16 @@ uint32_t ItemCreator::choose_meseta_amount(
|
||||
|
||||
// Note: The original code seems like it has a bug here: it compares to 0xFF
|
||||
// instead of 0xFFFF (and returns 0xFF if either limit matches 0xFF).
|
||||
uint32_t ret = 0;
|
||||
if (((min == 0xFFFF) || (max == 0xFFFF)) || (max < min)) {
|
||||
return 0xFFFF;
|
||||
ret = 0xFFFF;
|
||||
} else if (min != max) {
|
||||
return this->rand_int((max - min) + 1) + min;
|
||||
ret = this->rand_int((max - min) + 1) + min;
|
||||
} else {
|
||||
ret = min;
|
||||
}
|
||||
return min;
|
||||
this->log.info("Chose %" PRIu32 " Meseta from range [%hu, %hu]", ret, min, max);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ItemCreator::should_allow_meseta_drops() const {
|
||||
@@ -329,7 +354,7 @@ ItemData ItemCreator::check_rate_and_create_rare_item(const RareItemSet::Expande
|
||||
item.data1[2] = drop.item_code[2];
|
||||
switch (item.data1[0]) {
|
||||
case 0:
|
||||
if (this->pt->has_rare_bonus_value_prob_table()) {
|
||||
if (this->pt->has_rare_bonus_value_prob_table) {
|
||||
this->generate_rare_weapon_bonuses(item, this->rand_int(10));
|
||||
} else {
|
||||
this->generate_common_weapon_bonuses(item, area_norm);
|
||||
@@ -362,13 +387,13 @@ void ItemCreator::generate_rare_weapon_bonuses(ItemData& item, uint32_t random_s
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this->pt->has_rare_bonus_value_prob_table()) {
|
||||
if (!this->pt->has_rare_bonus_value_prob_table) {
|
||||
throw logic_error("generate_rare_weapon_bonuses called for common item table without rare bonus value probability table");
|
||||
}
|
||||
|
||||
for (size_t z = 0; z < 6; z += 2) {
|
||||
uint8_t bonus_type = this->get_rand_from_weighted_tables_2d_vertical(this->pt->bonus_type_prob_table(), random_sample);
|
||||
int16_t bonus_value = this->get_rand_from_weighted_tables_2d_vertical(this->pt->bonus_value_prob_table(), 5);
|
||||
uint8_t bonus_type = this->get_rand_from_weighted_tables_2d_vertical(this->pt->bonus_type_prob_table, random_sample);
|
||||
int16_t bonus_value = this->get_rand_from_weighted_tables_2d_vertical(this->pt->bonus_value_prob_table, 5);
|
||||
item.data1[z + 6] = bonus_type;
|
||||
item.data1[z + 7] = bonus_value * 5 - 10;
|
||||
// Note: The original code has a special case here, which divides
|
||||
@@ -386,12 +411,12 @@ void ItemCreator::generate_common_weapon_bonuses(ItemData& item, uint8_t area_no
|
||||
}
|
||||
|
||||
for (size_t row = 0; row < 3; row++) {
|
||||
uint8_t spec = this->pt->nonrare_bonus_prob_spec().at(row).at(area_norm);
|
||||
uint8_t spec = this->pt->nonrare_bonus_prob_spec.at(row).at(area_norm);
|
||||
if (spec == 0xFF) {
|
||||
this->log.info("Bonus %zu is forbidden", row);
|
||||
} else {
|
||||
item.data1[(row * 2) + 6] = this->get_rand_from_weighted_tables_2d_vertical(this->pt->bonus_type_prob_table(), area_norm);
|
||||
int16_t amount = this->get_rand_from_weighted_tables_2d_vertical(this->pt->bonus_value_prob_table(), spec);
|
||||
item.data1[(row * 2) + 6] = this->get_rand_from_weighted_tables_2d_vertical(this->pt->bonus_type_prob_table, area_norm);
|
||||
int16_t amount = this->get_rand_from_weighted_tables_2d_vertical(this->pt->bonus_value_prob_table, spec);
|
||||
item.data1[(row * 2) + 7] = amount * 5 - 10;
|
||||
this->log.info("Bonus %zu generated as %02hhX %02hhX from area_norm %02hhX and spec %02hhX", row, item.data1[(row * 2) + 6], item.data1[(row * 2) + 7], area_norm, spec);
|
||||
}
|
||||
@@ -560,7 +585,7 @@ void ItemCreator::generate_common_item_variances(uint32_t area_norm, ItemData& i
|
||||
break;
|
||||
case 1:
|
||||
if (item.data1[1] == 3) {
|
||||
float f1 = 1.0 + this->pt->unit_max_stars_table().at(area_norm);
|
||||
float f1 = 1.0 + this->pt->unit_max_stars_table.at(area_norm);
|
||||
float f2 = this->rand_float_0_1_from_crypt();
|
||||
uint8_t stars = static_cast<uint32_t>(f1 * f2) & 0xFF;
|
||||
this->log.info("Unit stars: %g * %g = %" PRIu32, f1, f2, stars);
|
||||
@@ -580,7 +605,7 @@ void ItemCreator::generate_common_item_variances(uint32_t area_norm, ItemData& i
|
||||
this->generate_common_tool_variances(area_norm, item);
|
||||
break;
|
||||
case 4:
|
||||
item.data2d = this->choose_meseta_amount(this->pt->box_meseta_ranges(), area_norm) & 0xFFFF;
|
||||
item.data2d = this->choose_meseta_amount(this->pt->box_meseta_ranges, area_norm) & 0xFFFF;
|
||||
break;
|
||||
default:
|
||||
// Note: The original code does the following here:
|
||||
@@ -596,15 +621,15 @@ void ItemCreator::generate_common_item_variances(uint32_t area_norm, ItemData& i
|
||||
void ItemCreator::generate_common_armor_or_shield_type_and_variances(char area_norm, ItemData& item) {
|
||||
this->generate_common_armor_slots_and_bonuses(item);
|
||||
|
||||
uint8_t type = this->get_rand_from_weighted_tables_1d(this->pt->armor_shield_type_index_prob_table());
|
||||
item.data1[2] = area_norm + type + this->pt->armor_or_shield_type_bias();
|
||||
uint8_t type = this->get_rand_from_weighted_tables_1d(this->pt->armor_shield_type_index_prob_table);
|
||||
item.data1[2] = area_norm + type + this->pt->armor_or_shield_type_bias;
|
||||
if (item.data1[2] < 3) {
|
||||
item.data1[2] = 0;
|
||||
} else {
|
||||
item.data1[2] -= 3;
|
||||
}
|
||||
this->log.info("Armor/shield type: max(%02hhX + %02hhX + %02hhX - 3, 0) = %02hhX",
|
||||
area_norm, type, this->pt->armor_or_shield_type_bias(), item.data1[2]);
|
||||
area_norm, type, this->pt->armor_or_shield_type_bias, item.data1[2]);
|
||||
}
|
||||
|
||||
void ItemCreator::generate_common_armor_slots_and_bonuses(ItemData& item) {
|
||||
@@ -622,13 +647,13 @@ void ItemCreator::generate_common_armor_slots_and_bonuses(ItemData& item) {
|
||||
}
|
||||
|
||||
void ItemCreator::generate_common_armor_slot_count(ItemData& item) {
|
||||
item.data1[5] = this->get_rand_from_weighted_tables_1d(this->pt->armor_slot_count_prob_table());
|
||||
item.data1[5] = this->get_rand_from_weighted_tables_1d(this->pt->armor_slot_count_prob_table);
|
||||
}
|
||||
|
||||
void ItemCreator::generate_common_tool_variances(uint32_t area_norm, ItemData& item) {
|
||||
item.clear();
|
||||
|
||||
uint8_t tool_class = this->get_rand_from_weighted_tables_2d_vertical(this->pt->tool_class_prob_table(), area_norm);
|
||||
uint8_t tool_class = this->get_rand_from_weighted_tables_2d_vertical(this->pt->tool_class_prob_table, area_norm);
|
||||
if (this->is_v3() && (tool_class == 0x1A)) {
|
||||
tool_class = 0x73;
|
||||
}
|
||||
@@ -653,7 +678,7 @@ void ItemCreator::generate_common_tool_variances(uint32_t area_norm, ItemData& i
|
||||
}
|
||||
|
||||
if (item.data1[1] == 0x02) { // Tech disk
|
||||
item.data1[4] = this->get_rand_from_weighted_tables_2d_vertical(this->pt->technique_index_prob_table(), area_norm);
|
||||
item.data1[4] = this->get_rand_from_weighted_tables_2d_vertical(this->pt->technique_index_prob_table, area_norm);
|
||||
item.data1[2] = this->generate_tech_disk_level(item.data1[4], area_norm);
|
||||
this->clear_tool_item_if_invalid(item);
|
||||
}
|
||||
@@ -661,7 +686,7 @@ void ItemCreator::generate_common_tool_variances(uint32_t area_norm, ItemData& i
|
||||
}
|
||||
|
||||
uint8_t ItemCreator::generate_tech_disk_level(uint32_t tech_num, uint32_t area_norm) {
|
||||
const auto& range = this->pt->technique_level_ranges().at(tech_num).at(area_norm);
|
||||
const auto& range = this->pt->technique_level_ranges.at(tech_num).at(area_norm);
|
||||
if (((range.min == 0xFF) || (range.max == 0xFF)) || (range.max < range.min)) {
|
||||
return 0xFF;
|
||||
} else if (range.min != range.max) {
|
||||
@@ -685,12 +710,12 @@ void ItemCreator::generate_common_weapon_variances(uint8_t area_norm, ItemData&
|
||||
weapon_type_prob_table[0] = 0;
|
||||
memmove(
|
||||
weapon_type_prob_table.data() + 1,
|
||||
this->pt->base_weapon_type_prob_table().data(),
|
||||
this->pt->base_weapon_type_prob_table.data(),
|
||||
0x0C);
|
||||
|
||||
for (size_t z = 1; z < 13; z++) {
|
||||
// Technically this should be `if (... < 0)`, but whatever
|
||||
if ((area_norm + this->pt->subtype_base_table().at(z - 1)) & 0x80) {
|
||||
if ((area_norm + this->pt->subtype_base_table.at(z - 1)) & 0x80) {
|
||||
weapon_type_prob_table[z] = 0;
|
||||
}
|
||||
}
|
||||
@@ -706,8 +731,8 @@ void ItemCreator::generate_common_weapon_variances(uint8_t area_norm, ItemData&
|
||||
this->log.info("00 chosen from subtype table; skipping item");
|
||||
item.clear();
|
||||
} else {
|
||||
int8_t subtype_base = this->pt->subtype_base_table().at(item.data1[1] - 1);
|
||||
uint8_t area_length = this->pt->subtype_area_length_table().at(item.data1[1] - 1);
|
||||
int8_t subtype_base = this->pt->subtype_base_table.at(item.data1[1] - 1);
|
||||
uint8_t area_length = this->pt->subtype_area_length_table.at(item.data1[1] - 1);
|
||||
this->log.info("Subtype table yielded %02hhX; subtype base is %hhd with area length %hhu", item.data1[1], subtype_base, area_length);
|
||||
if (subtype_base < 0) {
|
||||
item.data1[2] = (area_norm + subtype_base) / area_length;
|
||||
@@ -727,7 +752,7 @@ void ItemCreator::generate_common_weapon_variances(uint8_t area_norm, ItemData&
|
||||
void ItemCreator::generate_common_weapon_grind(ItemData& item, uint8_t offset_within_subtype_range) {
|
||||
if (item.data1[0] == 0) {
|
||||
uint8_t offset = clamp<uint8_t>(offset_within_subtype_range, 0, 3);
|
||||
item.data1[3] = this->get_rand_from_weighted_tables_2d_vertical(this->pt->grind_prob_table(), offset);
|
||||
item.data1[3] = this->get_rand_from_weighted_tables_2d_vertical(this->pt->grind_prob_table, offset);
|
||||
this->log.info("Generated grind %02hhX from offset within subtype range %02hhX", item.data1[3], offset_within_subtype_range);
|
||||
}
|
||||
}
|
||||
@@ -740,13 +765,13 @@ void ItemCreator::generate_common_weapon_special(ItemData& item, uint8_t area_no
|
||||
this->log.info("Item is rare; skipping special generation");
|
||||
return;
|
||||
}
|
||||
uint8_t special_mult = this->pt->special_mult().at(area_norm);
|
||||
uint8_t special_mult = this->pt->special_mult.at(area_norm);
|
||||
if (special_mult == 0) {
|
||||
this->log.info("Special multiplier is zero for area_norm %02hhX; skipping special generation", area_norm);
|
||||
return;
|
||||
}
|
||||
uint8_t det = this->rand_int(100);
|
||||
uint8_t prob = this->pt->special_percent().at(area_norm);
|
||||
uint8_t prob = this->pt->special_percent.at(area_norm);
|
||||
if (det >= prob) {
|
||||
this->log.info("Special not chosen (%02hhX > %02hhX)", det, prob);
|
||||
return;
|
||||
@@ -797,6 +822,7 @@ void ItemCreator::generate_unit_stars_tables() {
|
||||
case Version::DC_V1_11_2000_PROTOTYPE:
|
||||
case Version::DC_V1:
|
||||
case Version::DC_V2:
|
||||
case Version::PC_NTE:
|
||||
case Version::PC_V2:
|
||||
star_base_index = 0x1D1;
|
||||
num_units = 0x44;
|
||||
@@ -1639,7 +1665,7 @@ void ItemCreator::generate_weapon_shop_item_bonus2(ItemData& item, size_t player
|
||||
|
||||
ItemData ItemCreator::on_specialized_box_item_drop(
|
||||
uint16_t entity_id, uint8_t area, float def_z, uint32_t def0, uint32_t def1, uint32_t def2) {
|
||||
if (!this->destroyed_boxes.emplace(entity_id).second) {
|
||||
if (this->destroyed_boxes.count(entity_id)) {
|
||||
return ItemData();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,16 @@ public:
|
||||
std::shared_ptr<const BattleRules> restrictions = nullptr);
|
||||
~ItemCreator() = default;
|
||||
|
||||
void set_random_state(uint32_t seed, uint32_t absolute_offset);
|
||||
void clear_destroyed_entities();
|
||||
|
||||
ItemData on_monster_item_drop(uint16_t entity_id, uint32_t enemy_type, uint8_t area);
|
||||
ItemData on_box_item_drop(uint16_t entity_id, uint8_t area);
|
||||
ItemData on_specialized_box_item_drop(uint16_t entity_id, uint8_t area, float def_z, uint32_t def0, uint32_t def1, uint32_t def2);
|
||||
|
||||
void set_monster_destroyed(uint16_t entity_id);
|
||||
void set_box_destroyed(uint16_t entity_id);
|
||||
|
||||
static ItemData base_item_for_specialized_box(uint32_t def0, uint32_t def1, uint32_t def2);
|
||||
|
||||
std::vector<ItemData> generate_armor_shop_contents(size_t player_level);
|
||||
|
||||
@@ -43,6 +43,17 @@ bool ItemData::operator!=(const ItemData& other) const {
|
||||
return !this->operator==(other);
|
||||
}
|
||||
|
||||
bool ItemData::operator<(const ItemData& other) const {
|
||||
for (size_t z = 0; z < 3; z++) {
|
||||
if (this->data1db[z] < other.data1db[z]) {
|
||||
return true;
|
||||
} else if (this->data1db[z] > other.data1db[z]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return (this->data2db < other.data2db);
|
||||
}
|
||||
|
||||
void ItemData::clear() {
|
||||
this->data1d.clear(0);
|
||||
this->id = 0xFFFFFFFF;
|
||||
@@ -146,6 +157,12 @@ size_t ItemData::max_stack_size() const {
|
||||
return max_stack_size_for_item(this->data1[0], this->data1[1]);
|
||||
}
|
||||
|
||||
void ItemData::enforce_min_stack_size() {
|
||||
if (this->stack_size() == 0) {
|
||||
this->data1[5] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
bool ItemData::is_common_consumable(uint32_t primary_identifier) {
|
||||
if (primary_identifier == 0x030200) {
|
||||
return false;
|
||||
|
||||
@@ -111,13 +111,17 @@ struct ItemData { // 0x14 bytes
|
||||
union {
|
||||
parray<uint8_t, 12> data1;
|
||||
parray<le_uint16_t, 6> data1w;
|
||||
parray<be_uint16_t, 6> data1wb;
|
||||
parray<le_uint32_t, 3> data1d;
|
||||
parray<be_uint32_t, 3> data1db;
|
||||
} __attribute__((packed));
|
||||
le_uint32_t id;
|
||||
union {
|
||||
parray<uint8_t, 4> data2;
|
||||
parray<le_uint16_t, 2> data2w;
|
||||
parray<be_uint16_t, 2> data2wb;
|
||||
le_uint32_t data2d;
|
||||
be_uint32_t data2db;
|
||||
} __attribute__((packed));
|
||||
|
||||
ItemData();
|
||||
@@ -128,6 +132,8 @@ struct ItemData { // 0x14 bytes
|
||||
bool operator==(const ItemData& other) const;
|
||||
bool operator!=(const ItemData& other) const;
|
||||
|
||||
bool operator<(const ItemData& other) const;
|
||||
|
||||
void clear();
|
||||
|
||||
static ItemData from_data(const std::string& data);
|
||||
@@ -141,6 +147,7 @@ struct ItemData { // 0x14 bytes
|
||||
bool is_stackable() const;
|
||||
size_t stack_size() const;
|
||||
size_t max_stack_size() const;
|
||||
void enforce_min_stack_size();
|
||||
|
||||
static bool is_common_consumable(uint32_t primary_identifier);
|
||||
bool is_common_consumable() const;
|
||||
|
||||
+13
-8
@@ -117,13 +117,15 @@ std::string ItemNameIndex::describe_item(
|
||||
|
||||
// For weapons, specials appear before the weapon name
|
||||
if ((item.data1[0] == 0x00) && (item.data1[4] != 0x00) && !item.is_s_rank_weapon()) {
|
||||
// 0x80 is the unidentified flag, but we always return the identified name
|
||||
// of the item here, so we ignore it
|
||||
bool is_unidentified = item.data1[4] & 0x80;
|
||||
bool is_present = item.data1[4] & 0x40;
|
||||
uint8_t special_id = item.data1[4] & 0x3F;
|
||||
if (is_present) {
|
||||
ret_tokens.emplace_back("Wrapped");
|
||||
}
|
||||
if (is_unidentified) {
|
||||
ret_tokens.emplace_back("????");
|
||||
}
|
||||
if (special_id) {
|
||||
try {
|
||||
ret_tokens.emplace_back(name_for_weapon_special.at(special_id));
|
||||
@@ -361,11 +363,12 @@ std::string ItemNameIndex::describe_item(
|
||||
}
|
||||
|
||||
ItemData ItemNameIndex::parse_item_description(Version version, const std::string& desc) const {
|
||||
ItemData ret;
|
||||
try {
|
||||
return this->parse_item_description_phase(version, desc, false);
|
||||
ret = this->parse_item_description_phase(version, desc, false);
|
||||
} catch (const exception& e1) {
|
||||
try {
|
||||
return this->parse_item_description_phase(version, desc, true);
|
||||
ret = this->parse_item_description_phase(version, desc, true);
|
||||
} catch (const exception& e2) {
|
||||
try {
|
||||
string data = parse_data_string(desc);
|
||||
@@ -379,23 +382,25 @@ ItemData ItemNameIndex::parse_item_description(Version version, const std::strin
|
||||
throw runtime_error("item code too long");
|
||||
}
|
||||
|
||||
ItemData ret;
|
||||
if (data.size() <= 12) {
|
||||
memcpy(ret.data1.data(), data.data(), data.size());
|
||||
} else {
|
||||
memcpy(ret.data1.data(), data.data(), 12);
|
||||
memcpy(ret.data2.data(), data.data() + 12, data.size() - 12);
|
||||
}
|
||||
return ret;
|
||||
} catch (const exception& ed) {
|
||||
if (strcmp(e1.what(), e2.what())) {
|
||||
throw runtime_error(string_printf("cannot parse item description (as text 1: %s) (as text 2: %s) (as data: %s)", e1.what(), e2.what(), ed.what()));
|
||||
throw runtime_error(string_printf("cannot parse item description \"%s\" in %s (as text 1: %s) (as text 2: %s) (as data: %s)",
|
||||
desc.c_str(), name_for_enum(version), e1.what(), e2.what(), ed.what()));
|
||||
} else {
|
||||
throw runtime_error(string_printf("cannot parse item description (as text: %s) (as data: %s)", e1.what(), ed.what()));
|
||||
throw runtime_error(string_printf("cannot parse item description \"%s\" in %s (as text: %s) (as data: %s)",
|
||||
desc.c_str(), name_for_enum(version), e1.what(), ed.what()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ret.enforce_min_stack_size();
|
||||
return ret;
|
||||
}
|
||||
|
||||
ItemData ItemNameIndex::parse_item_description_phase(Version version, const std::string& description, bool skip_special) const {
|
||||
|
||||
@@ -381,7 +381,7 @@ const ItemParameterTable::ToolV4& ItemParameterTable::get_tool(uint8_t data1_1,
|
||||
def_v4.amount = def_v3.amount.load();
|
||||
def_v4.tech = def_v3.tech.load();
|
||||
def_v4.cost = def_v3.cost.load();
|
||||
def_v4.item_flag = def_v3.item_flag;
|
||||
def_v4.item_flag = def_v3.item_flag.load();
|
||||
|
||||
} else {
|
||||
throw logic_error("table is not v2, v3, or v4");
|
||||
|
||||
@@ -207,12 +207,12 @@ public:
|
||||
struct Tool {
|
||||
using U16T = typename std::conditional<IsBigEndian, be_uint16_t, le_uint16_t>::type;
|
||||
using S32T = typename std::conditional<IsBigEndian, be_int32_t, le_int32_t>::type;
|
||||
using U32T = typename std::conditional<IsBigEndian, be_uint32_t, le_uint32_t>::type;
|
||||
BaseT base;
|
||||
U16T amount = 0;
|
||||
U16T tech = 0;
|
||||
S32T cost = 0;
|
||||
uint8_t item_flag = 0;
|
||||
parray<uint8_t, 3> unused;
|
||||
U32T item_flag = 0;
|
||||
} __attribute__((packed));
|
||||
struct ToolV2 : Tool<ItemBaseV2<false>, false> {
|
||||
} __attribute__((packed));
|
||||
|
||||
+7
-11
@@ -17,7 +17,7 @@ void player_use_item(shared_ptr<Client> c, size_t item_index) {
|
||||
bool is_v3_or_later = is_v3(c->version()) || is_v4(c->version());
|
||||
bool should_delete_item = is_v3_or_later;
|
||||
|
||||
auto player = c->game_data.character();
|
||||
auto player = c->character();
|
||||
auto& item = player->inventory.items[item_index];
|
||||
uint32_t item_identifier = item.data.primary_identifier();
|
||||
|
||||
@@ -54,7 +54,7 @@ void player_use_item(shared_ptr<Client> c, size_t item_index) {
|
||||
weapon.data.data1[3] += (item.data.data1[2] + 1);
|
||||
|
||||
} else if ((item_identifier & 0xFFFF00) == 0x030B00) { // Material
|
||||
auto p = c->game_data.character();
|
||||
auto p = c->character();
|
||||
|
||||
using Type = PSOBBCharacterFile::MaterialType;
|
||||
Type type;
|
||||
@@ -192,9 +192,9 @@ void player_use_item(shared_ptr<Client> c, size_t item_index) {
|
||||
item.data.data1.clear_after(3);
|
||||
should_delete_item = false;
|
||||
|
||||
auto l = c->lobby.lock();
|
||||
if (l) {
|
||||
send_create_inventory_item(c, item.data);
|
||||
auto l = c->require_lobby();
|
||||
if (l->base_version == Version::BB_V4) {
|
||||
send_create_inventory_item_to_lobby(c, c->lobby_client_id, item.data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -247,10 +247,6 @@ void player_use_item(shared_ptr<Client> c, size_t item_index) {
|
||||
} catch (const out_of_range&) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!combo_applied) {
|
||||
throw runtime_error("no combinations apply");
|
||||
}
|
||||
}
|
||||
|
||||
if (should_delete_item) {
|
||||
@@ -276,7 +272,7 @@ void player_feed_mag(std::shared_ptr<Client> c, size_t mag_item_index, size_t fe
|
||||
});
|
||||
|
||||
auto s = c->require_server_state();
|
||||
auto player = c->game_data.character();
|
||||
auto player = c->character();
|
||||
auto& fed_item = player->inventory.items[fed_item_index];
|
||||
auto& mag_item = player->inventory.items[mag_item_index];
|
||||
|
||||
@@ -376,7 +372,7 @@ void player_feed_mag(std::shared_ptr<Client> c, size_t mag_item_index, size_t fe
|
||||
} else if ((mag_level % 5) == 0) { // Level 50 (and beyond) evolutions
|
||||
if (evolution_number < 4) {
|
||||
|
||||
if (mag_level >= 100) {
|
||||
if ((mag_level >= 100) && !is_v1_or_v2(c->version())) {
|
||||
uint8_t section_id_group = player->disp.visual.section_id % 3;
|
||||
uint16_t def = mag_item.data.data1w[2] / 100;
|
||||
uint16_t pow = mag_item.data.data1w[3] / 100;
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ void PlayerStats::advance_to_level(uint8_t char_class, uint32_t level, shared_pt
|
||||
|
||||
LevelTable::LevelTable(shared_ptr<const string> data, bool compressed) {
|
||||
if (compressed) {
|
||||
this->data.reset(new string(prs_decompress(*data)));
|
||||
this->data = make_shared<string>(prs_decompress(*data));
|
||||
} else {
|
||||
this->data = data;
|
||||
}
|
||||
|
||||
+76
-55
@@ -26,6 +26,8 @@ License::License(const JSON& json)
|
||||
this->bb_password = json.get_string("BBPassword", "");
|
||||
this->flags = json.get_int("Flags", 0);
|
||||
this->ban_end_time = json.get_int("BanEndTime", 0);
|
||||
this->last_player_name = json.get_string("LastPlayerName", "");
|
||||
this->auto_reply_message = json.get_string("AutoReplyMessage", "");
|
||||
this->ep3_current_meseta = json.get_int("Ep3CurrentMeseta", 0);
|
||||
this->ep3_total_meseta_earned = json.get_int("Ep3TotalMesetaEarned", 0);
|
||||
this->bb_team_id = json.get_int("BBTeamID", 0);
|
||||
@@ -43,23 +45,16 @@ JSON License::json() const {
|
||||
{"BBPassword", this->bb_password},
|
||||
{"Flags", this->flags},
|
||||
{"BanEndTime", this->ban_end_time},
|
||||
{"LastPlayerName", this->last_player_name},
|
||||
{"AutoReplyMessage", this->auto_reply_message},
|
||||
{"Ep3CurrentMeseta", this->ep3_current_meseta},
|
||||
{"Ep3TotalMesetaEarned", this->ep3_total_meseta_earned},
|
||||
{"BBTeamID", this->bb_team_id},
|
||||
});
|
||||
}
|
||||
|
||||
void License::save() const {
|
||||
auto json = this->json();
|
||||
string json_data = json.serialize(JSON::SerializeOption::FORMAT | JSON::SerializeOption::HEX_INTEGERS);
|
||||
string filename = string_printf("system/licenses/%010" PRIu32 ".json", this->serial_number);
|
||||
save_file(filename, json_data);
|
||||
}
|
||||
|
||||
void License::delete_file() const {
|
||||
string filename = string_printf("system/licenses/%010" PRIu32 ".json", this->serial_number);
|
||||
remove(filename.c_str());
|
||||
}
|
||||
void License::save() const {}
|
||||
void License::delete_file() const {}
|
||||
|
||||
string License::str() const {
|
||||
vector<string> tokens;
|
||||
@@ -98,53 +93,26 @@ string License::str() const {
|
||||
return "[License: " + join(tokens, ", ") + "]";
|
||||
}
|
||||
|
||||
struct BinaryLicense {
|
||||
pstring<TextEncoding::ASCII, 0x14> username; // BB username (max. 16 chars; should technically be Unicode)
|
||||
pstring<TextEncoding::ASCII, 0x14> bb_password; // BB password (max. 16 chars)
|
||||
uint32_t serial_number; // PC/GC serial number. MUST BE PRESENT FOR BB LICENSES TOO; this is also the player's guild card number.
|
||||
pstring<TextEncoding::ASCII, 0x10> access_key; // PC/GC access key. (to log in using PC on a GC license, just enter the first 8 characters of the GC access key)
|
||||
pstring<TextEncoding::ASCII, 0x0C> gc_password; // GC password
|
||||
uint32_t privileges; // privilege level
|
||||
uint64_t ban_end_time; // end time of ban (zero = not banned)
|
||||
} __attribute__((packed));
|
||||
DiskLicense::DiskLicense(const JSON& json) : License(json) {}
|
||||
|
||||
LicenseIndex::LicenseIndex() {
|
||||
if (!isdir("system/licenses")) {
|
||||
mkdir("system/licenses", 0755);
|
||||
}
|
||||
void DiskLicense::save() const {
|
||||
auto json = this->json();
|
||||
string json_data = json.serialize(JSON::SerializeOption::FORMAT | JSON::SerializeOption::HEX_INTEGERS);
|
||||
string filename = string_printf("system/licenses/%010" PRIu32 ".json", this->serial_number);
|
||||
save_file(filename, json_data);
|
||||
}
|
||||
|
||||
// Convert binary licenses to JSON licenses and save them
|
||||
if (isfile("system/licenses.nsi")) {
|
||||
auto bin_licenses = load_vector_file<BinaryLicense>("system/licenses.nsi");
|
||||
for (const auto& bin_license : bin_licenses) {
|
||||
// Only add licenses from the binary file if there isn't a JSON version of
|
||||
// the same license
|
||||
try {
|
||||
this->get(bin_license.serial_number);
|
||||
} catch (const missing_license&) {
|
||||
License license;
|
||||
license.serial_number = bin_license.serial_number;
|
||||
license.access_key = bin_license.access_key.decode();
|
||||
license.gc_password = bin_license.gc_password.decode();
|
||||
license.bb_username = bin_license.username.decode();
|
||||
license.bb_password = bin_license.bb_password.decode();
|
||||
license.flags = bin_license.privileges;
|
||||
license.ban_end_time = bin_license.ban_end_time;
|
||||
license.ep3_current_meseta = 0;
|
||||
license.ep3_total_meseta_earned = 0;
|
||||
license.save();
|
||||
}
|
||||
}
|
||||
::remove("system/licenses.nsi");
|
||||
}
|
||||
void DiskLicense::delete_file() const {
|
||||
string filename = string_printf("system/licenses/%010" PRIu32 ".json", this->serial_number);
|
||||
remove(filename.c_str());
|
||||
}
|
||||
|
||||
for (const auto& item : list_directory("system/licenses")) {
|
||||
if (ends_with(item, ".json")) {
|
||||
JSON json = JSON::parse(load_file("system/licenses/" + item));
|
||||
shared_ptr<License> license(new License(json));
|
||||
this->add(license);
|
||||
}
|
||||
}
|
||||
shared_ptr<License> LicenseIndex::create_license() const {
|
||||
return make_shared<License>();
|
||||
}
|
||||
|
||||
shared_ptr<License> LicenseIndex::create_temporary_license() const {
|
||||
return make_shared<License>();
|
||||
}
|
||||
|
||||
size_t LicenseIndex::count() const {
|
||||
@@ -284,3 +252,56 @@ shared_ptr<License> LicenseIndex::verify_bb(const string& username, const string
|
||||
throw missing_license();
|
||||
}
|
||||
}
|
||||
|
||||
DiskLicenseIndex::DiskLicenseIndex() {
|
||||
struct BinaryLicense {
|
||||
pstring<TextEncoding::ASCII, 0x14> username; // BB username (max. 16 chars; should technically be Unicode)
|
||||
pstring<TextEncoding::ASCII, 0x14> bb_password; // BB password (max. 16 chars)
|
||||
uint32_t serial_number; // PC/GC serial number. MUST BE PRESENT FOR BB LICENSES TOO; this is also the player's guild card number.
|
||||
pstring<TextEncoding::ASCII, 0x10> access_key; // PC/GC access key. (to log in using PC on a GC license, just enter the first 8 characters of the GC access key)
|
||||
pstring<TextEncoding::ASCII, 0x0C> gc_password; // GC password
|
||||
uint32_t privileges; // privilege level
|
||||
uint64_t ban_end_time; // end time of ban (zero = not banned)
|
||||
} __attribute__((packed));
|
||||
|
||||
if (!isdir("system/licenses")) {
|
||||
mkdir("system/licenses", 0755);
|
||||
}
|
||||
|
||||
// Convert binary licenses to JSON licenses and save them
|
||||
if (isfile("system/licenses.nsi")) {
|
||||
auto bin_licenses = load_vector_file<BinaryLicense>("system/licenses.nsi");
|
||||
for (const auto& bin_license : bin_licenses) {
|
||||
// Only add licenses from the binary file if there isn't a JSON version of
|
||||
// the same license
|
||||
try {
|
||||
this->get(bin_license.serial_number);
|
||||
} catch (const missing_license&) {
|
||||
License license;
|
||||
license.serial_number = bin_license.serial_number;
|
||||
license.access_key = bin_license.access_key.decode();
|
||||
license.gc_password = bin_license.gc_password.decode();
|
||||
license.bb_username = bin_license.username.decode();
|
||||
license.bb_password = bin_license.bb_password.decode();
|
||||
license.flags = bin_license.privileges;
|
||||
license.ban_end_time = bin_license.ban_end_time;
|
||||
license.ep3_current_meseta = 0;
|
||||
license.ep3_total_meseta_earned = 0;
|
||||
license.save();
|
||||
}
|
||||
}
|
||||
::remove("system/licenses.nsi");
|
||||
}
|
||||
|
||||
for (const auto& item : list_directory("system/licenses")) {
|
||||
if (ends_with(item, ".json")) {
|
||||
JSON json = JSON::parse(load_file("system/licenses/" + item));
|
||||
auto license = make_shared<DiskLicense>(json);
|
||||
this->add(license);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shared_ptr<License> DiskLicenseIndex::create_license() const {
|
||||
return make_shared<DiskLicense>();
|
||||
}
|
||||
|
||||
+45
-18
@@ -10,23 +10,26 @@
|
||||
|
||||
class LicenseIndex;
|
||||
|
||||
struct License {
|
||||
class License {
|
||||
public:
|
||||
enum Flag : uint32_t {
|
||||
// clang-format off
|
||||
KICK_USER = 0x00000001,
|
||||
BAN_USER = 0x00000002,
|
||||
SILENCE_USER = 0x00000004,
|
||||
CHANGE_LOBBY_INFO = 0x00000008,
|
||||
CHANGE_EVENT = 0x00000010,
|
||||
ANNOUNCE = 0x00000020,
|
||||
FREE_JOIN_GAMES = 0x00000040,
|
||||
UNLOCK_GAMES = 0x00000080,
|
||||
DEBUG = 0x01000000,
|
||||
MODERATOR = 0x00000007,
|
||||
ADMINISTRATOR = 0x000000FF,
|
||||
ROOT = 0x7FFFFFFF,
|
||||
KICK_USER = 0x00000001,
|
||||
BAN_USER = 0x00000002,
|
||||
SILENCE_USER = 0x00000004,
|
||||
CHANGE_LOBBY_INFO = 0x00000008,
|
||||
CHANGE_EVENT = 0x00000010,
|
||||
ANNOUNCE = 0x00000020,
|
||||
FREE_JOIN_GAMES = 0x00000040,
|
||||
UNLOCK_GAMES = 0x00000080,
|
||||
DEBUG = 0x01000000,
|
||||
CHEAT_ANYWHERE = 0x02000000,
|
||||
DISABLE_QUEST_REQUIREMENTS = 0x04000000,
|
||||
MODERATOR = 0x00000007,
|
||||
ADMINISTRATOR = 0x000000FF,
|
||||
ROOT = 0x7FFFFFFF,
|
||||
|
||||
UNUSED_BITS = 0x7EFFFF00,
|
||||
UNUSED_BITS = 0x78FFFF00,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
@@ -41,6 +44,8 @@ struct License {
|
||||
|
||||
uint32_t flags = 0;
|
||||
uint64_t ban_end_time = 0; // 0 = not banned
|
||||
std::string last_player_name;
|
||||
std::string auto_reply_message;
|
||||
|
||||
uint32_t ep3_current_meseta = 0;
|
||||
uint32_t ep3_total_meseta_earned = 0;
|
||||
@@ -49,14 +54,25 @@ struct License {
|
||||
|
||||
License() = default;
|
||||
explicit License(const JSON& json);
|
||||
virtual ~License() = default;
|
||||
|
||||
JSON json() const;
|
||||
void save() const;
|
||||
void delete_file() const;
|
||||
virtual void save() const;
|
||||
virtual void delete_file() const;
|
||||
|
||||
std::string str() const;
|
||||
};
|
||||
|
||||
class DiskLicense : public License {
|
||||
public:
|
||||
DiskLicense() = default;
|
||||
explicit DiskLicense(const JSON& json);
|
||||
virtual ~DiskLicense() = default;
|
||||
|
||||
virtual void save() const;
|
||||
virtual void delete_file() const;
|
||||
};
|
||||
|
||||
class LicenseIndex {
|
||||
public:
|
||||
class no_username : public std::invalid_argument {
|
||||
@@ -76,8 +92,11 @@ public:
|
||||
missing_license() : invalid_argument("missing license") {}
|
||||
};
|
||||
|
||||
LicenseIndex();
|
||||
~LicenseIndex() = default;
|
||||
LicenseIndex() = default;
|
||||
virtual ~LicenseIndex() = default;
|
||||
|
||||
virtual std::shared_ptr<License> create_license() const;
|
||||
virtual std::shared_ptr<License> create_temporary_license() const;
|
||||
|
||||
size_t count() const;
|
||||
std::shared_ptr<License> get(uint32_t serial_number) const;
|
||||
@@ -97,3 +116,11 @@ protected:
|
||||
std::unordered_map<std::string, std::shared_ptr<License>> xb_gamertag_to_license;
|
||||
std::unordered_map<uint32_t, std::shared_ptr<License>> serial_number_to_license;
|
||||
};
|
||||
|
||||
class DiskLicenseIndex : public LicenseIndex {
|
||||
public:
|
||||
DiskLicenseIndex();
|
||||
virtual ~DiskLicenseIndex() = default;
|
||||
|
||||
virtual std::shared_ptr<License> create_license() const;
|
||||
};
|
||||
|
||||
+506
-43
@@ -4,19 +4,144 @@
|
||||
|
||||
#include <phosg/Random.hh>
|
||||
|
||||
#include "Compression.hh"
|
||||
#include "Loggers.hh"
|
||||
#include "SendCommands.hh"
|
||||
#include "Text.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool Lobby::FloorItem::visible_to_client(uint8_t client_id) const {
|
||||
return this->visibility_flags & (1 << client_id);
|
||||
}
|
||||
|
||||
Lobby::FloorItemManager::FloorItemManager(uint32_t lobby_id, uint8_t floor)
|
||||
: log(string_printf("[Lobby:%08" PRIX32 ":FloorItems:%02hhX] ", lobby_id, floor), lobby_log.min_level),
|
||||
next_drop_number(0) {}
|
||||
|
||||
bool Lobby::FloorItemManager::exists(uint32_t item_id) const {
|
||||
return this->items.count(item_id);
|
||||
}
|
||||
|
||||
shared_ptr<Lobby::FloorItem> Lobby::FloorItemManager::find(uint32_t item_id) const {
|
||||
return this->items.at(item_id);
|
||||
}
|
||||
|
||||
void Lobby::FloorItemManager::add(const ItemData& item, float x, float z, uint16_t visibility_flags) {
|
||||
auto fi = make_shared<FloorItem>();
|
||||
fi->data = item;
|
||||
fi->x = x;
|
||||
fi->z = z;
|
||||
fi->drop_number = this->next_drop_number++;
|
||||
fi->visibility_flags = visibility_flags & 0x0FFF;
|
||||
this->add(fi);
|
||||
}
|
||||
|
||||
void Lobby::FloorItemManager::add(shared_ptr<Lobby::FloorItem> fi) {
|
||||
if (fi->visibility_flags == 0) {
|
||||
throw logic_error("floor item is not visible to any player");
|
||||
}
|
||||
|
||||
auto emplace_ret = this->items.emplace(fi->data.id, fi);
|
||||
if (!emplace_ret.second) {
|
||||
throw runtime_error("floor item already exists with the same ID");
|
||||
}
|
||||
for (size_t z = 0; z < 12; z++) {
|
||||
if (fi->visible_to_client(z)) {
|
||||
this->queue_for_client[z].emplace(fi->drop_number, fi);
|
||||
}
|
||||
}
|
||||
this->log.info("Added floor item %08" PRIX32 " at %g, %g with drop number %" PRIu64 " visible to %03hX",
|
||||
fi->data.id.load(), fi->x, fi->z, fi->drop_number, fi->visibility_flags);
|
||||
}
|
||||
|
||||
std::shared_ptr<Lobby::FloorItem> Lobby::FloorItemManager::remove(uint32_t item_id, uint8_t client_id) {
|
||||
auto item_it = this->items.find(item_id);
|
||||
if (item_it == this->items.end()) {
|
||||
throw out_of_range("item not present");
|
||||
}
|
||||
auto fi = item_it->second;
|
||||
if ((client_id != 0xFF) && !fi->visible_to_client(client_id)) {
|
||||
throw runtime_error("client does not have access to item");
|
||||
}
|
||||
for (size_t z = 0; z < 12; z++) {
|
||||
if (fi->visible_to_client(z) && !this->queue_for_client[z].erase(fi->drop_number)) {
|
||||
throw logic_error("item queue for client is inconsistent");
|
||||
}
|
||||
}
|
||||
this->items.erase(item_it);
|
||||
this->log.info("Removed floor item %08" PRIX32 " at %g, %g with drop number %" PRIu64 " visible to %03hX",
|
||||
fi->data.id.load(), fi->x, fi->z, fi->drop_number, fi->visibility_flags);
|
||||
return fi;
|
||||
}
|
||||
|
||||
std::unordered_set<std::shared_ptr<Lobby::FloorItem>> Lobby::FloorItemManager::evict() {
|
||||
unordered_set<shared_ptr<FloorItem>> ret;
|
||||
for (size_t z = 0; z < 12; z++) {
|
||||
while (this->queue_for_client[z].size() > 48) {
|
||||
ret.emplace(this->remove(this->queue_for_client[z].begin()->second->data.id, 0xFF));
|
||||
}
|
||||
}
|
||||
this->log.info("Evicted %zu items", ret.size());
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Lobby::FloorItemManager::clear_inaccessible(uint16_t remaining_clients_mask) {
|
||||
unordered_set<uint32_t> item_ids_to_delete;
|
||||
for (const auto& it : this->items) {
|
||||
if ((it.second->visibility_flags & remaining_clients_mask) == 0) {
|
||||
item_ids_to_delete.emplace(it.first);
|
||||
}
|
||||
}
|
||||
for (uint32_t item_id : item_ids_to_delete) {
|
||||
this->remove(item_id, 0xFF);
|
||||
}
|
||||
this->log.info("Deleted %zu inaccessible items", item_ids_to_delete.size());
|
||||
}
|
||||
|
||||
void Lobby::FloorItemManager::clear_private() {
|
||||
unordered_set<uint32_t> item_ids_to_delete;
|
||||
for (const auto& it : this->items) {
|
||||
if ((it.second->visibility_flags & 0x00F) != 0x00F) {
|
||||
item_ids_to_delete.emplace(it.first);
|
||||
}
|
||||
}
|
||||
for (uint32_t item_id : item_ids_to_delete) {
|
||||
this->remove(item_id, 0xFF);
|
||||
}
|
||||
this->log.info("Deleted %zu private items", item_ids_to_delete.size());
|
||||
}
|
||||
|
||||
void Lobby::FloorItemManager::clear() {
|
||||
size_t num_items = this->items.size();
|
||||
this->items.clear();
|
||||
for (auto& queue : this->queue_for_client) {
|
||||
queue.clear();
|
||||
}
|
||||
this->next_drop_number = 0;
|
||||
this->log.info("Deleted %zu items", num_items);
|
||||
}
|
||||
|
||||
uint32_t Lobby::FloorItemManager::reassign_all_item_ids(uint32_t next_item_id) {
|
||||
unordered_map<uint32_t, shared_ptr<FloorItem>> old_items;
|
||||
old_items.swap(this->items);
|
||||
for (auto& queue : this->queue_for_client) {
|
||||
queue.clear();
|
||||
}
|
||||
for (auto& it : old_items) {
|
||||
it.second->data.id = next_item_id++;
|
||||
this->add(it.second);
|
||||
}
|
||||
return next_item_id;
|
||||
}
|
||||
|
||||
Lobby::Lobby(shared_ptr<ServerState> s, uint32_t id)
|
||||
: server_state(s),
|
||||
log(string_printf("[Lobby:%" PRIX32 "] ", id), lobby_log.min_level),
|
||||
lobby_id(id),
|
||||
min_level(0),
|
||||
max_level(0xFFFFFFFF),
|
||||
next_game_item_id(0x00810000),
|
||||
next_game_item_id(0xCC000000),
|
||||
base_version(Version::GC_V3),
|
||||
allowed_versions(0x0000),
|
||||
section_id(0),
|
||||
@@ -26,16 +151,26 @@ Lobby::Lobby(shared_ptr<ServerState> s, uint32_t id)
|
||||
base_exp_multiplier(1),
|
||||
challenge_exp_multiplier(1.0f),
|
||||
random_seed(random_object<uint32_t>()),
|
||||
drop_mode(DropMode::CLIENT),
|
||||
event(0),
|
||||
block(0),
|
||||
leader_id(0),
|
||||
max_clients(12),
|
||||
enabled_flags(0) {
|
||||
enabled_flags(0),
|
||||
idle_timeout_usecs(0),
|
||||
idle_timeout_event(
|
||||
event_new(s->base.get(), -1, EV_TIMEOUT | EV_PERSIST, &Lobby::dispatch_on_idle_timeout, this),
|
||||
event_free) {
|
||||
this->log.info("Created");
|
||||
for (size_t x = 0; x < 12; x++) {
|
||||
this->next_item_id[x] = 0x00010000 + 0x00200000 * x;
|
||||
this->next_item_id_for_client[x] = 0x00010000 + 0x00200000 * x;
|
||||
}
|
||||
}
|
||||
|
||||
Lobby::~Lobby() {
|
||||
this->log.info("Deleted");
|
||||
}
|
||||
|
||||
shared_ptr<ServerState> Lobby::require_server_state() const {
|
||||
auto s = this->server_state.lock();
|
||||
if (!s) {
|
||||
@@ -51,6 +186,18 @@ shared_ptr<Lobby::ChallengeParameters> Lobby::require_challenge_params() const {
|
||||
return this->challenge_params;
|
||||
}
|
||||
|
||||
void Lobby::set_drop_mode(DropMode new_mode) {
|
||||
this->drop_mode = new_mode;
|
||||
|
||||
bool should_have_item_creator = (this->base_version == Version::BB_V4) ||
|
||||
((new_mode != DropMode::DISABLED) && (new_mode != DropMode::CLIENT));
|
||||
if (should_have_item_creator && !this->item_creator) {
|
||||
this->create_item_creator();
|
||||
} else if (!should_have_item_creator && this->item_creator) {
|
||||
this->item_creator.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void Lobby::create_item_creator() {
|
||||
auto s = this->require_server_state();
|
||||
|
||||
@@ -70,6 +217,7 @@ void Lobby::create_item_creator() {
|
||||
rare_item_set = s->rare_item_sets.at("rare-table-v1");
|
||||
break;
|
||||
case Version::DC_V2:
|
||||
case Version::PC_NTE:
|
||||
case Version::PC_V2:
|
||||
common_item_set = s->common_item_set_v2;
|
||||
rare_item_set = s->rare_item_sets.at("rare-table-v2");
|
||||
@@ -77,17 +225,17 @@ void Lobby::create_item_creator() {
|
||||
case Version::GC_NTE:
|
||||
case Version::GC_V3:
|
||||
case Version::XB_V3:
|
||||
common_item_set = s->common_item_set_v3;
|
||||
common_item_set = s->common_item_set_v3_v4;
|
||||
rare_item_set = s->rare_item_sets.at("rare-table-v3");
|
||||
break;
|
||||
case Version::BB_V4:
|
||||
common_item_set = s->common_item_set_v3;
|
||||
common_item_set = s->common_item_set_v3_v4;
|
||||
rare_item_set = s->rare_item_sets.at("rare-table-v4");
|
||||
break;
|
||||
default:
|
||||
throw logic_error("invalid lobby base version");
|
||||
}
|
||||
this->item_creator.reset(new ItemCreator(
|
||||
this->item_creator = make_shared<ItemCreator>(
|
||||
common_item_set,
|
||||
rare_item_set,
|
||||
s->armor_random_set,
|
||||
@@ -101,7 +249,113 @@ void Lobby::create_item_creator() {
|
||||
this->difficulty,
|
||||
this->section_id,
|
||||
this->random_seed,
|
||||
this->quest ? this->quest->battle_rules : nullptr));
|
||||
this->quest ? this->quest->battle_rules : nullptr);
|
||||
}
|
||||
|
||||
void Lobby::load_maps() {
|
||||
auto s = this->require_server_state();
|
||||
this->map = make_shared<Map>(this->lobby_id);
|
||||
|
||||
if (this->quest) {
|
||||
auto leader_c = this->clients.at(this->leader_id);
|
||||
if (!leader_c) {
|
||||
throw logic_error("lobby leader is missing");
|
||||
}
|
||||
|
||||
auto vq = this->quest->version(Version::BB_V4, leader_c->language());
|
||||
auto dat_contents = prs_decompress(*vq->dat_contents);
|
||||
this->map->clear();
|
||||
this->map->add_enemies_and_objects_from_quest_data(
|
||||
this->episode,
|
||||
this->difficulty,
|
||||
this->event,
|
||||
dat_contents.data(),
|
||||
dat_contents.size(),
|
||||
this->random_seed,
|
||||
this->rare_enemy_rates ? this->rare_enemy_rates : Map::NO_RARE_ENEMIES);
|
||||
|
||||
} else { // No quest loaded
|
||||
for (size_t floor = 0; floor < 0x10; floor++) {
|
||||
this->log.info("[Map/%zu] Using variations %" PRIX32 ", %" PRIX32,
|
||||
floor, this->variations[floor * 2].load(), this->variations[floor * 2 + 1].load());
|
||||
|
||||
auto enemy_filenames = map_filenames_for_variation(
|
||||
this->episode,
|
||||
(this->mode == GameMode::SOLO),
|
||||
floor,
|
||||
this->variations[floor * 2],
|
||||
this->variations[floor * 2 + 1],
|
||||
true);
|
||||
if (enemy_filenames.empty()) {
|
||||
this->log.info("[Map/%zu:e] No file to load", floor);
|
||||
} else {
|
||||
bool any_map_loaded = false;
|
||||
for (const string& filename : enemy_filenames) {
|
||||
try {
|
||||
auto map_data = s->load_bb_file(filename, "", "map/" + filename);
|
||||
this->map->add_enemies_from_map_data(
|
||||
this->episode,
|
||||
this->difficulty,
|
||||
this->event,
|
||||
floor,
|
||||
map_data->data(),
|
||||
map_data->size(),
|
||||
this->rare_enemy_rates);
|
||||
any_map_loaded = true;
|
||||
break;
|
||||
} catch (const exception& e) {
|
||||
this->log.info("[Map/%zu:e] Failed to load %s: %s", floor, filename.c_str(), e.what());
|
||||
}
|
||||
}
|
||||
if (!any_map_loaded) {
|
||||
throw runtime_error(string_printf("no enemy maps loaded for floor %zu", floor));
|
||||
}
|
||||
}
|
||||
|
||||
auto object_filenames = map_filenames_for_variation(
|
||||
this->episode,
|
||||
(this->mode == GameMode::SOLO),
|
||||
floor,
|
||||
this->variations[floor * 2],
|
||||
this->variations[floor * 2 + 1],
|
||||
false);
|
||||
if (object_filenames.empty()) {
|
||||
this->log.info("[Map/%zu:o] No file to load", floor);
|
||||
} else {
|
||||
bool any_map_loaded = false;
|
||||
for (const string& filename : object_filenames) {
|
||||
try {
|
||||
auto map_data = s->load_bb_file(filename, "", "map/" + filename);
|
||||
this->map->add_objects_from_map_data(floor, map_data->data(), map_data->size());
|
||||
any_map_loaded = true;
|
||||
break;
|
||||
} catch (const exception& e) {
|
||||
this->log.info("[Map/%zu:o] Failed to load %s: %s", floor, filename.c_str(), e.what());
|
||||
}
|
||||
}
|
||||
if (!any_map_loaded) {
|
||||
throw runtime_error(string_printf("no object maps loaded for floor %zu", floor));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->log.info("Generated objects list (%zu entries):", this->map->objects.size());
|
||||
for (size_t z = 0; z < this->map->objects.size(); z++) {
|
||||
string o_str = this->map->objects[z].str(s->item_name_index);
|
||||
this->log.info("(K-%zX) %s", z, o_str.c_str());
|
||||
}
|
||||
this->log.info("Generated enemies list (%zu entries):", this->map->enemies.size());
|
||||
for (size_t z = 0; z < this->map->enemies.size(); z++) {
|
||||
string e_str = this->map->enemies[z].str();
|
||||
this->log.info("(E-%zX) %s", z, e_str.c_str());
|
||||
}
|
||||
this->log.info("Loaded maps contain %zu object entries and %zu enemy entries overall (%zu as rares)",
|
||||
this->map->objects.size(), this->map->enemies.size(), this->map->rare_enemy_indexes.size());
|
||||
|
||||
if (this->item_creator) {
|
||||
this->item_creator->clear_destroyed_entities();
|
||||
}
|
||||
}
|
||||
|
||||
void Lobby::create_ep3_server() {
|
||||
@@ -211,15 +465,36 @@ void Lobby::add_client(shared_ptr<Client> c, ssize_t required_client_id) {
|
||||
this->leader_id = c->lobby_client_id;
|
||||
}
|
||||
|
||||
// If the lobby is a game and item tracking is enabled, assign the inventory's
|
||||
// item IDs
|
||||
if (this->is_game() && this->check_flag(Lobby::Flag::ITEM_TRACKING_ENABLED)) {
|
||||
this->assign_inventory_item_ids(c);
|
||||
// If the lobby is a game and there was no one in it, reassign all the floor
|
||||
// item IDs and reset the next item IDs
|
||||
if (this->is_game()) {
|
||||
if (leader_index >= this->max_clients) {
|
||||
for (size_t x = 0; x < 12; x++) {
|
||||
this->next_item_id_for_client[x] = 0x00010000 + 0x00200000 * x;
|
||||
}
|
||||
this->next_game_item_id = 0xCC000000;
|
||||
|
||||
// Reassign all floor item IDs so they won't conflict with any players'
|
||||
// item IDs
|
||||
for (auto& m : this->floor_item_managers) {
|
||||
this->next_game_item_id = m.reassign_all_item_ids(this->next_game_item_id);
|
||||
}
|
||||
}
|
||||
// On DC NTE and 11/2000, the game assigns item IDs immediately when a
|
||||
// player joins a game, then assigns them again after the 6x6D equivalent is
|
||||
// received. For this reason, we consume item IDs here only if the client is
|
||||
// NTE or 11/2000.
|
||||
this->assign_inventory_and_bank_item_ids(c, is_pre_v1(c->version()));
|
||||
// On BB, we send artificial flag state to fix an Episode 2 bug where the
|
||||
// CCA door lock state is overwritten by quests.
|
||||
if (c->version() == Version::BB_V4) {
|
||||
c->config.set_flag(Client::Flag::SHOULD_SEND_ARTIFICIAL_FLAG_STATE);
|
||||
}
|
||||
}
|
||||
|
||||
// If the lobby is recording a battle record, add the player join event
|
||||
if (this->battle_record) {
|
||||
auto p = c->game_data.character();
|
||||
auto p = c->character();
|
||||
PlayerLobbyDataDCGC lobby_data;
|
||||
lobby_data.player_tag = 0x00010000;
|
||||
lobby_data.guild_card_number = c->license->serial_number;
|
||||
@@ -228,7 +503,7 @@ void Lobby::add_client(shared_ptr<Client> c, ssize_t required_client_id) {
|
||||
lobby_data,
|
||||
p->inventory,
|
||||
p->disp.to_dcpcv3(c->language(), c->language()),
|
||||
c->game_data.ep3_config ? (c->game_data.ep3_config->online_clv_exp / 100) : 0);
|
||||
c->ep3_config ? (c->ep3_config->online_clv_exp / 100) : 0);
|
||||
}
|
||||
|
||||
// Send spectator count notifications if needed
|
||||
@@ -242,6 +517,12 @@ void Lobby::add_client(shared_ptr<Client> c, ssize_t required_client_id) {
|
||||
send_ep3_update_game_metadata(this->shared_from_this());
|
||||
}
|
||||
}
|
||||
|
||||
// There is a player in the lobby, so it is no longer idle
|
||||
if (event_pending(this->idle_timeout_event.get(), EV_TIMEOUT, nullptr)) {
|
||||
event_del(this->idle_timeout_event.get());
|
||||
this->log.info("Idle timeout cancelled");
|
||||
}
|
||||
}
|
||||
|
||||
void Lobby::remove_client(shared_ptr<Client> c) {
|
||||
@@ -282,6 +563,36 @@ void Lobby::remove_client(shared_ptr<Client> c) {
|
||||
send_ep3_update_game_metadata(this->shared_from_this());
|
||||
}
|
||||
}
|
||||
|
||||
// If there are still players left in the lobby, delete all items that only
|
||||
// the leaving player could see. Don't do this if no one is left in the lobby,
|
||||
// since that would mean items could not persist in empty lobbies.
|
||||
uint16_t remaining_clients_mask = 0;
|
||||
for (size_t z = 0; z < 12; z++) {
|
||||
if (this->clients[z]) {
|
||||
remaining_clients_mask |= (1 << z);
|
||||
}
|
||||
}
|
||||
if (remaining_clients_mask) {
|
||||
for (auto& m : this->floor_item_managers) {
|
||||
m.clear_inaccessible(remaining_clients_mask);
|
||||
}
|
||||
} else {
|
||||
for (auto& m : this->floor_item_managers) {
|
||||
m.clear_private();
|
||||
}
|
||||
}
|
||||
|
||||
if (!remaining_clients_mask &&
|
||||
this->check_flag(Flag::PERSISTENT) &&
|
||||
!this->check_flag(Flag::DEFAULT) &&
|
||||
(this->idle_timeout_usecs > 0)) {
|
||||
// If the lobby is persistent but has an idle timeout, make it expire after
|
||||
// the specified time
|
||||
auto tv = usecs_to_timeval(this->idle_timeout_usecs);
|
||||
event_add(this->idle_timeout_event.get(), &tv);
|
||||
this->log.info("Idle timeout scheduled");
|
||||
}
|
||||
}
|
||||
|
||||
void Lobby::move_client_to_lobby(
|
||||
@@ -318,7 +629,7 @@ shared_ptr<Client> Lobby::find_client(const string* identifier, uint64_t serial_
|
||||
(lc->license->serial_number == serial_number)) {
|
||||
return lc;
|
||||
}
|
||||
if (identifier && (lc->game_data.character()->disp.name.eq(*identifier, lc->language()))) {
|
||||
if (identifier && (lc->character()->disp.name.eq(*identifier, lc->language()))) {
|
||||
return lc;
|
||||
}
|
||||
}
|
||||
@@ -339,35 +650,52 @@ uint8_t Lobby::game_event_for_lobby_event(uint8_t lobby_event) {
|
||||
return lobby_event;
|
||||
}
|
||||
|
||||
bool Lobby::item_exists(uint32_t item_id) const {
|
||||
return this->item_id_to_floor_item.count(item_id);
|
||||
}
|
||||
|
||||
const Lobby::FloorItem& Lobby::find_item(uint32_t item_id) const {
|
||||
return this->item_id_to_floor_item.at(item_id);
|
||||
}
|
||||
|
||||
void Lobby::add_item(const ItemData& data, uint8_t floor, float x, float z) {
|
||||
auto& fi = this->item_id_to_floor_item[data.id];
|
||||
fi.data = data;
|
||||
fi.floor = floor;
|
||||
fi.x = x;
|
||||
fi.z = z;
|
||||
}
|
||||
|
||||
ItemData Lobby::remove_item(uint32_t item_id) {
|
||||
auto item_it = this->item_id_to_floor_item.find(item_id);
|
||||
if (item_it == this->item_id_to_floor_item.end()) {
|
||||
throw out_of_range("item not present");
|
||||
bool Lobby::item_exists(uint8_t floor, uint32_t item_id) const {
|
||||
if (floor >= this->floor_item_managers.size()) {
|
||||
return false;
|
||||
}
|
||||
ItemData ret = item_it->second.data;
|
||||
this->item_id_to_floor_item.erase(item_it);
|
||||
return ret;
|
||||
return this->floor_item_managers.at(floor).exists(item_id);
|
||||
}
|
||||
|
||||
shared_ptr<Lobby::FloorItem> Lobby::find_item(uint8_t floor, uint32_t item_id) const {
|
||||
return this->floor_item_managers.at(floor).find(item_id);
|
||||
}
|
||||
|
||||
void Lobby::add_item(uint8_t floor, const ItemData& data, float x, float z, uint16_t visibility_flags) {
|
||||
auto& m = this->floor_item_managers.at(floor);
|
||||
m.add(data, x, z, visibility_flags);
|
||||
this->evict_items_from_floor(floor);
|
||||
}
|
||||
|
||||
void Lobby::add_item(uint8_t floor, shared_ptr<FloorItem> fi) {
|
||||
auto& m = this->floor_item_managers.at(floor);
|
||||
m.add(fi);
|
||||
this->evict_items_from_floor(floor);
|
||||
}
|
||||
|
||||
void Lobby::evict_items_from_floor(uint8_t floor) {
|
||||
auto& m = this->floor_item_managers.at(floor);
|
||||
auto evicted = m.evict();
|
||||
if (!evicted.empty()) {
|
||||
auto l = this->shared_from_this();
|
||||
for (const auto& fi : evicted) {
|
||||
for (size_t z = 0; z < 12; z++) {
|
||||
auto lc = this->clients[z];
|
||||
if (lc && fi->visible_to_client(z)) {
|
||||
send_destroy_floor_item_to_client(lc, fi->data.id, floor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shared_ptr<Lobby::FloorItem> Lobby::remove_item(uint8_t floor, uint32_t item_id, uint8_t requesting_client_id) {
|
||||
return this->floor_item_managers.at(floor).remove(item_id, requesting_client_id);
|
||||
}
|
||||
|
||||
uint32_t Lobby::generate_item_id(uint8_t client_id) {
|
||||
if (client_id < this->max_clients) {
|
||||
return this->next_item_id[client_id]++;
|
||||
return this->next_item_id_for_client[client_id]++;
|
||||
}
|
||||
return this->next_game_item_id++;
|
||||
}
|
||||
@@ -378,18 +706,30 @@ void Lobby::on_item_id_generated_externally(uint32_t item_id) {
|
||||
// the range further here.
|
||||
if ((item_id > 0x00010000) && (item_id < 0x00810000)) {
|
||||
uint16_t item_client_id = (item_id >> 21) & 0x7FF;
|
||||
uint32_t& next_item_id = this->next_item_id.at(item_client_id);
|
||||
uint32_t& next_item_id = this->next_item_id_for_client.at(item_client_id);
|
||||
next_item_id = std::max<uint32_t>(next_item_id, item_id + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void Lobby::assign_inventory_item_ids(shared_ptr<Client> c) {
|
||||
auto p = c->game_data.character();
|
||||
void Lobby::assign_inventory_and_bank_item_ids(shared_ptr<Client> c, bool consume_ids) {
|
||||
auto p = c->character();
|
||||
uint32_t start_item_id = this->next_item_id_for_client[c->lobby_client_id];
|
||||
for (size_t z = 0; z < p->inventory.num_items; z++) {
|
||||
p->inventory.items[z].data.id = this->generate_item_id(c->lobby_client_id);
|
||||
}
|
||||
c->log.info("Assigned item IDs");
|
||||
p->print_inventory(stderr, c->version(), c->require_server_state()->item_name_index);
|
||||
if (!consume_ids) {
|
||||
this->next_item_id_for_client[c->lobby_client_id] = start_item_id;
|
||||
}
|
||||
if (c->log.info("Assigned inventory item IDs%s", consume_ids ? "" : " but did not mark IDs as used")) {
|
||||
p->print_inventory(stderr, c->version(), c->require_server_state()->item_name_index);
|
||||
if (p->bank.num_items) {
|
||||
p->bank.assign_ids(0x99000000 + (c->lobby_client_id << 20));
|
||||
c->log.info("Assigned bank item IDs");
|
||||
p->print_bank(stderr, c->version(), c->require_server_state()->item_name_index);
|
||||
} else {
|
||||
c->log.info("Bank is empty");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unordered_map<uint32_t, shared_ptr<Client>> Lobby::clients_by_serial_number() const {
|
||||
@@ -401,3 +741,126 @@ unordered_map<uint32_t, shared_ptr<Client>> Lobby::clients_by_serial_number() co
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
QuestIndex::IncludeCondition Lobby::quest_include_condition() const {
|
||||
size_t num_players = this->count_clients();
|
||||
return [this, num_players](shared_ptr<const Quest> q) -> QuestIndex::IncludeState {
|
||||
bool is_enabled = true;
|
||||
for (const auto& lc : this->clients) {
|
||||
if (lc && !lc->can_see_quest(q, this->difficulty, num_players)) {
|
||||
return QuestIndex::IncludeState::HIDDEN;
|
||||
}
|
||||
if (lc && !lc->can_play_quest(q, this->difficulty, num_players)) {
|
||||
is_enabled = false;
|
||||
}
|
||||
}
|
||||
return is_enabled ? QuestIndex::IncludeState::AVAILABLE : QuestIndex::IncludeState::DISABLED;
|
||||
};
|
||||
}
|
||||
|
||||
void Lobby::dispatch_on_idle_timeout(evutil_socket_t, short, void* ctx) {
|
||||
auto l = reinterpret_cast<Lobby*>(ctx)->shared_from_this();
|
||||
if (l->count_clients() == 0) {
|
||||
l->log.info("Idle timeout expired");
|
||||
auto s = l->require_server_state();
|
||||
s->remove_lobby(l);
|
||||
} else {
|
||||
l->log.error("Idle timeout occurred, but clients are present in lobby");
|
||||
event_del(l->idle_timeout_event.get());
|
||||
}
|
||||
}
|
||||
|
||||
bool Lobby::compare_shared(const shared_ptr<const Lobby>& a, const shared_ptr<const Lobby>& b) {
|
||||
// Sort keys:
|
||||
// 1. Priority class: has free space < empty (persistent) < full < non-joinable (in quest/battle)
|
||||
// 2. Password: public < locked
|
||||
// 3. Game mode: Normal < Battle < Challenge < Solo
|
||||
// 4. Episode: 1 < 2 < 4
|
||||
// 5. Difficulty: Normal < Hard < Very Hard < Ultimate
|
||||
// 6. Game name
|
||||
static auto get_priority = +[](const shared_ptr<const Lobby>& l) -> size_t {
|
||||
if (l->check_flag(Lobby::Flag::QUEST_IN_PROGRESS) || l->check_flag(Lobby::Flag::BATTLE_IN_PROGRESS)) {
|
||||
return 4;
|
||||
}
|
||||
size_t num_clients = l->count_clients();
|
||||
if (num_clients == l->max_clients) {
|
||||
return 3;
|
||||
}
|
||||
if (num_clients == 0) {
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
};
|
||||
size_t a_priority = get_priority(a);
|
||||
size_t b_priority = get_priority(b);
|
||||
if (a_priority < b_priority) {
|
||||
return true;
|
||||
} else if (a_priority > b_priority) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a->password.empty() && !b->password.empty()) {
|
||||
return true;
|
||||
} else if (!a->password.empty() && b->password.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t a_mode = static_cast<size_t>(a->mode);
|
||||
size_t b_mode = static_cast<size_t>(b->mode);
|
||||
if (a_mode < b_mode) {
|
||||
return true;
|
||||
} else if (a_mode > b_mode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t a_episode = static_cast<size_t>(a->episode);
|
||||
size_t b_episode = static_cast<size_t>(b->episode);
|
||||
if (a_episode < b_episode) {
|
||||
return true;
|
||||
} else if (a_episode > b_episode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a->difficulty < b->difficulty) {
|
||||
return true;
|
||||
} else if (a->difficulty > b->difficulty) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return a->name < b->name;
|
||||
}
|
||||
|
||||
template <>
|
||||
Lobby::DropMode enum_for_name<Lobby::DropMode>(const char* name) {
|
||||
if (!strcmp(name, "DISABLED")) {
|
||||
return Lobby::DropMode::DISABLED;
|
||||
} else if (!strcmp(name, "CLIENT")) {
|
||||
return Lobby::DropMode::CLIENT;
|
||||
} else if (!strcmp(name, "SERVER_SHARED")) {
|
||||
return Lobby::DropMode::SERVER_SHARED;
|
||||
} else if (!strcmp(name, "SERVER_PRIVATE")) {
|
||||
return Lobby::DropMode::SERVER_PRIVATE;
|
||||
} else if (!strcmp(name, "SERVER_DUPLICATE")) {
|
||||
return Lobby::DropMode::SERVER_DUPLICATE;
|
||||
} else {
|
||||
throw runtime_error("invalid drop mode");
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
const char* name_for_enum<Lobby::DropMode>(Lobby::DropMode value) {
|
||||
switch (value) {
|
||||
case Lobby::DropMode::DISABLED:
|
||||
return "DISABLED";
|
||||
case Lobby::DropMode::CLIENT:
|
||||
return "CLIENT";
|
||||
case Lobby::DropMode::SERVER_SHARED:
|
||||
return "SERVER_SHARED";
|
||||
case Lobby::DropMode::SERVER_PRIVATE:
|
||||
return "SERVER_PRIVATE";
|
||||
case Lobby::DropMode::SERVER_DUPLICATE:
|
||||
return "SERVER_DUPLICATE";
|
||||
default:
|
||||
throw runtime_error("invalid drop mode");
|
||||
}
|
||||
}
|
||||
|
||||
+78
-24
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <event2/event.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <array>
|
||||
@@ -16,7 +17,6 @@
|
||||
#include "Episode3/Server.hh"
|
||||
#include "ItemCreator.hh"
|
||||
#include "Map.hh"
|
||||
#include "Player.hh"
|
||||
#include "Quest.hh"
|
||||
#include "StaticGameData.hh"
|
||||
#include "Text.hh"
|
||||
@@ -24,6 +24,35 @@
|
||||
struct ServerState;
|
||||
|
||||
struct Lobby : public std::enable_shared_from_this<Lobby> {
|
||||
struct FloorItem {
|
||||
ItemData data;
|
||||
float x;
|
||||
float z;
|
||||
uint64_t drop_number;
|
||||
uint16_t visibility_flags;
|
||||
|
||||
bool visible_to_client(uint8_t client_id) const;
|
||||
};
|
||||
struct FloorItemManager {
|
||||
PrefixedLogger log;
|
||||
uint64_t next_drop_number;
|
||||
std::unordered_map<uint32_t, std::shared_ptr<FloorItem>> items; // Keyed on item_id
|
||||
std::array<std::map<uint64_t, std::shared_ptr<FloorItem>>, 12> queue_for_client;
|
||||
|
||||
FloorItemManager(uint32_t lobby_id, uint8_t floor);
|
||||
~FloorItemManager() = default;
|
||||
|
||||
bool exists(uint32_t item_id) const;
|
||||
std::shared_ptr<FloorItem> find(uint32_t item_id) const;
|
||||
void add(const ItemData& item, float x, float z, uint16_t visibility_flags);
|
||||
void add(std::shared_ptr<FloorItem> fi);
|
||||
std::shared_ptr<FloorItem> remove(uint32_t item_id, uint8_t client_id);
|
||||
std::unordered_set<std::shared_ptr<FloorItem>> evict();
|
||||
void clear_inaccessible(uint16_t remaining_clients_mask);
|
||||
void clear_private();
|
||||
void clear();
|
||||
uint32_t reassign_all_item_ids(uint32_t next_item_id);
|
||||
};
|
||||
enum class Flag {
|
||||
GAME = 0x00000001,
|
||||
PERSISTENT = 0x00000002,
|
||||
@@ -33,22 +62,26 @@ struct Lobby : public std::enable_shared_from_this<Lobby> {
|
||||
QUEST_IN_PROGRESS = 0x00000200,
|
||||
BATTLE_IN_PROGRESS = 0x00000400,
|
||||
JOINABLE_QUEST_IN_PROGRESS = 0x00000800,
|
||||
ITEM_TRACKING_ENABLED = 0x00001000,
|
||||
IS_SPECTATOR_TEAM = 0x00002000, // episode must be EP3 also
|
||||
SPECTATORS_FORBIDDEN = 0x00004000,
|
||||
START_BATTLE_PLAYER_IMMEDIATELY = 0x00008000,
|
||||
DROPS_ENABLED = 0x00020000,
|
||||
CANNOT_CHANGE_DROPS_ENABLED = 0x00040000,
|
||||
CANNOT_CHANGE_ITEM_TABLE = 0x00080000,
|
||||
CANNOT_CHANGE_CHEAT_MODE = 0x00100000,
|
||||
CANNOT_CHANGE_CHEAT_MODE = 0x00010000,
|
||||
|
||||
// Flags used only for lobbies
|
||||
PUBLIC = 0x01000000,
|
||||
DEFAULT = 0x02000000,
|
||||
IS_OVERFLOW = 0x08000000,
|
||||
};
|
||||
enum class DropMode {
|
||||
DISABLED = 0,
|
||||
CLIENT = 1, // Not allowed for BB games
|
||||
SERVER_SHARED = 2,
|
||||
SERVER_PRIVATE = 3,
|
||||
SERVER_DUPLICATE = 4,
|
||||
};
|
||||
|
||||
std::weak_ptr<ServerState> server_state;
|
||||
std::weak_ptr<ServerState>
|
||||
server_state;
|
||||
PrefixedLogger log;
|
||||
|
||||
uint32_t lobby_id;
|
||||
@@ -56,17 +89,14 @@ struct Lobby : public std::enable_shared_from_this<Lobby> {
|
||||
uint32_t min_level;
|
||||
uint32_t max_level;
|
||||
|
||||
// Item info
|
||||
struct FloorItem {
|
||||
ItemData data;
|
||||
float x;
|
||||
float z;
|
||||
uint8_t floor;
|
||||
};
|
||||
std::shared_ptr<Map> map;
|
||||
std::array<uint32_t, 12> next_item_id;
|
||||
// Item state
|
||||
std::array<uint32_t, 12> next_item_id_for_client;
|
||||
uint32_t next_game_item_id;
|
||||
std::unordered_map<uint32_t, FloorItem> item_id_to_floor_item;
|
||||
std::vector<FloorItemManager> floor_item_managers;
|
||||
|
||||
// Map state
|
||||
std::shared_ptr<const Map::RareEnemyRates> rare_enemy_rates;
|
||||
std::shared_ptr<Map> map;
|
||||
parray<le_uint32_t, 0x20> variations;
|
||||
|
||||
// Game config
|
||||
@@ -86,6 +116,8 @@ struct Lobby : public std::enable_shared_from_this<Lobby> {
|
||||
// This seed is also sent to the client for rare enemy generation
|
||||
uint32_t random_seed;
|
||||
std::shared_ptr<PSOLFGEncryption> random_crypt;
|
||||
uint8_t allowed_drop_modes;
|
||||
DropMode drop_mode;
|
||||
std::shared_ptr<ItemCreator> item_creator;
|
||||
|
||||
struct ChallengeParameters {
|
||||
@@ -101,8 +133,8 @@ struct Lobby : public std::enable_shared_from_this<Lobby> {
|
||||
std::shared_ptr<ChallengeParameters> challenge_params;
|
||||
|
||||
// Ep3 stuff
|
||||
// There are three kinds of Episode 3 games. All of these types have the flag
|
||||
// EPISODE_3_ONLY; types 2 and 3 additionally have the IS_SPECTATOR_TEAM flag.
|
||||
// There are three kinds of Episode 3 games. All of these types have episode
|
||||
// set to EP3; types 2 and 3 additionally have the IS_SPECTATOR_TEAM flag.
|
||||
// 1. Primary games. These are the lobbies where battles may take place.
|
||||
// 2. Watcher games. These lobbies receive all the battle and chat commands
|
||||
// from a primary game. (This the implementation of spectator teams.)
|
||||
@@ -130,9 +162,15 @@ struct Lobby : public std::enable_shared_from_this<Lobby> {
|
||||
// Keys in this map are client_id
|
||||
std::unordered_map<size_t, std::weak_ptr<Client>> clients_to_add;
|
||||
|
||||
// This is only used when the PERSISTENT flag is set and idle_timeout_usecs
|
||||
// is not zero
|
||||
uint64_t idle_timeout_usecs;
|
||||
std::unique_ptr<struct event, void (*)(struct event*)> idle_timeout_event;
|
||||
|
||||
Lobby(std::shared_ptr<ServerState> s, uint32_t id);
|
||||
Lobby(const Lobby&) = delete;
|
||||
Lobby(Lobby&&) = delete;
|
||||
~Lobby();
|
||||
Lobby& operator=(const Lobby&) = delete;
|
||||
Lobby& operator=(Lobby&&) = delete;
|
||||
|
||||
@@ -151,7 +189,9 @@ struct Lobby : public std::enable_shared_from_this<Lobby> {
|
||||
|
||||
std::shared_ptr<ServerState> require_server_state() const;
|
||||
std::shared_ptr<ChallengeParameters> require_challenge_params() const;
|
||||
void set_drop_mode(DropMode new_mode);
|
||||
void create_item_creator();
|
||||
void load_maps();
|
||||
void create_ep3_server();
|
||||
|
||||
[[nodiscard]] inline bool is_game() const {
|
||||
@@ -184,15 +224,29 @@ struct Lobby : public std::enable_shared_from_this<Lobby> {
|
||||
const std::string* identifier = nullptr,
|
||||
uint64_t serial_number = 0);
|
||||
|
||||
bool item_exists(uint32_t item_id) const;
|
||||
const FloorItem& find_item(uint32_t item_id) const;
|
||||
void add_item(const ItemData& item, uint8_t floor, float x, float z);
|
||||
ItemData remove_item(uint32_t item_id);
|
||||
bool item_exists(uint8_t floor, uint32_t item_id) const;
|
||||
std::shared_ptr<FloorItem> find_item(uint8_t floor, uint32_t item_id) const;
|
||||
void add_item(uint8_t floor, const ItemData& item, float x, float z, uint16_t visibility_flags);
|
||||
void add_item(uint8_t floor, std::shared_ptr<FloorItem>);
|
||||
void evict_items_from_floor(uint8_t floor);
|
||||
std::shared_ptr<FloorItem> remove_item(uint8_t floor, uint32_t item_id, uint8_t requesting_client_id);
|
||||
|
||||
uint32_t generate_item_id(uint8_t client_id);
|
||||
void on_item_id_generated_externally(uint32_t item_id);
|
||||
void assign_inventory_item_ids(std::shared_ptr<Client> c);
|
||||
void assign_inventory_and_bank_item_ids(std::shared_ptr<Client> c, bool consume_ids);
|
||||
|
||||
QuestIndex::IncludeCondition quest_include_condition() const;
|
||||
|
||||
static uint8_t game_event_for_lobby_event(uint8_t lobby_event);
|
||||
|
||||
std::unordered_map<uint32_t, std::shared_ptr<Client>> clients_by_serial_number() const;
|
||||
|
||||
static void dispatch_on_idle_timeout(evutil_socket_t, short, void* ctx);
|
||||
|
||||
static bool compare_shared(const std::shared_ptr<const Lobby>& a, const std::shared_ptr<const Lobby>& b);
|
||||
};
|
||||
|
||||
template <>
|
||||
Lobby::DropMode enum_for_name<Lobby::DropMode>(const char* name);
|
||||
template <>
|
||||
const char* name_for_enum<Lobby::DropMode>(Lobby::DropMode value);
|
||||
|
||||
+114
-38
@@ -100,6 +100,8 @@ Version get_cli_version(Arguments& args) {
|
||||
return Version::DC_V1;
|
||||
} else if (args.get<bool>("dc-v2") || args.get<bool>("dc")) {
|
||||
return Version::DC_V2;
|
||||
} else if (args.get<bool>("pc-nte")) {
|
||||
return Version::PC_NTE;
|
||||
} else if (args.get<bool>("pc")) {
|
||||
return Version::PC_V2;
|
||||
} else if (args.get<bool>("gc-nte")) {
|
||||
@@ -361,15 +363,16 @@ static void a_encrypt_decrypt_fn(Arguments& args) {
|
||||
case Version::DC_V1_11_2000_PROTOTYPE:
|
||||
case Version::DC_V1:
|
||||
case Version::DC_V2:
|
||||
case Version::PC_NTE:
|
||||
case Version::PC_V2:
|
||||
case Version::GC_NTE:
|
||||
crypt.reset(new PSOV2Encryption(stoul(seed, nullptr, 16)));
|
||||
crypt = make_shared<PSOV2Encryption>(stoul(seed, nullptr, 16));
|
||||
break;
|
||||
case Version::GC_V3:
|
||||
case Version::XB_V3:
|
||||
case Version::GC_EP3_TRIAL_EDITION:
|
||||
case Version::GC_EP3:
|
||||
crypt.reset(new PSOV3Encryption(stoul(seed, nullptr, 16)));
|
||||
crypt = make_shared<PSOV3Encryption>(stoul(seed, nullptr, 16));
|
||||
break;
|
||||
case Version::BB_V4: {
|
||||
string key_name = args.get<string>("key");
|
||||
@@ -378,7 +381,7 @@ static void a_encrypt_decrypt_fn(Arguments& args) {
|
||||
}
|
||||
seed = parse_data_string(seed, nullptr, ParseDataFlags::ALLOW_FILES);
|
||||
auto key = load_object_file<PSOBBEncryption::KeyFile>("system/blueburst/keys/" + key_name + ".nsk");
|
||||
crypt.reset(new PSOBBEncryption(key, seed.data(), seed.size()));
|
||||
crypt = make_shared<PSOBBEncryption>(key, seed.data(), seed.size());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -1003,14 +1006,14 @@ Action a_encode_qst(
|
||||
string pvr_filename = ends_with(bin_filename, ".bin")
|
||||
? (bin_filename.substr(0, bin_filename.size() - 3) + "pvr")
|
||||
: (bin_filename + ".pvr");
|
||||
shared_ptr<string> bin_data(new string(load_file(bin_filename)));
|
||||
shared_ptr<string> dat_data(new string(load_file(dat_filename)));
|
||||
auto bin_data = make_shared<string>(load_file(bin_filename));
|
||||
auto dat_data = make_shared<string>(load_file(dat_filename));
|
||||
shared_ptr<string> pvr_data;
|
||||
try {
|
||||
pvr_data.reset(new string(load_file(pvr_filename)));
|
||||
pvr_data = make_shared<string>(load_file(pvr_filename));
|
||||
} catch (const cannot_open_file&) {
|
||||
}
|
||||
shared_ptr<VersionedQuest> vq(new VersionedQuest(0, 0, version, 0, bin_data, dat_data, pvr_data));
|
||||
auto vq = make_shared<VersionedQuest>(0, 0, version, 0, bin_data, dat_data, pvr_data);
|
||||
if (download) {
|
||||
vq = vq->create_download_quest();
|
||||
}
|
||||
@@ -1025,7 +1028,9 @@ Action a_disassemble_quest_script(
|
||||
Disassemble the input quest script (.bin file) into a text representation\n\
|
||||
of the commands and metadata it contains. Specify the quest\'s game version\n\
|
||||
with one of the --dc-nte, --dc-v1, --dc-v2, --pc, --gc-nte, --gc, --gc-ep3,\n\
|
||||
--xb, or --bb options.\n",
|
||||
--xb, or --bb options. If you intend to edit and reassemble the script, use\n\
|
||||
the --reassembly option to add explicit label numbers and remove offsets\n\
|
||||
and data in code sections.\n",
|
||||
+[](Arguments& args) {
|
||||
string data = read_input_data(args);
|
||||
auto version = get_cli_version(args);
|
||||
@@ -1033,15 +1038,15 @@ Action a_disassemble_quest_script(
|
||||
data = prs_decompress(data);
|
||||
}
|
||||
uint8_t language = args.get<bool>("japanese") ? 0 : 1;
|
||||
string result = disassemble_quest_script(data.data(), data.size(), version, language);
|
||||
bool reassembly_mode = args.get<bool>("reassembly");
|
||||
string result = disassemble_quest_script(data.data(), data.size(), version, language, reassembly_mode);
|
||||
write_output_data(args, result.data(), result.size(), "txt");
|
||||
});
|
||||
Action a_disassemble_quest_map(
|
||||
"disassemble-quest-map", "\
|
||||
disassemble-quest-map [INPUT-FILENAME [OUTPUT-FILENAME]]\n\
|
||||
Disassemble the input quest map (.dat file) into a text representation of\n\
|
||||
the data it contains. Specify the quest\'s game version with one of the\n\
|
||||
--dc-nte, --dc-v1, --dc-v2, --pc, --gc-nte, --gc, --xb, or --bb options.\n",
|
||||
the data it contains.\n",
|
||||
+[](Arguments& args) {
|
||||
string data = read_input_data(args);
|
||||
if (!args.get<bool>("decompressed")) {
|
||||
@@ -1051,6 +1056,22 @@ Action a_disassemble_quest_map(
|
||||
write_output_data(args, result.data(), result.size(), "txt");
|
||||
});
|
||||
|
||||
Action a_assemble_quest_script(
|
||||
"assemble-quest-script", "\
|
||||
assemble-quest-script [INPUT-FILENAME [OUTPUT-FILENAME]]\n\
|
||||
Assemble the input quest script (.txt file) into a compressed .bin file\n\
|
||||
usable as an online quest script. If --decompressed is given, produces an\n\
|
||||
uncompressed .bind file instead.\n",
|
||||
+[](Arguments& args) {
|
||||
string text = read_input_data(args);
|
||||
string result = assemble_quest_script(text);
|
||||
bool compress = !args.get<bool>("decompressed");
|
||||
if (compress) {
|
||||
result = prs_compress_optimal(result);
|
||||
}
|
||||
write_output_data(args, result.data(), result.size(), compress ? "bin" : "bind");
|
||||
});
|
||||
|
||||
void a_extract_archive_fn(Arguments& args) {
|
||||
string output_prefix = args.get<string>(2, false);
|
||||
if (output_prefix == "-") {
|
||||
@@ -1064,7 +1085,7 @@ void a_extract_archive_fn(Arguments& args) {
|
||||
}
|
||||
|
||||
string data = read_input_data(args);
|
||||
shared_ptr<string> data_shared(new string(std::move(data)));
|
||||
auto data_shared = make_shared<string>(std::move(data));
|
||||
|
||||
if (args.get<string>(0) == "extract-afs") {
|
||||
AFSArchive arch(data_shared);
|
||||
@@ -1121,6 +1142,13 @@ Action a_extract_bml("extract-bml", "\
|
||||
PC/BB format.\n",
|
||||
a_extract_archive_fn);
|
||||
|
||||
Action a_decode_sjis(
|
||||
"decode-sjis", nullptr, +[](Arguments& args) {
|
||||
string data = read_input_data(args);
|
||||
string result = tt_sjis_to_utf8(data);
|
||||
write_output_data(args, result.data(), result.size(), "txt");
|
||||
});
|
||||
|
||||
Action a_decode_text_archive(
|
||||
"decode-text-archive", nullptr, +[](Arguments& args) {
|
||||
string data = read_input_data(args);
|
||||
@@ -1213,8 +1241,8 @@ Action a_cat_client(
|
||||
if (key_file_name.empty()) {
|
||||
throw runtime_error("a key filename is required for BB client emulation");
|
||||
}
|
||||
key.reset(new PSOBBEncryption::KeyFile(
|
||||
load_object_file<PSOBBEncryption::KeyFile>("system/blueburst/keys/" + key_file_name + ".nsk")));
|
||||
key = make_shared<PSOBBEncryption::KeyFile>(
|
||||
load_object_file<PSOBBEncryption::KeyFile>("system/blueburst/keys/" + key_file_name + ".nsk"));
|
||||
}
|
||||
shared_ptr<struct event_base> base(event_base_new(), event_base_free);
|
||||
auto cat_client_remote = make_sockaddr_storage(parse_netloc(args.get<string>(1))).first;
|
||||
@@ -1246,18 +1274,18 @@ Action a_convert_rare_item_set(
|
||||
}
|
||||
auto version = get_cli_version(args);
|
||||
|
||||
shared_ptr<string> data(new string(read_input_data(args)));
|
||||
auto data = make_shared<string>(read_input_data(args));
|
||||
shared_ptr<RareItemSet> rs;
|
||||
if (ends_with(input_filename, ".json")) {
|
||||
rs.reset(new RareItemSet(JSON::parse(*data), version, name_index));
|
||||
rs = make_shared<RareItemSet>(JSON::parse(*data), version, name_index);
|
||||
} else if (ends_with(input_filename, ".gsl")) {
|
||||
rs.reset(new RareItemSet(GSLArchive(data, false), false));
|
||||
rs = make_shared<RareItemSet>(GSLArchive(data, false), false);
|
||||
} else if (ends_with(input_filename, ".gslb")) {
|
||||
rs.reset(new RareItemSet(GSLArchive(data, true), true));
|
||||
rs = make_shared<RareItemSet>(GSLArchive(data, true), true);
|
||||
} else if (ends_with(input_filename, ".afs")) {
|
||||
rs.reset(new RareItemSet(AFSArchive(data), is_v1(version)));
|
||||
rs = make_shared<RareItemSet>(AFSArchive(data), is_v1(version));
|
||||
} else if (ends_with(input_filename, ".rel")) {
|
||||
rs.reset(new RareItemSet(*data, true));
|
||||
rs = make_shared<RareItemSet>(*data, true);
|
||||
} else {
|
||||
throw runtime_error("cannot determine input format; use a filename ending with .json, .gsl, .gslb, .afs, or .rel");
|
||||
}
|
||||
@@ -1296,11 +1324,11 @@ Action a_describe_item(
|
||||
JSON::parse(load_file("system/item-tables/names-v2.json")),
|
||||
JSON::parse(load_file("system/item-tables/names-v3.json")),
|
||||
JSON::parse(load_file("system/item-tables/names-v4.json")));
|
||||
shared_ptr<string> pmt_data_v2(new string(prs_decompress(load_file("system/item-tables/ItemPMT-v2.prs"))));
|
||||
auto pmt_data_v2 = make_shared<string>(prs_decompress(load_file("system/item-tables/ItemPMT-v2.prs")));
|
||||
auto pmt_v2 = make_shared<ItemParameterTable>(pmt_data_v2, ItemParameterTable::Version::V2);
|
||||
shared_ptr<string> pmt_data_v3(new string(prs_decompress(load_file("system/item-tables/ItemPMT-gc.prs"))));
|
||||
auto pmt_data_v3 = make_shared<string>(prs_decompress(load_file("system/item-tables/ItemPMT-gc.prs")));
|
||||
auto pmt_v3 = make_shared<ItemParameterTable>(pmt_data_v3, ItemParameterTable::Version::V3);
|
||||
shared_ptr<string> pmt_data_v4(new string(prs_decompress(load_file("system/item-tables/ItemPMT-bb.prs"))));
|
||||
auto pmt_data_v4 = make_shared<string>(prs_decompress(load_file("system/item-tables/ItemPMT-bb.prs")));
|
||||
auto pmt_v4 = make_shared<ItemParameterTable>(pmt_data_v4, ItemParameterTable::Version::V4);
|
||||
|
||||
ItemData item = name_index->parse_item_description(version, description);
|
||||
@@ -1375,7 +1403,7 @@ Action a_show_ep3_cards(
|
||||
unique_ptr<TextArchive> text_english;
|
||||
try {
|
||||
JSON json = JSON::parse(load_file("system/ep3/text-english.json"));
|
||||
text_english.reset(new TextArchive(json));
|
||||
text_english = make_unique<TextArchive>(json);
|
||||
} catch (const exception& e) {
|
||||
}
|
||||
|
||||
@@ -1426,7 +1454,7 @@ Action a_generate_ep3_cards_html(
|
||||
unique_ptr<TextArchive> text_english;
|
||||
try {
|
||||
JSON json = JSON::parse(load_file("system/ep3/text-english.json"));
|
||||
text_english.reset(new TextArchive(json));
|
||||
text_english = make_unique<TextArchive>(json);
|
||||
} catch (const exception& e) {
|
||||
}
|
||||
|
||||
@@ -1574,6 +1602,34 @@ Action a_show_ep3_maps(
|
||||
}
|
||||
});
|
||||
|
||||
Action a_show_battle_params(
|
||||
"show-battle-params", "\
|
||||
show-battle-params\n\
|
||||
Print the Blue Burst battle parameters from the system/blueburst directory\n\
|
||||
in a human-readable format.\n",
|
||||
+[](Arguments&) {
|
||||
BattleParamsIndex index(
|
||||
make_shared<string>(load_file("system/blueburst/BattleParamEntry_on.dat")),
|
||||
make_shared<string>(load_file("system/blueburst/BattleParamEntry_lab_on.dat")),
|
||||
make_shared<string>(load_file("system/blueburst/BattleParamEntry_ep4_on.dat")),
|
||||
make_shared<string>(load_file("system/blueburst/BattleParamEntry.dat")),
|
||||
make_shared<string>(load_file("system/blueburst/BattleParamEntry_lab.dat")),
|
||||
make_shared<string>(load_file("system/blueburst/BattleParamEntry_ep4.dat")));
|
||||
|
||||
fprintf(stdout, "Episode 1 multi\n");
|
||||
index.get_table(false, Episode::EP1).print(stdout);
|
||||
fprintf(stdout, "Episode 1 solo\n");
|
||||
index.get_table(true, Episode::EP1).print(stdout);
|
||||
fprintf(stdout, "Episode 2 multi\n");
|
||||
index.get_table(false, Episode::EP2).print(stdout);
|
||||
fprintf(stdout, "Episode 2 solo\n");
|
||||
index.get_table(true, Episode::EP2).print(stdout);
|
||||
fprintf(stdout, "Episode 4 multi\n");
|
||||
index.get_table(false, Episode::EP4).print(stdout);
|
||||
fprintf(stdout, "Episode 4 solo\n");
|
||||
index.get_table(true, Episode::EP4).print(stdout);
|
||||
});
|
||||
|
||||
Action a_parse_object_graph(
|
||||
"parse-object-graph", nullptr, +[](Arguments& args) {
|
||||
uint32_t root_object_address = args.get<uint32_t>("root", Arguments::IntFormat::HEX);
|
||||
@@ -1679,8 +1735,24 @@ Action a_ar_code_translator(
|
||||
run_ar_code_translator(dir, args.get<string>(2, false), args.get<string>(3, false));
|
||||
});
|
||||
|
||||
Action a_diff_dol_files(
|
||||
"diff-dol-files", nullptr, +[](Arguments& args) {
|
||||
const string& a_filename = args.get<string>(1);
|
||||
const string& b_filename = args.get<string>(2);
|
||||
auto result = diff_dol_files(a_filename, b_filename);
|
||||
for (const auto& it : result) {
|
||||
string data = format_data_string(it.second, nullptr, FormatDataFlags::HEX_ONLY);
|
||||
fprintf(stdout, "%08" PRIX32 " %s\n", it.first, data.c_str());
|
||||
}
|
||||
});
|
||||
|
||||
Action a_run_server_replay_log(
|
||||
"", nullptr, +[](Arguments& args) {
|
||||
if (!isdir("system/players")) {
|
||||
config_log.info("Players directory does not exist; creating it");
|
||||
mkdir("system/players", 0755);
|
||||
}
|
||||
|
||||
string config_filename = args.get<string>("config");
|
||||
const string& replay_log_filename = args.get<string>("replay-log");
|
||||
bool is_replay = !replay_log_filename.empty();
|
||||
@@ -1698,14 +1770,13 @@ Action a_run_server_replay_log(
|
||||
}
|
||||
|
||||
shared_ptr<struct event_base> base(event_base_new(), event_base_free);
|
||||
shared_ptr<ServerState> state(new ServerState(config_filename, is_replay));
|
||||
auto state = make_shared<ServerState>(base, config_filename, is_replay);
|
||||
state->init();
|
||||
|
||||
shared_ptr<DNSServer> dns_server;
|
||||
if (state->dns_server_port && !is_replay) {
|
||||
config_log.info("Starting DNS server on port %hu", state->dns_server_port);
|
||||
dns_server.reset(new DNSServer(base, state->local_address,
|
||||
state->external_address));
|
||||
dns_server = make_shared<DNSServer>(base, state->local_address, state->external_address);
|
||||
dns_server->listen("", state->dns_server_port);
|
||||
} else {
|
||||
config_log.info("DNS server is disabled");
|
||||
@@ -1716,9 +1787,9 @@ Action a_run_server_replay_log(
|
||||
shared_ptr<IPStackSimulator> ip_stack_simulator;
|
||||
if (is_replay) {
|
||||
config_log.info("Starting proxy server");
|
||||
state->proxy_server.reset(new ProxyServer(base, state));
|
||||
state->proxy_server = make_shared<ProxyServer>(base, state);
|
||||
config_log.info("Starting game server");
|
||||
state->game_server.reset(new Server(base, state));
|
||||
state->game_server = make_shared<Server>(base, state);
|
||||
|
||||
auto nop_destructor = +[](FILE*) {};
|
||||
shared_ptr<FILE> log_f(stdin, nop_destructor);
|
||||
@@ -1726,7 +1797,7 @@ Action a_run_server_replay_log(
|
||||
log_f = fopen_shared(replay_log_filename, "rt");
|
||||
}
|
||||
|
||||
replay_session.reset(new ReplaySession(base, log_f.get(), state, args.get<bool>("require-basic-credentials")));
|
||||
replay_session = make_shared<ReplaySession>(base, log_f.get(), state, args.get<bool>("require-basic-credentials"));
|
||||
replay_session->start();
|
||||
|
||||
} else {
|
||||
@@ -1736,7 +1807,7 @@ Action a_run_server_replay_log(
|
||||
if (pc->behavior == ServerBehavior::PROXY_SERVER) {
|
||||
if (!state->proxy_server.get()) {
|
||||
config_log.info("Starting proxy server");
|
||||
state->proxy_server.reset(new ProxyServer(base, state));
|
||||
state->proxy_server = make_shared<ProxyServer>(base, state);
|
||||
}
|
||||
if (state->proxy_server.get()) {
|
||||
// For PC and GC, proxy sessions are dynamically created when a client
|
||||
@@ -1761,20 +1832,25 @@ Action a_run_server_replay_log(
|
||||
} else {
|
||||
if (!state->game_server.get()) {
|
||||
config_log.info("Starting game server");
|
||||
state->game_server.reset(new Server(base, state));
|
||||
state->game_server = make_shared<Server>(base, state);
|
||||
}
|
||||
string spec = string_printf("T-%hu-%s-%s-%s", pc->port, name_for_enum(pc->version), pc->name.c_str(), name_for_enum(pc->behavior));
|
||||
state->game_server->listen(spec, "", pc->port, pc->version, pc->behavior);
|
||||
}
|
||||
}
|
||||
|
||||
if (!state->ip_stack_addresses.empty()) {
|
||||
config_log.info("Starting IP stack simulator");
|
||||
ip_stack_simulator.reset(new IPStackSimulator(base, state));
|
||||
if (!state->ip_stack_addresses.empty() || !state->ppp_stack_addresses.empty()) {
|
||||
config_log.info("Starting IP/PPP stack simulator");
|
||||
ip_stack_simulator = make_shared<IPStackSimulator>(base, state);
|
||||
for (const auto& it : state->ip_stack_addresses) {
|
||||
auto netloc = parse_netloc(it);
|
||||
string spec = (netloc.second == 0) ? ("T-IPS-" + netloc.first) : string_printf("T-IPS-%hu", netloc.second);
|
||||
ip_stack_simulator->listen(spec, netloc.first, netloc.second);
|
||||
ip_stack_simulator->listen(spec, netloc.first, netloc.second, FrameInfo::LinkType::ETHERNET);
|
||||
}
|
||||
for (const auto& it : state->ppp_stack_addresses) {
|
||||
auto netloc = parse_netloc(it);
|
||||
string spec = (netloc.second == 0) ? ("T-PPPS-" + netloc.first) : string_printf("T-PPPS-%hu", netloc.second);
|
||||
ip_stack_simulator->listen(spec, netloc.first, netloc.second, FrameInfo::LinkType::HDLC);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1796,7 +1872,7 @@ Action a_run_server_replay_log(
|
||||
should_run_shell = !replay_session.get();
|
||||
}
|
||||
if (should_run_shell) {
|
||||
shell.reset(new ServerShell(base, state));
|
||||
shell = make_shared<ServerShell>(base, state);
|
||||
}
|
||||
|
||||
config_log.info("Ready");
|
||||
|
||||
+139
-138
@@ -14,6 +14,39 @@ using namespace std;
|
||||
|
||||
static constexpr float UINT32_MAX_AS_FLOAT = 4294967296.0f;
|
||||
|
||||
Map::RareEnemyRates::RareEnemyRates(uint32_t enemy_rate, uint32_t boss_rate)
|
||||
: hildeblue(enemy_rate),
|
||||
rappy(enemy_rate),
|
||||
nar_lily(enemy_rate),
|
||||
pouilly_slime(enemy_rate),
|
||||
merissa_aa(enemy_rate),
|
||||
pazuzu(enemy_rate),
|
||||
dorphon_eclair(enemy_rate),
|
||||
kondrieu(boss_rate) {}
|
||||
|
||||
Map::RareEnemyRates::RareEnemyRates(const JSON& json)
|
||||
: hildeblue(json.get_int("Hildeblue")),
|
||||
rappy(json.get_int("Rappy")),
|
||||
nar_lily(json.get_int("NarLily")),
|
||||
pouilly_slime(json.get_int("PouillySlime")),
|
||||
merissa_aa(json.get_int("MerissaAA")),
|
||||
pazuzu(json.get_int("Pazuzu")),
|
||||
dorphon_eclair(json.get_int("DorphonEclair")),
|
||||
kondrieu(json.get_int("Kondrieu")) {}
|
||||
|
||||
JSON Map::RareEnemyRates::json() const {
|
||||
return JSON::dict({
|
||||
{"Hildeblue", this->hildeblue},
|
||||
{"Rappy", this->rappy},
|
||||
{"NarLily", this->nar_lily},
|
||||
{"PouillySlime", this->pouilly_slime},
|
||||
{"MerissaAA", this->merissa_aa},
|
||||
{"Pazuzu", this->pazuzu},
|
||||
{"DorphonEclair", this->dorphon_eclair},
|
||||
{"Kondrieu", this->kondrieu},
|
||||
});
|
||||
}
|
||||
|
||||
string Map::ObjectEntry::str() const {
|
||||
return string_printf("[ObjectEntry type=%04hX flags=%04hX index=%04hX a2=%04hX entity_id=%04hX group=%04hX section=%04hX a3=%04hX x=%g y=%g z=%g x_angle=%08" PRIX32 " y_angle=%08" PRIX32 " z_angle=%08" PRIX32 " params=[%g %g %g %08" PRIX32 " %08" PRIX32 " %08" PRIX32 "] unused=%08" PRIX32 "]",
|
||||
this->base_type.load(),
|
||||
@@ -76,8 +109,8 @@ Map::Enemy::Enemy(size_t source_index, uint8_t floor, EnemyType type)
|
||||
}
|
||||
|
||||
string Map::Enemy::str() const {
|
||||
return string_printf("[Map::Enemy source %zX %s flags=%02hhX last_hit_by_client_id=%hu]",
|
||||
this->source_index, name_for_enum(this->type), this->state_flags, this->last_hit_by_client_id);
|
||||
return string_printf("[Map::Enemy source %zX %s floor=%02hhX flags=%02hhX last_hit_by_client_id=%hu]",
|
||||
this->source_index, name_for_enum(this->type), this->floor, this->state_flags, this->last_hit_by_client_id);
|
||||
}
|
||||
|
||||
string Map::Object::str(shared_ptr<const ItemNameIndex> name_index) const {
|
||||
@@ -98,6 +131,9 @@ string Map::Object::str(shared_ptr<const ItemNameIndex> name_index) const {
|
||||
}
|
||||
}
|
||||
|
||||
Map::Map(uint32_t lobby_id)
|
||||
: log(string_printf("[Lobby:%08" PRIX32 ":map] ", lobby_id), lobby_log.min_level) {}
|
||||
|
||||
void Map::clear() {
|
||||
this->objects.clear();
|
||||
this->enemies.clear();
|
||||
@@ -145,7 +181,7 @@ void Map::add_enemy(
|
||||
uint8_t floor,
|
||||
size_t index,
|
||||
const EnemyEntry& e,
|
||||
const RareEnemyRates& rare_rates) {
|
||||
std::shared_ptr<const RareEnemyRates> rare_rates) {
|
||||
auto add = [&](EnemyType type) -> void {
|
||||
this->enemies.emplace_back(index, floor, type);
|
||||
};
|
||||
@@ -213,17 +249,18 @@ void Map::add_enemy(
|
||||
case 0x00FD: // TObjNpcNgcBase
|
||||
case 0x00FE: // TObjNpcNgcBase
|
||||
case 0x00FF: // TObjNpcNgcBase
|
||||
case 0x0100: // Unknown NPC
|
||||
// All of these have a default child count of zero
|
||||
add(EnemyType::NON_ENEMY_NPC);
|
||||
break;
|
||||
|
||||
case 0x0040: // TObjEneMoja
|
||||
add(this->check_and_log_rare_enemy(e.uparam1 & 0x01, rare_rates.hildeblue)
|
||||
add(this->check_and_log_rare_enemy(e.uparam1 & 0x01, rare_rates->hildeblue)
|
||||
? EnemyType::HILDEBLUE
|
||||
: EnemyType::HILDEBEAR);
|
||||
break;
|
||||
case 0x0041: { // TObjEneLappy
|
||||
bool is_rare = this->check_and_log_rare_enemy(e.uparam1 & 0x01, rare_rates.rappy);
|
||||
bool is_rare = this->check_and_log_rare_enemy(e.uparam1 & 0x01, rare_rates->rappy);
|
||||
switch (episode) {
|
||||
case Episode::EP1:
|
||||
add(is_rare ? EnemyType::AL_RAPPY : EnemyType::RAG_RAPPY);
|
||||
@@ -261,6 +298,7 @@ void Map::add_enemy(
|
||||
}
|
||||
case 0x0042: // TObjEneBm3FlyNest
|
||||
add(EnemyType::MONEST);
|
||||
child_type = EnemyType::MOTHMANT;
|
||||
default_num_children = 30;
|
||||
break;
|
||||
case 0x0043: // TObjEneBm5Wolf
|
||||
@@ -278,7 +316,7 @@ void Map::add_enemy(
|
||||
if ((episode == Episode::EP2) && (e.floor > 0x0F)) {
|
||||
add(EnemyType::DEL_LILY);
|
||||
} else {
|
||||
add(this->check_and_log_rare_enemy(e.uparam1 & 0x01, rare_rates.nar_lily)
|
||||
add(this->check_and_log_rare_enemy(e.uparam1 & 0x01, rare_rates->nar_lily)
|
||||
? EnemyType::NAR_LILY
|
||||
: EnemyType::POISON_LILY);
|
||||
}
|
||||
@@ -292,14 +330,14 @@ void Map::add_enemy(
|
||||
break;
|
||||
}
|
||||
case 0x0064: // TObjEneSlime
|
||||
add(this->check_and_log_rare_enemy(e.uparam1 & 0x01, rare_rates.pouilly_slime)
|
||||
? EnemyType::POFUILLY_SLIME
|
||||
: EnemyType::POUILLY_SLIME);
|
||||
add(this->check_and_log_rare_enemy(e.uparam1 & 0x01, rare_rates->pouilly_slime)
|
||||
? EnemyType::POUILLY_SLIME
|
||||
: EnemyType::POFUILLY_SLIME);
|
||||
default_num_children = 4;
|
||||
break;
|
||||
case 0x0065: // TObjEnePanarms
|
||||
if ((e.num_children != 0) && (e.num_children != 2)) {
|
||||
static_game_data_log.warning("PAN_ARMS has an unusual num_children (0x%hX)", e.num_children.load());
|
||||
this->log.warning("PAN_ARMS has an unusual num_children (0x%hX)", e.num_children.load());
|
||||
}
|
||||
default_num_children = -1; // Skip adding children (because we do it here)
|
||||
add(EnemyType::PAN_ARMS);
|
||||
@@ -332,7 +370,7 @@ void Map::add_enemy(
|
||||
break;
|
||||
case 0x00A1: // TObjEneRe4Sorcerer
|
||||
if ((e.num_children != 0) && (e.num_children != 2)) {
|
||||
static_game_data_log.warning("CHAOS_SORCERER has an unusual num_children (0x%hX)", e.num_children.load());
|
||||
this->log.warning("CHAOS_SORCERER has an unusual num_children (0x%hX)", e.num_children.load());
|
||||
}
|
||||
default_num_children = -1; // Skip adding children (because we do it here)
|
||||
add(EnemyType::CHAOS_SORCERER);
|
||||
@@ -375,7 +413,7 @@ void Map::add_enemy(
|
||||
break;
|
||||
case 0x00C1: // TBoss2DeRolLe
|
||||
if ((e.num_children != 0) && (e.num_children != 0x13)) {
|
||||
static_game_data_log.warning("DE_ROL_LE has an unusual num_children (0x%hX)", e.num_children.load());
|
||||
this->log.warning("DE_ROL_LE has an unusual num_children (0x%hX)", e.num_children.load());
|
||||
}
|
||||
default_num_children = -1; // Skip adding children (because we do it here)
|
||||
add(EnemyType::DE_ROL_LE);
|
||||
@@ -388,7 +426,7 @@ void Map::add_enemy(
|
||||
break;
|
||||
case 0x00C2: // TBoss3Volopt
|
||||
if ((e.num_children != 0) && (e.num_children != 0x23)) {
|
||||
static_game_data_log.warning("VOL_OPT has an unusual num_children (0x%hX)", e.num_children.load());
|
||||
this->log.warning("VOL_OPT has an unusual num_children (0x%hX)", e.num_children.load());
|
||||
}
|
||||
default_num_children = -1; // Skip adding children (because we do it here)
|
||||
add(EnemyType::VOL_OPT_1);
|
||||
@@ -410,7 +448,7 @@ void Map::add_enemy(
|
||||
break;
|
||||
case 0x00C8: // TBoss4DarkFalz
|
||||
if ((e.num_children != 0) && (e.num_children != 0x200)) {
|
||||
static_game_data_log.warning("DARK_FALZ has an unusual num_children (0x%hX)", e.num_children.load());
|
||||
this->log.warning("DARK_FALZ has an unusual num_children (0x%hX)", e.num_children.load());
|
||||
}
|
||||
default_num_children = -1; // Skip adding children (because we do it here)
|
||||
if (difficulty) {
|
||||
@@ -503,7 +541,7 @@ void Map::add_enemy(
|
||||
}
|
||||
break;
|
||||
case 0x0112:
|
||||
add(this->check_and_log_rare_enemy(e.uparam1 & 0x01, rare_rates.merissa_aa)
|
||||
add(this->check_and_log_rare_enemy(e.uparam1 & 0x01, rare_rates->merissa_aa)
|
||||
? EnemyType::MERISSA_AA
|
||||
: EnemyType::MERISSA_A);
|
||||
break;
|
||||
@@ -511,7 +549,7 @@ void Map::add_enemy(
|
||||
add(EnemyType::GIRTABLULU);
|
||||
break;
|
||||
case 0x0114: {
|
||||
bool is_rare = this->check_and_log_rare_enemy(e.uparam1 & 0x01, rare_rates.pazuzu);
|
||||
bool is_rare = this->check_and_log_rare_enemy(e.uparam1 & 0x01, rare_rates->pazuzu);
|
||||
if (e.floor > 0x05) {
|
||||
add(is_rare ? EnemyType::PAZUZU_ALT : EnemyType::ZU_ALT);
|
||||
} else {
|
||||
@@ -527,7 +565,7 @@ void Map::add_enemy(
|
||||
}
|
||||
break;
|
||||
case 0x0116:
|
||||
add(this->check_and_log_rare_enemy(e.uparam1 & 0x01, rare_rates.dorphon_eclair)
|
||||
add(this->check_and_log_rare_enemy(e.uparam1 & 0x01, rare_rates->dorphon_eclair)
|
||||
? EnemyType::DORPHON_ECLAIR
|
||||
: EnemyType::DORPHON);
|
||||
break;
|
||||
@@ -537,7 +575,7 @@ void Map::add_enemy(
|
||||
break;
|
||||
}
|
||||
case 0x0119: {
|
||||
bool is_rare = this->check_and_log_rare_enemy((e.fparam2 != 0.0f), rare_rates.kondrieu);
|
||||
bool is_rare = this->check_and_log_rare_enemy((e.fparam2 != 0.0f), rare_rates->kondrieu);
|
||||
if (is_rare) {
|
||||
add(EnemyType::KONDRIEU);
|
||||
} else {
|
||||
@@ -551,16 +589,16 @@ void Map::add_enemy(
|
||||
case 0x00C4: // TBoss3VoloptCore or subclass
|
||||
case 0x00C6: // TBoss3VoloptMonitor
|
||||
case 0x00C7: // TBoss3VoloptHiraisin
|
||||
case 0x0100:
|
||||
case 0x0118:
|
||||
add(EnemyType::UNKNOWN);
|
||||
static_game_data_log.warning(
|
||||
this->log.warning(
|
||||
"(Entry %zu, offset %zX in file) Unknown enemy type %04hX",
|
||||
index, index * sizeof(EnemyEntry), e.base_type.load());
|
||||
break;
|
||||
|
||||
default:
|
||||
add(EnemyType::UNKNOWN);
|
||||
static_game_data_log.warning(
|
||||
this->log.warning(
|
||||
"(Entry %zu, offset %zX in file) Invalid enemy type %04hX",
|
||||
index, index * sizeof(EnemyEntry), e.base_type.load());
|
||||
break;
|
||||
@@ -584,7 +622,7 @@ void Map::add_enemies_from_map_data(
|
||||
uint8_t floor,
|
||||
const void* data,
|
||||
size_t size,
|
||||
const RareEnemyRates& rare_rates) {
|
||||
std::shared_ptr<const RareEnemyRates> rare_rates) {
|
||||
size_t entry_count = size / sizeof(EnemyEntry);
|
||||
if (size != entry_count * sizeof(EnemyEntry)) {
|
||||
throw runtime_error("data size is not a multiple of entry size");
|
||||
@@ -596,78 +634,70 @@ void Map::add_enemies_from_map_data(
|
||||
}
|
||||
}
|
||||
|
||||
struct DATParserRandomState {
|
||||
PSOV2Encryption random;
|
||||
PSOV2Encryption location_table_random;
|
||||
std::array<uint32_t, 0x20> location_index_table;
|
||||
uint32_t location_indexes_populated;
|
||||
uint32_t location_indexes_used;
|
||||
uint32_t location_entries_base_offset;
|
||||
Map::DATParserRandomState::DATParserRandomState(uint32_t rare_seed)
|
||||
: random(rare_seed),
|
||||
location_table_random(0),
|
||||
location_indexes_populated(0),
|
||||
location_indexes_used(0),
|
||||
location_entries_base_offset(0) {
|
||||
this->location_index_table.fill(0);
|
||||
}
|
||||
|
||||
DATParserRandomState(uint32_t rare_seed)
|
||||
: random(rare_seed),
|
||||
location_table_random(0),
|
||||
location_indexes_populated(0),
|
||||
location_indexes_used(0),
|
||||
location_entries_base_offset(0) {
|
||||
this->location_index_table.fill(0);
|
||||
size_t Map::DATParserRandomState::rand_int_biased(size_t min_v, size_t max_v) {
|
||||
float max_f = static_cast<float>(max_v + 1);
|
||||
uint32_t crypt_v = this->random.next();
|
||||
float det_f = static_cast<float>(crypt_v);
|
||||
return max<size_t>(floorf((max_f * det_f) / UINT32_MAX_AS_FLOAT), min_v);
|
||||
}
|
||||
|
||||
uint32_t Map::DATParserRandomState::next_location_index() {
|
||||
if (this->location_indexes_used < this->location_indexes_populated) {
|
||||
return this->location_index_table.at(this->location_indexes_used++);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Map::DATParserRandomState::generate_shuffled_location_table(
|
||||
const Map::RandomEnemyLocationsHeader& header, StringReader r, uint16_t section) {
|
||||
if (header.num_sections == 0) {
|
||||
throw runtime_error("no locations defined");
|
||||
}
|
||||
|
||||
size_t rand_int_biased(size_t min_v, size_t max_v) {
|
||||
float max_f = static_cast<float>(max_v + 1);
|
||||
uint32_t crypt_v = this->random.next();
|
||||
float det_f = static_cast<float>(crypt_v);
|
||||
return max<size_t>(floorf((max_f * det_f) / UINT32_MAX_AS_FLOAT), min_v);
|
||||
StringReader sections_r = r.sub(header.section_table_offset, header.num_sections * sizeof(Map::RandomEnemyLocationSection));
|
||||
|
||||
size_t bs_min = 0;
|
||||
size_t bs_max = header.num_sections - 1;
|
||||
do {
|
||||
size_t bs_mid = (bs_min + bs_max) / 2;
|
||||
if (sections_r.pget<Map::RandomEnemyLocationSection>(bs_mid * sizeof(Map::RandomEnemyLocationSection)).section < section) {
|
||||
bs_min = bs_mid + 1;
|
||||
} else {
|
||||
bs_max = bs_mid;
|
||||
}
|
||||
} while (bs_min < bs_max);
|
||||
|
||||
const auto& sec = sections_r.pget<Map::RandomEnemyLocationSection>(bs_min * sizeof(Map::RandomEnemyLocationSection));
|
||||
if (section != sec.section) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t next_location_index() {
|
||||
if (this->location_indexes_used < this->location_indexes_populated) {
|
||||
return this->location_index_table.at(this->location_indexes_used++);
|
||||
}
|
||||
return 0;
|
||||
this->location_indexes_populated = sec.count;
|
||||
this->location_indexes_used = 0;
|
||||
this->location_entries_base_offset = sec.offset;
|
||||
for (size_t z = 0; z < sec.count; z++) {
|
||||
this->location_index_table.at(z) = z;
|
||||
}
|
||||
|
||||
void generate_shuffled_location_table(const Map::RandomEnemyLocationsHeader& header, StringReader r, uint16_t section) {
|
||||
if (header.num_sections == 0) {
|
||||
throw runtime_error("no locations defined");
|
||||
}
|
||||
|
||||
StringReader sections_r = r.sub(header.section_table_offset, header.num_sections * sizeof(Map::RandomEnemyLocationSection));
|
||||
|
||||
size_t bs_min = 0;
|
||||
size_t bs_max = header.num_sections - 1;
|
||||
do {
|
||||
size_t bs_mid = (bs_min + bs_max) / 2;
|
||||
if (sections_r.pget<Map::RandomEnemyLocationSection>(bs_mid * sizeof(Map::RandomEnemyLocationSection)).section < section) {
|
||||
bs_min = bs_mid + 1;
|
||||
} else {
|
||||
bs_max = bs_mid;
|
||||
}
|
||||
} while (bs_min < bs_max);
|
||||
|
||||
const auto& sec = sections_r.pget<Map::RandomEnemyLocationSection>(bs_min * sizeof(Map::RandomEnemyLocationSection));
|
||||
if (section != sec.section) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->location_indexes_populated = sec.count;
|
||||
this->location_indexes_used = 0;
|
||||
this->location_entries_base_offset = sec.offset;
|
||||
for (size_t z = 0; z < sec.count; z++) {
|
||||
this->location_index_table.at(z) = z;
|
||||
}
|
||||
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
for (size_t x = 0; x < sec.count; x++) {
|
||||
uint32_t crypt_v = this->location_table_random.next();
|
||||
size_t choice = floorf((static_cast<float>(sec.count) * static_cast<float>(crypt_v)) / UINT32_MAX_AS_FLOAT);
|
||||
uint32_t t = this->location_index_table[x];
|
||||
this->location_index_table[x] = this->location_index_table[choice];
|
||||
this->location_index_table[choice] = t;
|
||||
}
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
for (size_t x = 0; x < sec.count; x++) {
|
||||
uint32_t crypt_v = this->location_table_random.next();
|
||||
size_t choice = floorf((static_cast<float>(sec.count) * static_cast<float>(crypt_v)) / UINT32_MAX_AS_FLOAT);
|
||||
uint32_t t = this->location_index_table[x];
|
||||
this->location_index_table[x] = this->location_index_table[choice];
|
||||
this->location_index_table[choice] = t;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void Map::add_random_enemies_from_map_data(
|
||||
Episode episode,
|
||||
@@ -677,8 +707,8 @@ void Map::add_random_enemies_from_map_data(
|
||||
StringReader wave_events_segment_r,
|
||||
StringReader locations_segment_r,
|
||||
StringReader definitions_segment_r,
|
||||
uint32_t rare_seed,
|
||||
const RareEnemyRates& rare_rates) {
|
||||
std::shared_ptr<DATParserRandomState> random_state,
|
||||
std::shared_ptr<const RareEnemyRates> rare_rates) {
|
||||
|
||||
static const array<uint32_t, 41> rand_enemy_base_types = {
|
||||
0x44, 0x43, 0x41, 0x42, 0x40, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x80,
|
||||
@@ -701,15 +731,11 @@ void Map::add_random_enemies_from_map_data(
|
||||
definitions_header.weight_entries_offset,
|
||||
definitions_header.weight_entry_count * sizeof(RandomEnemyWeight));
|
||||
|
||||
DATParserRandomState random(rare_seed);
|
||||
|
||||
for (size_t wave_entry_index = 0; wave_entry_index < wave_events_header.entry_count; wave_entry_index++) {
|
||||
auto entry_log = static_game_data_log.sub(string_printf("(Entry %zu/%" PRIu32 ") ", wave_entry_index, wave_events_header.entry_count.load()));
|
||||
entry_log.info("Start");
|
||||
auto entry_log = this->log.sub(string_printf("(Entry %zu/%" PRIu32 ") ", wave_entry_index, wave_events_header.entry_count.load()));
|
||||
const auto& entry = wave_events_segment_r.get<Event2Entry>();
|
||||
|
||||
size_t remaining_waves = random.rand_int_biased(1, entry.max_waves);
|
||||
entry_log.info("Chose %zu waves (max=%hu)", remaining_waves, entry.max_waves.load());
|
||||
size_t remaining_waves = random_state->rand_int_biased(1, entry.max_waves);
|
||||
// Trace: at 0080E125 EAX is wave count
|
||||
|
||||
uint32_t wave_number = entry.wave_number;
|
||||
@@ -717,15 +743,10 @@ void Map::add_random_enemies_from_map_data(
|
||||
remaining_waves--;
|
||||
auto wave_log = entry_log.sub(string_printf("(Wave %zu) ", remaining_waves));
|
||||
|
||||
size_t remaining_enemies = random.rand_int_biased(entry.min_enemies, entry.max_enemies);
|
||||
wave_log.info("Chose %zu enemies (range=[%hhu, %hhu])", remaining_enemies, entry.min_enemies, entry.max_enemies);
|
||||
size_t remaining_enemies = random_state->rand_int_biased(entry.min_enemies, entry.max_enemies);
|
||||
// Trace: at 0080E208 EDI is enemy count
|
||||
|
||||
random.generate_shuffled_location_table(locations_header, locations_segment_r, entry.section);
|
||||
wave_log.info("Generated shuffled location table");
|
||||
for (size_t z = 0; z < random.location_indexes_populated; z++) {
|
||||
wave_log.info(" table[%zX] = %" PRIX32, z, random.location_index_table[z]);
|
||||
}
|
||||
random_state->generate_shuffled_location_table(locations_header, locations_segment_r, entry.section);
|
||||
// Trace: at 0080EBB0 *(EBP + 4) points to table (0x20 uint32_ts)
|
||||
|
||||
while (remaining_enemies) {
|
||||
@@ -740,8 +761,7 @@ void Map::add_random_enemies_from_map_data(
|
||||
}
|
||||
// Trace: at 0080E2C2 EBX is weight_total
|
||||
|
||||
size_t det = random.rand_int_biased(0, weight_total - 1);
|
||||
enemy_log.info("weight_total=%zX, det=%zX", weight_total, det);
|
||||
size_t det = random_state->rand_int_biased(0, weight_total - 1);
|
||||
// Trace: at 0080E300 EDX is det
|
||||
|
||||
weights_r.go(0);
|
||||
@@ -778,13 +798,13 @@ void Map::add_random_enemies_from_map_data(
|
||||
e.fparam5 = def.fparam5;
|
||||
e.uparam1 = def.uparam1;
|
||||
e.uparam2 = def.uparam2;
|
||||
e.num_children = random.rand_int_biased(def.min_children, def.max_children);
|
||||
e.num_children = random_state->rand_int_biased(def.min_children, def.max_children);
|
||||
} else {
|
||||
throw runtime_error("random enemy definition not found");
|
||||
}
|
||||
|
||||
const auto& loc = locations_segment_r.pget<RandomEnemyLocationEntry>(
|
||||
locations_header.entries_offset + sizeof(RandomEnemyLocationEntry) * random.next_location_index());
|
||||
locations_header.entries_offset + sizeof(RandomEnemyLocationEntry) * random_state->next_location_index());
|
||||
e.x = loc.x;
|
||||
e.y = loc.y;
|
||||
e.z = loc.z;
|
||||
@@ -792,11 +812,10 @@ void Map::add_random_enemies_from_map_data(
|
||||
e.y_angle = loc.y_angle;
|
||||
e.z_angle = loc.z_angle;
|
||||
|
||||
enemy_log.info("Creating enemy with base_type %04hX fparam2 %g uparam1 %04hX", e.base_type.load(), e.fparam2.load(), e.uparam1.load());
|
||||
// Trace: at 0080E6FE CX is base_type
|
||||
this->add_enemy(episode, difficulty, event, floor, 0, e, rare_rates);
|
||||
} else {
|
||||
enemy_log.info("Cannot create enemy: parameters are missing");
|
||||
enemy_log.warning("Cannot create enemy: parameters are missing");
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
@@ -809,13 +828,13 @@ void Map::add_random_enemies_from_map_data(
|
||||
// doing so, it uses one value from random to determine the delay
|
||||
// parameter of the event. To keep our state in sync with what the
|
||||
// client would do, we skip a random value here.
|
||||
random.random.next();
|
||||
random_state->random.next();
|
||||
wave_number++;
|
||||
}
|
||||
}
|
||||
|
||||
// For the same reason as above, we need to skip another random value here.
|
||||
random.random.next();
|
||||
random_state->random.next();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -825,8 +844,6 @@ vector<Map::DATSectionsForFloor> Map::collect_quest_map_data_sections(const void
|
||||
while (!r.eof()) {
|
||||
size_t header_offset = r.where();
|
||||
const auto& header = r.get<SectionHeader>();
|
||||
static_game_data_log.info("(DAT:%08zX) type=%08" PRIX32 " floor=%08" PRIX32 " data_size=%08" PRIX32,
|
||||
header_offset, header.le_type.load(), header.floor.load(), header.data_size.load());
|
||||
|
||||
if (header.type() == SectionHeader::Type::END && header.section_size == 0) {
|
||||
break;
|
||||
@@ -889,10 +906,11 @@ void Map::add_enemies_and_objects_from_quest_data(
|
||||
const void* data,
|
||||
size_t size,
|
||||
uint32_t rare_seed,
|
||||
const RareEnemyRates& rare_rates) {
|
||||
std::shared_ptr<const RareEnemyRates> rare_rates) {
|
||||
auto all_floor_sections = this->collect_quest_map_data_sections(data, size);
|
||||
|
||||
StringReader r(data, size);
|
||||
shared_ptr<DATParserRandomState> random_state;
|
||||
for (size_t floor = 0; floor < all_floor_sections.size(); floor++) {
|
||||
const auto& floor_sections = all_floor_sections[floor];
|
||||
|
||||
@@ -901,7 +919,7 @@ void Map::add_enemies_and_objects_from_quest_data(
|
||||
if (header.data_size % sizeof(ObjectEntry)) {
|
||||
throw runtime_error("quest layout object section size is not a multiple of object entry size");
|
||||
}
|
||||
static_game_data_log.info("(Floor %02zX) Adding objects", floor);
|
||||
this->log.info("(Floor %02zX) Adding objects", floor);
|
||||
this->add_objects_from_map_data(floor, r.pgetv(floor_sections.objects + sizeof(header), header.data_size), header.data_size);
|
||||
}
|
||||
|
||||
@@ -910,7 +928,7 @@ void Map::add_enemies_and_objects_from_quest_data(
|
||||
if (header.data_size % sizeof(EnemyEntry)) {
|
||||
throw runtime_error("quest layout enemy section size is not a multiple of enemy entry size");
|
||||
}
|
||||
static_game_data_log.info("(Floor %02zX) Adding enemies", floor);
|
||||
this->log.info("(Floor %02zX) Adding enemies", floor);
|
||||
this->add_enemies_from_map_data(
|
||||
episode,
|
||||
difficulty,
|
||||
@@ -923,10 +941,13 @@ void Map::add_enemies_and_objects_from_quest_data(
|
||||
} else if ((floor_sections.wave_events != 0xFFFFFFFF) &&
|
||||
(floor_sections.random_enemy_locations != 0xFFFFFFFF) &&
|
||||
(floor_sections.random_enemy_definitions != 0xFFFFFFFF)) {
|
||||
static_game_data_log.info("(Floor %02zX) Adding random enemies", floor);
|
||||
this->log.info("(Floor %02zX) Adding random enemies", floor);
|
||||
const auto& wave_events_header = r.pget<SectionHeader>(floor_sections.wave_events);
|
||||
const auto& random_enemy_locations_header = r.pget<SectionHeader>(floor_sections.random_enemy_locations);
|
||||
const auto& random_enemy_definitions_header = r.pget<SectionHeader>(floor_sections.random_enemy_definitions);
|
||||
if (!random_state) {
|
||||
random_state = make_shared<DATParserRandomState>(rare_seed);
|
||||
}
|
||||
this->add_random_enemies_from_map_data(
|
||||
episode,
|
||||
difficulty,
|
||||
@@ -935,7 +956,7 @@ void Map::add_enemies_and_objects_from_quest_data(
|
||||
r.sub(floor_sections.wave_events + sizeof(SectionHeader), wave_events_header.data_size),
|
||||
r.sub(floor_sections.random_enemy_locations + sizeof(SectionHeader), random_enemy_locations_header.data_size),
|
||||
r.sub(floor_sections.random_enemy_definitions + sizeof(SectionHeader), random_enemy_definitions_header.data_size),
|
||||
rare_seed,
|
||||
random_state,
|
||||
rare_rates);
|
||||
}
|
||||
}
|
||||
@@ -1007,7 +1028,7 @@ string Map::disassemble_quest_data(const void* data, size_t size) {
|
||||
}
|
||||
}
|
||||
|
||||
return join(ret, "\n");
|
||||
return join(ret, "\n") + "\n";
|
||||
}
|
||||
|
||||
SetDataTable::SetDataTable(shared_ptr<const string> data, bool big_endian) {
|
||||
@@ -1311,25 +1332,5 @@ vector<string> map_filenames_for_variation(
|
||||
return ret;
|
||||
}
|
||||
|
||||
const Map::RareEnemyRates Map::NO_RARE_ENEMIES = {
|
||||
.hildeblue = 0x00000000,
|
||||
.rappy = 0x00000000,
|
||||
.nar_lily = 0x00000000,
|
||||
.pouilly_slime = 0x00000000,
|
||||
.merissa_aa = 0x00000000,
|
||||
.pazuzu = 0x00000000,
|
||||
.dorphon_eclair = 0x00000000,
|
||||
.kondrieu = 0x00000000,
|
||||
};
|
||||
|
||||
const Map::RareEnemyRates Map::DEFAULT_RARE_ENEMIES = {
|
||||
// All 1/512 except Kondrieu, which is 1/10
|
||||
.hildeblue = 0x00800000,
|
||||
.rappy = 0x00800000,
|
||||
.nar_lily = 0x00800000,
|
||||
.pouilly_slime = 0x00800000,
|
||||
.merissa_aa = 0x00800000,
|
||||
.pazuzu = 0x00800000,
|
||||
.dorphon_eclair = 0x00800000,
|
||||
.kondrieu = 0x1999999A,
|
||||
};
|
||||
const shared_ptr<const Map::RareEnemyRates> Map::NO_RARE_ENEMIES = make_shared<Map::RareEnemyRates>(0, 0);
|
||||
const shared_ptr<const Map::RareEnemyRates> Map::DEFAULT_RARE_ENEMIES = make_shared<Map::RareEnemyRates>(0x0083126E, 0x1999999A);
|
||||
|
||||
+34
-11
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <phosg/Encoding.hh>
|
||||
#include <phosg/JSON.hh>
|
||||
#include <random>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -192,10 +193,15 @@ struct Map {
|
||||
uint32_t pazuzu; // ZU -> PAZUZU (and _ALT variants)
|
||||
uint32_t dorphon_eclair; // DORPHON -> DORPHON_ECLAIR
|
||||
uint32_t kondrieu; // {SAINT_MILLION, SHAMBERTIN} -> KONDRIEU
|
||||
|
||||
RareEnemyRates(uint32_t enemy_rate, uint32_t boss_rate);
|
||||
explicit RareEnemyRates(const JSON& json);
|
||||
|
||||
JSON json() const;
|
||||
};
|
||||
|
||||
static const RareEnemyRates NO_RARE_ENEMIES;
|
||||
static const RareEnemyRates DEFAULT_RARE_ENEMIES;
|
||||
static const std::shared_ptr<const RareEnemyRates> NO_RARE_ENEMIES;
|
||||
static const std::shared_ptr<const RareEnemyRates> DEFAULT_RARE_ENEMIES;
|
||||
|
||||
struct Object {
|
||||
// TODO: Add more fields in here if we ever care about them. Currently we
|
||||
@@ -233,9 +239,22 @@ struct Map {
|
||||
std::string str() const;
|
||||
} __attribute__((packed));
|
||||
|
||||
std::vector<Object> objects;
|
||||
std::vector<Enemy> enemies;
|
||||
std::vector<size_t> rare_enemy_indexes;
|
||||
struct DATParserRandomState {
|
||||
PSOV2Encryption random;
|
||||
PSOV2Encryption location_table_random;
|
||||
std::array<uint32_t, 0x20> location_index_table;
|
||||
uint32_t location_indexes_populated;
|
||||
uint32_t location_indexes_used;
|
||||
uint32_t location_entries_base_offset;
|
||||
|
||||
DATParserRandomState(uint32_t rare_seed);
|
||||
size_t rand_int_biased(size_t min_v, size_t max_v);
|
||||
uint32_t next_location_index();
|
||||
void generate_shuffled_location_table(const Map::RandomEnemyLocationsHeader& header, StringReader r, uint16_t section);
|
||||
};
|
||||
|
||||
explicit Map(uint32_t lobby_id);
|
||||
~Map() = default;
|
||||
|
||||
void clear();
|
||||
|
||||
@@ -249,7 +268,7 @@ struct Map {
|
||||
uint8_t floor,
|
||||
size_t index,
|
||||
const EnemyEntry& e,
|
||||
const RareEnemyRates& rare_rates = Map::DEFAULT_RARE_ENEMIES);
|
||||
std::shared_ptr<const RareEnemyRates> rare_rates = DEFAULT_RARE_ENEMIES);
|
||||
void add_enemies_from_map_data(
|
||||
Episode episode,
|
||||
uint8_t difficulty,
|
||||
@@ -257,7 +276,7 @@ struct Map {
|
||||
uint8_t floor,
|
||||
const void* data,
|
||||
size_t size,
|
||||
const RareEnemyRates& rare_rates = Map::DEFAULT_RARE_ENEMIES);
|
||||
std::shared_ptr<const RareEnemyRates> rare_rates = DEFAULT_RARE_ENEMIES);
|
||||
void add_random_enemies_from_map_data(
|
||||
Episode episode,
|
||||
uint8_t difficulty,
|
||||
@@ -266,8 +285,8 @@ struct Map {
|
||||
StringReader wave_events_r,
|
||||
StringReader random_enemy_locations_r,
|
||||
StringReader random_enemy_definitions_r,
|
||||
uint32_t rare_seed,
|
||||
const RareEnemyRates& rare_rates = Map::DEFAULT_RARE_ENEMIES);
|
||||
std::shared_ptr<DATParserRandomState> random_state,
|
||||
std::shared_ptr<const RareEnemyRates> rare_rates = DEFAULT_RARE_ENEMIES);
|
||||
|
||||
struct DATSectionsForFloor {
|
||||
uint32_t objects = 0xFFFFFFFF;
|
||||
@@ -285,9 +304,14 @@ struct Map {
|
||||
const void* data,
|
||||
size_t size,
|
||||
uint32_t rare_seed,
|
||||
const RareEnemyRates& rare_rates = Map::DEFAULT_RARE_ENEMIES);
|
||||
std::shared_ptr<const RareEnemyRates> rare_rates = Map::DEFAULT_RARE_ENEMIES);
|
||||
|
||||
static std::string disassemble_quest_data(const void* data, size_t size);
|
||||
|
||||
PrefixedLogger log;
|
||||
std::vector<Object> objects;
|
||||
std::vector<Enemy> enemies;
|
||||
std::vector<size_t> rare_enemy_indexes;
|
||||
};
|
||||
|
||||
// TODO: This class is currently unused. It would be nice if we could use this
|
||||
@@ -329,4 +353,3 @@ void generate_variations_dc_nte(
|
||||
std::shared_ptr<PSOLFGEncryption> random);
|
||||
std::vector<std::string> map_filenames_for_variation(
|
||||
Episode episode, bool is_solo, uint8_t floor, uint32_t var1, uint32_t var2, bool is_enemies);
|
||||
void load_map_files();
|
||||
|
||||
+17
-14
@@ -17,8 +17,9 @@ constexpr uint32_t MAIN = 0x11000011;
|
||||
constexpr uint32_t INFORMATION = 0x22000022;
|
||||
constexpr uint32_t LOBBY = 0x33000033;
|
||||
constexpr uint32_t GAME = 0x44000044;
|
||||
constexpr uint32_t QUEST = 0x55000055;
|
||||
constexpr uint32_t QUEST_CATEGORIES = 0x66000066;
|
||||
constexpr uint32_t QUEST_EP1 = 0x55010155;
|
||||
constexpr uint32_t QUEST_EP2 = 0x55020255;
|
||||
constexpr uint32_t QUEST_CATEGORIES = 0x66010166;
|
||||
constexpr uint32_t PROXY_DESTINATIONS = 0x77000077;
|
||||
constexpr uint32_t PROGRAMS = 0x88000088;
|
||||
constexpr uint32_t PATCHES = 0x99000099;
|
||||
@@ -74,6 +75,7 @@ constexpr uint32_t SUPPRESS_LOGIN = 0xAA0D0DAA;
|
||||
constexpr uint32_t SKIP_CARD = 0xAA0E0EAA;
|
||||
constexpr uint32_t EP3_INFINITE_MESETA = 0xAA0F0FAA;
|
||||
constexpr uint32_t EP3_INFINITE_TIME = 0xAA1010AA;
|
||||
constexpr uint32_t EP3_UNMASK_WHISPERS = 0xAA1111AA;
|
||||
} // namespace ProxyOptionsMenuItemID
|
||||
|
||||
namespace TeamRewardMenuItemID {
|
||||
@@ -95,24 +97,25 @@ constexpr uint32_t MEMBERS_100_LEADERS_10 = 0x06060606;
|
||||
|
||||
struct MenuItem {
|
||||
enum Flag {
|
||||
// For menu items to be visible on DCNTE, they must not have either of the
|
||||
// following two flags. (The INVISIBLE_ON_GCNTE flag behaves similarly.)
|
||||
INVISIBLE_ON_DCNTE = 0x001,
|
||||
// For menu items to be visible on DC NTE, they must not have either of the
|
||||
// following two flags. (The INVISIBLE_ON_GC_NTE flag behaves similarly.)
|
||||
INVISIBLE_ON_DC_PROTOS = 0x001,
|
||||
INVISIBLE_ON_DC = 0x002,
|
||||
INVISIBLE_ON_PC = 0x004,
|
||||
INVISIBLE_ON_GC_TRIAL_EDITION = 0x008,
|
||||
INVISIBLE_ON_GC = 0x010,
|
||||
INVISIBLE_ON_XB = 0x020,
|
||||
INVISIBLE_ON_BB = 0x040,
|
||||
INVISIBLE_ON_PC_NTE = 0x004,
|
||||
INVISIBLE_ON_PC = 0x008,
|
||||
INVISIBLE_ON_GC_NTE = 0x010,
|
||||
INVISIBLE_ON_GC = 0x020,
|
||||
INVISIBLE_ON_XB = 0x040,
|
||||
INVISIBLE_ON_BB = 0x080,
|
||||
DC_ONLY = INVISIBLE_ON_PC | INVISIBLE_ON_GC | INVISIBLE_ON_XB | INVISIBLE_ON_BB,
|
||||
PC_ONLY = INVISIBLE_ON_DC | INVISIBLE_ON_GC | INVISIBLE_ON_XB | INVISIBLE_ON_BB,
|
||||
GC_ONLY = INVISIBLE_ON_DC | INVISIBLE_ON_PC | INVISIBLE_ON_XB | INVISIBLE_ON_BB,
|
||||
XB_ONLY = INVISIBLE_ON_DC | INVISIBLE_ON_PC | INVISIBLE_ON_GC | INVISIBLE_ON_BB,
|
||||
BB_ONLY = INVISIBLE_ON_DC | INVISIBLE_ON_PC | INVISIBLE_ON_GC | INVISIBLE_ON_XB,
|
||||
REQUIRES_MESSAGE_BOXES = 0x080,
|
||||
REQUIRES_SEND_FUNCTION_CALL = 0x100,
|
||||
REQUIRES_SAVE_DISABLED = 0x200,
|
||||
INVISIBLE_IN_INFO_MENU = 0x400,
|
||||
REQUIRES_MESSAGE_BOXES = 0x100,
|
||||
REQUIRES_SEND_FUNCTION_CALL = 0x200,
|
||||
REQUIRES_SAVE_DISABLED = 0x400,
|
||||
INVISIBLE_IN_INFO_MENU = 0x800,
|
||||
};
|
||||
|
||||
uint32_t item_id;
|
||||
|
||||
+7
-10
@@ -718,11 +718,11 @@ void PSOV2OrV3DetectorEncryption::encrypt(void* data, size_t size, bool advance)
|
||||
le_uint32_t encrypted = *reinterpret_cast<le_uint32_t*>(data);
|
||||
|
||||
le_uint32_t decrypted_v2 = encrypted;
|
||||
unique_ptr<PSOEncryption> v2_crypt(new PSOV2Encryption(this->key));
|
||||
auto v2_crypt = make_unique<PSOV2Encryption>(this->key);
|
||||
v2_crypt->decrypt(&decrypted_v2, sizeof(decrypted_v2), false);
|
||||
|
||||
le_uint32_t decrypted_v3 = encrypted;
|
||||
unique_ptr<PSOEncryption> v3_crypt(new PSOV3Encryption(this->key));
|
||||
auto v3_crypt = make_unique<PSOV3Encryption>(this->key);
|
||||
v3_crypt->decrypt(&decrypted_v3, sizeof(decrypted_v3), false);
|
||||
|
||||
bool v2_match = this->v2_matches.count(decrypted_v2);
|
||||
@@ -760,9 +760,9 @@ void PSOV2OrV3ImitatorEncryption::encrypt(void* data, size_t size, bool advance)
|
||||
if (!this->active_crypt) {
|
||||
auto t = this->detector_crypt->type();
|
||||
if (t == Type::V2) {
|
||||
this->active_crypt.reset(new PSOV2Encryption(this->key));
|
||||
this->active_crypt = make_shared<PSOV2Encryption>(this->key);
|
||||
} else if (t == Type::V3) {
|
||||
this->active_crypt.reset(new PSOV3Encryption(this->key));
|
||||
this->active_crypt = make_shared<PSOV3Encryption>(this->key);
|
||||
} else {
|
||||
throw logic_error("detector crypt is not V2 or V3");
|
||||
}
|
||||
@@ -801,8 +801,7 @@ void PSOBBMultiKeyDetectorEncryption::decrypt(void* data, size_t size, bool adva
|
||||
|
||||
for (const auto& key : this->possible_keys) {
|
||||
this->active_key = key;
|
||||
this->active_crypt.reset(new PSOBBEncryption(
|
||||
*this->active_key, this->seed.data(), this->seed.size()));
|
||||
this->active_crypt = make_shared<PSOBBEncryption>(*this->active_key, this->seed.data(), this->seed.size());
|
||||
string test_data(reinterpret_cast<const char*>(data), size);
|
||||
this->active_crypt->decrypt(test_data.data(), test_data.size(), false);
|
||||
if (this->expected_first_data.count(test_data)) {
|
||||
@@ -854,11 +853,9 @@ shared_ptr<PSOBBEncryption> PSOBBMultiKeyImitatorEncryption::ensure_crypt() {
|
||||
// To handle this, we use the other crypt's seed if the type is JSD1.
|
||||
if ((key->subtype == PSOBBEncryption::Subtype::JSD1) && this->jsd1_use_detector_seed) {
|
||||
const auto& detector_seed = this->detector_crypt->get_seed();
|
||||
this->active_crypt.reset(new PSOBBEncryption(
|
||||
*key, detector_seed.data(), detector_seed.size()));
|
||||
this->active_crypt = make_shared<PSOBBEncryption>(*key, detector_seed.data(), detector_seed.size());
|
||||
} else {
|
||||
this->active_crypt.reset(new PSOBBEncryption(
|
||||
*key, this->seed.data(), this->seed.size()));
|
||||
this->active_crypt = make_shared<PSOBBEncryption>(*key, this->seed.data(), this->seed.size());
|
||||
}
|
||||
}
|
||||
return this->active_crypt;
|
||||
|
||||
@@ -38,7 +38,7 @@ shared_ptr<PSOGCObjectGraph::VTable> PSOGCObjectGraph::parse_vtable_memo(
|
||||
}
|
||||
|
||||
const auto& vt = r.pget<TObjectVTable>(addr & 0x01FFFFFF);
|
||||
auto ret = this->all_vtables.emplace(addr, new VTable()).first->second;
|
||||
auto ret = this->all_vtables.emplace(addr, make_shared<VTable>()).first->second;
|
||||
ret->address = addr;
|
||||
ret->destroy_addr = vt.destroy;
|
||||
ret->update_addr = vt.update;
|
||||
@@ -57,7 +57,7 @@ shared_ptr<PSOGCObjectGraph::Object> PSOGCObjectGraph::parse_object_memo(
|
||||
const auto& obj = r.pget<TObject>(addr & 0x01FFFFFF);
|
||||
string type_name = r.pget_cstr(obj.type_name_addr & 0x01FFFFFF);
|
||||
|
||||
auto ret = this->all_objects.emplace(addr, new Object()).first->second;
|
||||
auto ret = this->all_objects.emplace(addr, make_shared<Object>()).first->second;
|
||||
ret->address = addr;
|
||||
ret->flags = obj.flags;
|
||||
ret->type_name = std::move(type_name);
|
||||
|
||||
@@ -21,6 +21,7 @@ uint16_t PSOCommandHeader::command(Version version) const {
|
||||
switch (version) {
|
||||
case Version::PC_PATCH:
|
||||
case Version::BB_PATCH:
|
||||
case Version::PC_NTE:
|
||||
case Version::PC_V2:
|
||||
return this->pc.command;
|
||||
case Version::DC_NTE:
|
||||
@@ -46,6 +47,7 @@ void PSOCommandHeader::set_command(Version version, uint16_t command) {
|
||||
switch (version) {
|
||||
case Version::PC_PATCH:
|
||||
case Version::BB_PATCH:
|
||||
case Version::PC_NTE:
|
||||
case Version::PC_V2:
|
||||
this->pc.command = command;
|
||||
break;
|
||||
@@ -76,6 +78,7 @@ uint16_t PSOCommandHeader::size(Version version) const {
|
||||
switch (version) {
|
||||
case Version::PC_PATCH:
|
||||
case Version::BB_PATCH:
|
||||
case Version::PC_NTE:
|
||||
case Version::PC_V2:
|
||||
return this->pc.size;
|
||||
case Version::DC_NTE:
|
||||
@@ -101,6 +104,7 @@ void PSOCommandHeader::set_size(Version version, uint32_t size) {
|
||||
switch (version) {
|
||||
case Version::PC_PATCH:
|
||||
case Version::BB_PATCH:
|
||||
case Version::PC_NTE:
|
||||
case Version::PC_V2:
|
||||
this->pc.size = size;
|
||||
break;
|
||||
@@ -131,6 +135,7 @@ uint32_t PSOCommandHeader::flag(Version version) const {
|
||||
switch (version) {
|
||||
case Version::PC_PATCH:
|
||||
case Version::BB_PATCH:
|
||||
case Version::PC_NTE:
|
||||
case Version::PC_V2:
|
||||
return this->pc.flag;
|
||||
case Version::DC_NTE:
|
||||
@@ -156,6 +161,7 @@ void PSOCommandHeader::set_flag(Version version, uint32_t flag) {
|
||||
switch (version) {
|
||||
case Version::PC_PATCH:
|
||||
case Version::BB_PATCH:
|
||||
case Version::PC_NTE:
|
||||
case Version::PC_V2:
|
||||
this->pc.flag = flag;
|
||||
break;
|
||||
@@ -229,6 +235,7 @@ std::string prepend_command_header(
|
||||
|
||||
case Version::PC_PATCH:
|
||||
case Version::BB_PATCH:
|
||||
case Version::PC_NTE:
|
||||
case Version::PC_V2: {
|
||||
PSOCommandHeaderPC header;
|
||||
if (encryption_enabled) {
|
||||
|
||||
@@ -23,7 +23,7 @@ std::shared_ptr<const std::string> PatchFileIndex::File::load_data() {
|
||||
string relative_path = join(this->path_directories, "/") + "/" + this->name;
|
||||
string full_path = this->index->root_dir + "/" + relative_path;
|
||||
patch_index_log.info("Loading data for %s", relative_path.c_str());
|
||||
this->loaded_data.reset(new string(load_file(full_path)));
|
||||
this->loaded_data = make_shared<string>(load_file(full_path));
|
||||
this->size = this->loaded_data->size();
|
||||
}
|
||||
return this->loaded_data;
|
||||
@@ -70,7 +70,7 @@ PatchFileIndex::PatchFileIndex(const string& root_dir)
|
||||
|
||||
auto st = stat(full_item_path);
|
||||
|
||||
shared_ptr<File> f(new File(this));
|
||||
auto f = make_shared<File>(this);
|
||||
f->path_directories = path_directories;
|
||||
f->name = item;
|
||||
|
||||
|
||||
-427
@@ -1,427 +0,0 @@
|
||||
#include "Player.hh"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include <phosg/Filesystem.hh>
|
||||
#include <phosg/Hash.hh>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "FileContentsCache.hh"
|
||||
#include "ItemData.hh"
|
||||
#include "Loggers.hh"
|
||||
#include "PSOEncryption.hh"
|
||||
#include "PSOProtocol.hh"
|
||||
#include "StaticGameData.hh"
|
||||
#include "Text.hh"
|
||||
#include "Version.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
ClientGameData::ClientGameData()
|
||||
: guild_card_number(0),
|
||||
should_update_play_time(false),
|
||||
bb_character_index(-1),
|
||||
last_play_time_update(0) {
|
||||
for (size_t z = 0; z < this->blocked_senders.size(); z++) {
|
||||
this->blocked_senders[z] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ClientGameData::~ClientGameData() {
|
||||
if (!this->bb_username.empty() && this->character_data.get()) {
|
||||
this->save_character_file();
|
||||
}
|
||||
}
|
||||
|
||||
void ClientGameData::create_battle_overlay(shared_ptr<const BattleRules> rules, shared_ptr<const LevelTable> level_table) {
|
||||
this->overlay_character_data.reset(new PSOBBCharacterFile(*this->character(true, false)));
|
||||
|
||||
if (rules->weapon_and_armor_mode != BattleRules::WeaponAndArmorMode::ALLOW) {
|
||||
this->overlay_character_data->inventory.remove_all_items_of_type(0);
|
||||
this->overlay_character_data->inventory.remove_all_items_of_type(1);
|
||||
}
|
||||
if (rules->mag_mode == BattleRules::MagMode::FORBID_ALL) {
|
||||
this->overlay_character_data->inventory.remove_all_items_of_type(2);
|
||||
}
|
||||
if (rules->tool_mode != BattleRules::ToolMode::ALLOW) {
|
||||
this->overlay_character_data->inventory.remove_all_items_of_type(3);
|
||||
}
|
||||
if (rules->replace_char) {
|
||||
// TODO: Shouldn't we clear other material usage here? It looks like the
|
||||
// original code doesn't, but that seems wrong.
|
||||
this->overlay_character_data->inventory.hp_from_materials = 0;
|
||||
this->overlay_character_data->inventory.tp_from_materials = 0;
|
||||
|
||||
uint32_t target_level = clamp<uint32_t>(rules->char_level, 0, 199);
|
||||
uint8_t char_class = this->overlay_character_data->disp.visual.char_class;
|
||||
auto& stats = this->overlay_character_data->disp.stats;
|
||||
|
||||
stats.reset_to_base(char_class, level_table);
|
||||
stats.advance_to_level(char_class, target_level, level_table);
|
||||
|
||||
stats.unknown_a1 = 40;
|
||||
stats.meseta = 300;
|
||||
}
|
||||
if (rules->tech_disk_mode == BattleRules::TechDiskMode::LIMIT_LEVEL) {
|
||||
// TODO: Verify this is what the game actually does.
|
||||
for (uint8_t tech_num = 0; tech_num < 0x13; tech_num++) {
|
||||
uint8_t existing_level = this->overlay_character_data->get_technique_level(tech_num);
|
||||
if ((existing_level != 0xFF) && (existing_level > rules->max_tech_level)) {
|
||||
this->overlay_character_data->set_technique_level(tech_num, rules->max_tech_level);
|
||||
}
|
||||
}
|
||||
} else if (rules->tech_disk_mode == BattleRules::TechDiskMode::FORBID_ALL) {
|
||||
for (uint8_t tech_num = 0; tech_num < 0x13; tech_num++) {
|
||||
this->overlay_character_data->set_technique_level(tech_num, 0xFF);
|
||||
}
|
||||
}
|
||||
if (rules->meseta_mode != BattleRules::MesetaMode::ALLOW) {
|
||||
this->overlay_character_data->disp.stats.meseta = 0;
|
||||
}
|
||||
if (rules->forbid_scape_dolls) {
|
||||
this->overlay_character_data->inventory.remove_all_items_of_type(3, 9);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientGameData::create_challenge_overlay(Version version, size_t template_index, shared_ptr<const LevelTable> level_table) {
|
||||
auto p = this->character(true, false);
|
||||
const auto& tpl = get_challenge_template_definition(version, p->disp.visual.class_flags, template_index);
|
||||
|
||||
this->overlay_character_data.reset(new PSOBBCharacterFile(*p));
|
||||
auto overlay = this->overlay_character_data;
|
||||
|
||||
for (size_t z = 0; z < overlay->inventory.items.size(); z++) {
|
||||
auto& i = overlay->inventory.items[z];
|
||||
i.present = 0;
|
||||
i.unknown_a1 = 0;
|
||||
i.extension_data1 = 0;
|
||||
i.extension_data2 = 0;
|
||||
i.flags = 0;
|
||||
i.data = ItemData();
|
||||
}
|
||||
|
||||
overlay->inventory.items[13].extension_data2 = 1;
|
||||
|
||||
overlay->disp.stats.reset_to_base(overlay->disp.visual.char_class, level_table);
|
||||
overlay->disp.stats.advance_to_level(overlay->disp.visual.char_class, tpl.level, level_table);
|
||||
|
||||
overlay->disp.stats.unknown_a1 = 40;
|
||||
overlay->disp.stats.unknown_a3 = 10.0;
|
||||
overlay->disp.stats.experience = level_table->stats_delta_for_level(overlay->disp.visual.char_class, overlay->disp.stats.level).experience;
|
||||
overlay->disp.stats.meseta = 0;
|
||||
overlay->clear_all_material_usage();
|
||||
for (size_t z = 0; z < 0x13; z++) {
|
||||
overlay->set_technique_level(z, 0xFF);
|
||||
}
|
||||
|
||||
for (size_t z = 0; z < tpl.items.size(); z++) {
|
||||
auto& inv_item = overlay->inventory.items[z];
|
||||
inv_item.present = tpl.items[z].present;
|
||||
inv_item.unknown_a1 = tpl.items[z].unknown_a1;
|
||||
inv_item.flags = tpl.items[z].flags;
|
||||
inv_item.data = tpl.items[z].data;
|
||||
}
|
||||
overlay->inventory.num_items = tpl.items.size();
|
||||
|
||||
for (const auto& tech_level : tpl.tech_levels) {
|
||||
overlay->set_technique_level(tech_level.tech_num, tech_level.level);
|
||||
}
|
||||
}
|
||||
|
||||
shared_ptr<PSOBBBaseSystemFile> ClientGameData::system(bool allow_load) {
|
||||
if (!this->system_data && allow_load) {
|
||||
this->load_all_files();
|
||||
}
|
||||
return this->system_data;
|
||||
}
|
||||
|
||||
shared_ptr<const PSOBBBaseSystemFile> ClientGameData::system(bool allow_load) const {
|
||||
if (!this->system_data.get() && allow_load) {
|
||||
throw runtime_error("system data is not loaded");
|
||||
}
|
||||
return this->system_data;
|
||||
}
|
||||
|
||||
shared_ptr<PSOBBCharacterFile> ClientGameData::character(bool allow_load, bool allow_overlay) {
|
||||
if (this->overlay_character_data && allow_overlay) {
|
||||
return this->overlay_character_data;
|
||||
}
|
||||
if (!this->character_data && allow_load) {
|
||||
if (!this->bb_username.empty() && (this->bb_character_index < 0)) {
|
||||
throw runtime_error("character index not specified");
|
||||
}
|
||||
this->load_all_files();
|
||||
}
|
||||
return this->character_data;
|
||||
}
|
||||
|
||||
shared_ptr<const PSOBBCharacterFile> ClientGameData::character(bool allow_load, bool allow_overlay) const {
|
||||
if (allow_overlay && this->overlay_character_data) {
|
||||
return this->overlay_character_data;
|
||||
}
|
||||
if (!this->character_data && allow_load) {
|
||||
throw runtime_error("character data is not loaded");
|
||||
}
|
||||
return this->character_data;
|
||||
}
|
||||
|
||||
shared_ptr<PSOBBGuildCardFile> ClientGameData::guild_cards(bool allow_load) {
|
||||
if (!this->guild_card_data && allow_load) {
|
||||
this->load_all_files();
|
||||
}
|
||||
return this->guild_card_data;
|
||||
}
|
||||
|
||||
shared_ptr<const PSOBBGuildCardFile> ClientGameData::guild_cards(bool allow_load) const {
|
||||
if (!this->guild_card_data && allow_load) {
|
||||
throw runtime_error("account data is not loaded");
|
||||
}
|
||||
return this->guild_card_data;
|
||||
}
|
||||
|
||||
string ClientGameData::system_filename() const {
|
||||
if (this->bb_username.empty()) {
|
||||
throw logic_error("non-BB players do not have system data");
|
||||
}
|
||||
return string_printf("system/players/system_%s.psosys", this->bb_username.c_str());
|
||||
}
|
||||
|
||||
string ClientGameData::character_filename() const {
|
||||
if (this->bb_username.empty()) {
|
||||
throw logic_error("non-BB players do not have character data");
|
||||
}
|
||||
if (this->bb_character_index < 0) {
|
||||
throw logic_error("character index is not set");
|
||||
}
|
||||
return string_printf("system/players/player_%s_%hhd.psochar", this->bb_username.c_str(), this->bb_character_index);
|
||||
}
|
||||
|
||||
string ClientGameData::guild_card_filename() const {
|
||||
if (this->bb_username.empty()) {
|
||||
throw logic_error("non-BB players do not have Guild Card files");
|
||||
}
|
||||
return string_printf("system/players/guild_cards_%s.psocard", this->bb_username.c_str());
|
||||
}
|
||||
|
||||
string ClientGameData::legacy_account_filename() const {
|
||||
if (this->bb_username.empty()) {
|
||||
throw logic_error("non-BB players do not have legacy account data");
|
||||
}
|
||||
return string_printf("system/players/account_%s.nsa", this->bb_username.c_str());
|
||||
}
|
||||
|
||||
string ClientGameData::legacy_player_filename() const {
|
||||
if (this->bb_username.empty()) {
|
||||
throw logic_error("non-BB players do not have legacy player data");
|
||||
}
|
||||
if (this->bb_character_index < 0) {
|
||||
throw logic_error("character index is not set");
|
||||
}
|
||||
return string_printf(
|
||||
"system/players/player_%s_%hhd.nsc",
|
||||
this->bb_username.c_str(),
|
||||
static_cast<int8_t>(this->bb_character_index + 1));
|
||||
}
|
||||
|
||||
void ClientGameData::create_character_file(
|
||||
uint32_t guild_card_number,
|
||||
uint8_t language,
|
||||
const PlayerDispDataBBPreview& preview,
|
||||
shared_ptr<const LevelTable> level_table) {
|
||||
this->character_data = PSOBBCharacterFile::create_from_preview(guild_card_number, language, preview, level_table);
|
||||
this->save_character_file();
|
||||
}
|
||||
|
||||
void ClientGameData::load_all_files() {
|
||||
if (this->bb_username.empty()) {
|
||||
this->system_data.reset(new PSOBBBaseSystemFile());
|
||||
this->character_data.reset(new PSOBBCharacterFile());
|
||||
this->guild_card_data.reset(new PSOBBGuildCardFile());
|
||||
return;
|
||||
}
|
||||
|
||||
this->system_data.reset();
|
||||
this->character_data.reset();
|
||||
this->guild_card_data.reset();
|
||||
|
||||
string sys_filename = this->system_filename();
|
||||
if (isfile(sys_filename)) {
|
||||
this->system_data.reset(new PSOBBBaseSystemFile(load_object_file<PSOBBBaseSystemFile>(sys_filename, true)));
|
||||
player_data_log.info("Loaded system data from %s", sys_filename.c_str());
|
||||
}
|
||||
|
||||
if (this->bb_character_index >= 0) {
|
||||
string char_filename = this->character_filename();
|
||||
if (isfile(char_filename)) {
|
||||
auto f = fopen_unique(char_filename, "rb");
|
||||
auto header = freadx<PSOCommandHeaderBB>(f.get());
|
||||
if (header.size != 0x399C) {
|
||||
throw runtime_error("incorrect size in character file header");
|
||||
}
|
||||
if (header.command != 0x00E7) {
|
||||
throw runtime_error("incorrect command in character file header");
|
||||
}
|
||||
if (header.flag != 0x00000000) {
|
||||
throw runtime_error("incorrect flag in character file header");
|
||||
}
|
||||
this->character_data.reset(new PSOBBCharacterFile(freadx<PSOBBCharacterFile>(f.get())));
|
||||
player_data_log.info("Loaded character data from %s", char_filename.c_str());
|
||||
|
||||
// If there was no .psosys file, load the system file from the .psochar
|
||||
// file instead
|
||||
if (!this->system_data) {
|
||||
this->system_data.reset(new PSOBBBaseSystemFile(freadx<PSOBBBaseSystemFile>(f.get())));
|
||||
player_data_log.info("Loaded system data from %s", char_filename.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string card_filename = this->guild_card_filename();
|
||||
if (isfile(card_filename)) {
|
||||
this->guild_card_data.reset(new PSOBBGuildCardFile(load_object_file<PSOBBGuildCardFile>(card_filename)));
|
||||
player_data_log.info("Loaded Guild Card data from %s", card_filename.c_str());
|
||||
}
|
||||
|
||||
// If any of the above files were missing, try to load from .nsa/.nsc files instead
|
||||
if (!this->system_data || (!this->character_data && (this->bb_character_index >= 0)) || !this->guild_card_data) {
|
||||
string nsa_filename = this->legacy_account_filename();
|
||||
shared_ptr<LegacySavedAccountDataBB> nsa_data;
|
||||
if (isfile(nsa_filename)) {
|
||||
nsa_data.reset(new LegacySavedAccountDataBB(load_object_file<LegacySavedAccountDataBB>(nsa_filename)));
|
||||
if (!nsa_data->signature.eq(LegacySavedAccountDataBB::SIGNATURE)) {
|
||||
throw runtime_error("account data header is incorrect");
|
||||
}
|
||||
if (!this->system_data) {
|
||||
this->system_data.reset(new PSOBBBaseSystemFile(nsa_data->system_file.base));
|
||||
player_data_log.info("Loaded legacy system data from %s", nsa_filename.c_str());
|
||||
}
|
||||
if (!this->guild_card_data) {
|
||||
this->guild_card_data.reset(new PSOBBGuildCardFile(nsa_data->guild_card_file));
|
||||
player_data_log.info("Loaded legacy Guild Card data from %s", nsa_filename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->system_data) {
|
||||
this->system_data.reset(new PSOBBBaseSystemFile());
|
||||
player_data_log.info("Created new system data");
|
||||
}
|
||||
if (!this->guild_card_data) {
|
||||
this->guild_card_data.reset(new PSOBBGuildCardFile());
|
||||
player_data_log.info("Created new Guild Card data");
|
||||
}
|
||||
|
||||
if (!this->character_data && (this->bb_character_index >= 0)) {
|
||||
string nsc_filename = this->legacy_player_filename();
|
||||
auto nsc_data = load_object_file<LegacySavedPlayerDataBB>(nsc_filename);
|
||||
if (nsc_data.signature == LegacySavedPlayerDataBB::SIGNATURE_V0) {
|
||||
nsc_data.signature = LegacySavedPlayerDataBB::SIGNATURE_V0;
|
||||
nsc_data.unused.clear();
|
||||
nsc_data.battle_records.place_counts.clear(0);
|
||||
nsc_data.battle_records.disconnect_count = 0;
|
||||
nsc_data.battle_records.unknown_a1.clear(0);
|
||||
} else if (nsc_data.signature != LegacySavedPlayerDataBB::SIGNATURE_V1) {
|
||||
throw runtime_error("legacy player data has incorrect signature");
|
||||
}
|
||||
|
||||
this->character_data.reset(new PSOBBCharacterFile());
|
||||
this->character_data->inventory = nsc_data.inventory;
|
||||
this->character_data->disp = nsc_data.disp;
|
||||
this->character_data->play_time_seconds = nsc_data.disp.play_time;
|
||||
this->character_data->unknown_a2 = nsc_data.unknown_a2;
|
||||
this->character_data->quest_flags = nsc_data.quest_flags;
|
||||
this->character_data->death_count = nsc_data.death_count;
|
||||
this->character_data->bank = nsc_data.bank;
|
||||
this->character_data->guild_card.guild_card_number = this->guild_card_number;
|
||||
this->character_data->guild_card.name = nsc_data.disp.name;
|
||||
this->character_data->guild_card.description = nsc_data.guild_card_description;
|
||||
this->character_data->guild_card.present = 1;
|
||||
this->character_data->guild_card.language = nsc_data.inventory.language;
|
||||
this->character_data->guild_card.section_id = nsc_data.disp.visual.section_id;
|
||||
this->character_data->guild_card.char_class = nsc_data.disp.visual.char_class;
|
||||
this->character_data->auto_reply = nsc_data.auto_reply;
|
||||
this->character_data->info_board = nsc_data.info_board;
|
||||
this->character_data->battle_records = nsc_data.battle_records;
|
||||
this->character_data->challenge_records = nsc_data.challenge_records;
|
||||
this->character_data->tech_menu_config = nsc_data.tech_menu_config;
|
||||
this->character_data->quest_global_flags = nsc_data.quest_global_flags;
|
||||
if (nsa_data) {
|
||||
this->character_data->option_flags = nsa_data->option_flags;
|
||||
this->character_data->symbol_chats = nsa_data->symbol_chats;
|
||||
this->character_data->shortcuts = nsa_data->shortcuts;
|
||||
player_data_log.info("Loaded legacy player data from %s and %s", nsa_filename.c_str(), nsc_filename.c_str());
|
||||
} else {
|
||||
player_data_log.info("Loaded legacy player data from %s", nsc_filename.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->blocked_senders.fill(0);
|
||||
for (size_t z = 0; z < this->guild_card_data->blocked.size(); z++) {
|
||||
if (this->guild_card_data->blocked[z].present) {
|
||||
this->blocked_senders[z] = this->guild_card_data->blocked[z].guild_card_number;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->character_data) {
|
||||
this->last_play_time_update = now();
|
||||
}
|
||||
}
|
||||
|
||||
void ClientGameData::save_system_file() const {
|
||||
if (!this->system_data) {
|
||||
throw logic_error("no system file loaded");
|
||||
}
|
||||
string filename = this->system_filename();
|
||||
save_object_file(filename, *this->system_data);
|
||||
player_data_log.info("Saved system file %s", filename.c_str());
|
||||
}
|
||||
|
||||
void ClientGameData::save_character_file() {
|
||||
if (!this->system_data.get()) {
|
||||
throw logic_error("no system file loaded");
|
||||
}
|
||||
if (!this->character_data.get()) {
|
||||
throw logic_error("no character file loaded");
|
||||
}
|
||||
if (this->should_update_play_time) {
|
||||
// This is slightly inaccurate, since fractions of a second are truncated
|
||||
// off each time we save. I'm lazy, so insert shrug emoji here.
|
||||
uint64_t t = now();
|
||||
uint64_t seconds = (t - this->last_play_time_update) / 1000000;
|
||||
this->character_data->disp.play_time += seconds;
|
||||
this->character_data->play_time_seconds = this->character_data->disp.play_time;
|
||||
player_data_log.info("Added %" PRIu64 " seconds to play time", seconds);
|
||||
this->last_play_time_update = t;
|
||||
}
|
||||
|
||||
string filename = this->character_filename();
|
||||
auto f = fopen_unique(filename, "wb");
|
||||
PSOCommandHeaderBB header = {sizeof(PSOCommandHeaderBB) + sizeof(PSOBBCharacterFile) + sizeof(PSOBBBaseSystemFile) + sizeof(PSOBBTeamMembership), 0x00E7, 0x00000000};
|
||||
fwritex(f.get(), header);
|
||||
fwritex(f.get(), *this->character_data);
|
||||
fwritex(f.get(), *this->system_data);
|
||||
// TODO: Technically, we should write the actual team membership struct to the
|
||||
// file here, but that would cause ClientGameData to depend on License, which
|
||||
// it currently does not. This data doesn't matter at all for correctness
|
||||
// within newserv, since it ignores this data entirely and instead generates
|
||||
// the membership struct from the team ID in the License and the team's state.
|
||||
// So, writing correct data here would mostly be for compatibility with other
|
||||
// PSO servers. But if the other server is newserv, then this data would be
|
||||
// used anyway, and if it's not, then it would presumably have a different set
|
||||
// of teams with a different set of team IDs anyway, so the membership struct
|
||||
// here would be useless either way.
|
||||
static const PSOBBTeamMembership empty_membership;
|
||||
fwritex(f.get(), empty_membership);
|
||||
player_data_log.info("Saved character file %s", filename.c_str());
|
||||
}
|
||||
|
||||
void ClientGameData::save_guild_card_file() const {
|
||||
if (!this->guild_card_data.get()) {
|
||||
throw logic_error("no Guild Card file loaded");
|
||||
}
|
||||
string filename = this->guild_card_filename();
|
||||
save_object_file(filename, *this->guild_card_data);
|
||||
player_data_log.info("Saved Guild Card file %s", filename.c_str());
|
||||
}
|
||||
-108
@@ -1,108 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <array>
|
||||
#include <phosg/Encoding.hh>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "Episode3/DataIndexes.hh"
|
||||
#include "ItemCreator.hh"
|
||||
#include "ItemNameIndex.hh"
|
||||
#include "LevelTable.hh"
|
||||
#include "PlayerSubordinates.hh"
|
||||
#include "SaveFileFormats.hh"
|
||||
#include "Text.hh"
|
||||
#include "Version.hh"
|
||||
|
||||
struct PendingItemTrade {
|
||||
uint8_t other_client_id;
|
||||
bool confirmed; // true if client has sent a D2 command
|
||||
std::vector<ItemData> items;
|
||||
};
|
||||
|
||||
struct PendingCardTrade {
|
||||
uint8_t other_client_id;
|
||||
bool confirmed; // true if client has sent an EE D2 command
|
||||
std::vector<std::pair<uint32_t, uint32_t>> card_to_count;
|
||||
};
|
||||
|
||||
class ClientGameData {
|
||||
public:
|
||||
uint32_t guild_card_number;
|
||||
bool should_update_play_time;
|
||||
|
||||
// The following fields are not saved, and are only used in certain situations
|
||||
|
||||
std::array<uint32_t, 30> blocked_senders;
|
||||
|
||||
// This is only used if the client is v1 or v2
|
||||
std::unique_ptr<PlayerDispDataDCPCV3> last_reported_disp_v1_v2;
|
||||
|
||||
// Null unless the client is within the trade sequence (D0-D4 or EE commands)
|
||||
std::unique_ptr<PendingItemTrade> pending_item_trade;
|
||||
std::unique_ptr<PendingCardTrade> pending_card_trade;
|
||||
|
||||
// Null unless the client is Episode 3 and has sent its config already
|
||||
std::shared_ptr<Episode3::PlayerConfig> ep3_config;
|
||||
|
||||
// These are only used if the client is BB
|
||||
std::string bb_username;
|
||||
int8_t bb_character_index;
|
||||
ItemData identify_result;
|
||||
std::array<std::vector<ItemData>, 3> shop_contents;
|
||||
|
||||
ClientGameData();
|
||||
~ClientGameData();
|
||||
|
||||
void create_battle_overlay(std::shared_ptr<const BattleRules> rules, std::shared_ptr<const LevelTable> level_table);
|
||||
void create_challenge_overlay(Version version, size_t template_index, std::shared_ptr<const LevelTable> level_table);
|
||||
inline void delete_overlay() {
|
||||
this->overlay_character_data.reset();
|
||||
}
|
||||
inline bool has_overlay() const {
|
||||
return this->overlay_character_data.get() != nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<PSOBBBaseSystemFile> system(bool allow_load = true);
|
||||
std::shared_ptr<const PSOBBBaseSystemFile> system(bool allow_load = true) const;
|
||||
|
||||
std::shared_ptr<PSOBBCharacterFile> character(bool allow_load = true, bool allow_overlay = true);
|
||||
std::shared_ptr<const PSOBBCharacterFile> character(bool allow_load = true, bool allow_overlay = true) const;
|
||||
|
||||
std::shared_ptr<PSOBBGuildCardFile> guild_cards(bool allow_load = true);
|
||||
std::shared_ptr<const PSOBBGuildCardFile> guild_cards(bool allow_load = true) const;
|
||||
|
||||
void create_character_file(
|
||||
uint32_t guild_card_number,
|
||||
uint8_t language,
|
||||
const PlayerDispDataBBPreview& preview,
|
||||
std::shared_ptr<const LevelTable> level_table);
|
||||
|
||||
void save_system_file() const;
|
||||
// Note: This function is not const because it updates the player's play time.
|
||||
void save_character_file();
|
||||
void save_guild_card_file() const;
|
||||
|
||||
private:
|
||||
// The overlay character data is used in battle and challenge modes, when
|
||||
// character data is temporarily replaced in-game. In other play modes and in
|
||||
// lobbies, overlay_character_data is null.
|
||||
std::shared_ptr<PSOBBBaseSystemFile> system_data;
|
||||
std::shared_ptr<PSOBBCharacterFile> overlay_character_data;
|
||||
std::shared_ptr<PSOBBCharacterFile> character_data;
|
||||
std::shared_ptr<PSOBBGuildCardFile> guild_card_data;
|
||||
uint64_t last_play_time_update;
|
||||
|
||||
void load_all_files();
|
||||
|
||||
std::string system_filename() const;
|
||||
std::string character_filename() const;
|
||||
std::string guild_card_filename() const;
|
||||
|
||||
std::string legacy_player_filename() const;
|
||||
std::string legacy_account_filename() const;
|
||||
};
|
||||
@@ -0,0 +1,119 @@
|
||||
#include "PlayerFilesManager.hh"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include <phosg/Filesystem.hh>
|
||||
#include <phosg/Hash.hh>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "FileContentsCache.hh"
|
||||
#include "ItemData.hh"
|
||||
#include "Loggers.hh"
|
||||
#include "PSOEncryption.hh"
|
||||
#include "PSOProtocol.hh"
|
||||
#include "StaticGameData.hh"
|
||||
#include "Text.hh"
|
||||
#include "Version.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
PlayerFilesManager::PlayerFilesManager(std::shared_ptr<struct event_base> base)
|
||||
: base(base),
|
||||
clear_expired_files_event(
|
||||
event_new(this->base.get(), -1, EV_TIMEOUT | EV_PERSIST, &PlayerFilesManager::clear_expired_files, this),
|
||||
event_free) {
|
||||
auto tv = usecs_to_timeval(30 * 1000 * 1000);
|
||||
event_add(this->clear_expired_files_event.get(), &tv);
|
||||
}
|
||||
|
||||
template <typename KeyT, typename ValueT>
|
||||
size_t erase_unused(std::unordered_map<KeyT, std::shared_ptr<ValueT>>& m) {
|
||||
size_t ret = 0;
|
||||
for (auto it = m.begin(); it != m.end();) {
|
||||
if (it->second.use_count() <= 1) {
|
||||
it = m.erase(it);
|
||||
ret++;
|
||||
} else {
|
||||
it++;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::shared_ptr<PSOBBBaseSystemFile> PlayerFilesManager::get_system(const std::string& filename) {
|
||||
try {
|
||||
return this->loaded_system_files.at(filename);
|
||||
} catch (const out_of_range&) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<PSOBBCharacterFile> PlayerFilesManager::get_character(const std::string& filename) {
|
||||
try {
|
||||
return this->loaded_character_files.at(filename);
|
||||
} catch (const out_of_range&) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<PSOBBGuildCardFile> PlayerFilesManager::get_guild_card(const std::string& filename) {
|
||||
try {
|
||||
return this->loaded_guild_card_files.at(filename);
|
||||
} catch (const out_of_range&) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<PlayerBank> PlayerFilesManager::get_bank(const std::string& filename) {
|
||||
try {
|
||||
return this->loaded_bank_files.at(filename);
|
||||
} catch (const out_of_range&) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerFilesManager::set_system(const std::string& filename, std::shared_ptr<PSOBBBaseSystemFile> file) {
|
||||
if (!this->loaded_system_files.emplace(filename, file).second) {
|
||||
throw runtime_error("Guild Card file already loaded: " + filename);
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerFilesManager::set_character(const std::string& filename, std::shared_ptr<PSOBBCharacterFile> file) {
|
||||
if (!this->loaded_character_files.emplace(filename, file).second) {
|
||||
throw runtime_error("character file already loaded: " + filename);
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerFilesManager::set_guild_card(const std::string& filename, std::shared_ptr<PSOBBGuildCardFile> file) {
|
||||
if (!this->loaded_guild_card_files.emplace(filename, file).second) {
|
||||
throw runtime_error("Guild Card file already loaded: " + filename);
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerFilesManager::set_bank(const std::string& filename, std::shared_ptr<PlayerBank> file) {
|
||||
if (!this->loaded_bank_files.emplace(filename, file).second) {
|
||||
throw runtime_error("bank file already loaded: " + filename);
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerFilesManager::clear_expired_files(evutil_socket_t, short, void* ctx) {
|
||||
auto* self = reinterpret_cast<PlayerFilesManager*>(ctx);
|
||||
size_t num_deleted = erase_unused(self->loaded_system_files);
|
||||
if (num_deleted) {
|
||||
player_data_log.info("Cleared %zu expired system file(s)", num_deleted);
|
||||
}
|
||||
num_deleted = erase_unused(self->loaded_character_files);
|
||||
if (num_deleted) {
|
||||
player_data_log.info("Cleared %zu expired character file(s)", num_deleted);
|
||||
}
|
||||
num_deleted = erase_unused(self->loaded_guild_card_files);
|
||||
if (num_deleted) {
|
||||
player_data_log.info("Cleared %zu expired Guild Card file(s)", num_deleted);
|
||||
}
|
||||
num_deleted = erase_unused(self->loaded_bank_files);
|
||||
if (num_deleted) {
|
||||
player_data_log.info("Cleared %zu expired bank file(s)", num_deleted);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include <event2/event.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <array>
|
||||
#include <phosg/Encoding.hh>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "Episode3/DataIndexes.hh"
|
||||
#include "ItemCreator.hh"
|
||||
#include "ItemNameIndex.hh"
|
||||
#include "LevelTable.hh"
|
||||
#include "PlayerSubordinates.hh"
|
||||
#include "SaveFileFormats.hh"
|
||||
#include "Text.hh"
|
||||
#include "Version.hh"
|
||||
|
||||
class PlayerFilesManager {
|
||||
public:
|
||||
explicit PlayerFilesManager(std::shared_ptr<struct event_base> base);
|
||||
~PlayerFilesManager() = default;
|
||||
|
||||
std::shared_ptr<PSOBBBaseSystemFile> get_system(const std::string& filename);
|
||||
std::shared_ptr<PSOBBCharacterFile> get_character(const std::string& filename);
|
||||
std::shared_ptr<PSOBBGuildCardFile> get_guild_card(const std::string& filename);
|
||||
std::shared_ptr<PlayerBank> get_bank(const std::string& filename);
|
||||
|
||||
void set_system(const std::string& filename, std::shared_ptr<PSOBBBaseSystemFile> file);
|
||||
void set_character(const std::string& filename, std::shared_ptr<PSOBBCharacterFile> file);
|
||||
void set_guild_card(const std::string& filename, std::shared_ptr<PSOBBGuildCardFile> file);
|
||||
void set_bank(const std::string& filename, std::shared_ptr<PlayerBank> file);
|
||||
|
||||
private:
|
||||
std::shared_ptr<struct event_base> base;
|
||||
std::unique_ptr<struct event, void (*)(struct event*)> clear_expired_files_event;
|
||||
|
||||
std::unordered_map<std::string, std::shared_ptr<PSOBBBaseSystemFile>> loaded_system_files;
|
||||
std::unordered_map<std::string, std::shared_ptr<PSOBBCharacterFile>> loaded_character_files;
|
||||
std::unordered_map<std::string, std::shared_ptr<PSOBBGuildCardFile>> loaded_guild_card_files;
|
||||
std::unordered_map<std::string, std::shared_ptr<PlayerBank>> loaded_bank_files;
|
||||
|
||||
static void clear_expired_files(evutil_socket_t fd, short events, void* ctx);
|
||||
};
|
||||
+64
-71
@@ -194,13 +194,6 @@ PlayerDispDataBBPreview PlayerDispDataBB::to_preview() const {
|
||||
return pre;
|
||||
}
|
||||
|
||||
void PlayerDispDataBB::apply_preview(const PlayerDispDataBBPreview& pre) {
|
||||
this->stats.level = pre.level;
|
||||
this->stats.experience = pre.experience;
|
||||
this->visual = pre.visual;
|
||||
this->name = pre.name;
|
||||
}
|
||||
|
||||
void PlayerDispDataBB::apply_dressing_room(const PlayerDispDataBBPreview& pre) {
|
||||
this->visual.name_color = pre.visual.name_color;
|
||||
this->visual.extra_model = pre.visual.extra_model;
|
||||
@@ -466,17 +459,18 @@ void PlayerBank::add_item(const ItemData& item) {
|
||||
}
|
||||
|
||||
if (y < this->num_items) {
|
||||
this->items[y].data.data1[5] += item.data1[5];
|
||||
if (this->items[y].data.data1[5] > combine_max) {
|
||||
this->items[y].data.data1[5] = combine_max;
|
||||
uint8_t new_count = this->items[y].data.data1[5] + item.data1[5];
|
||||
if (new_count > combine_max) {
|
||||
throw runtime_error("stack size would exceed limit");
|
||||
}
|
||||
this->items[y].amount = this->items[y].data.data1[5];
|
||||
this->items[y].data.data1[5] = new_count;
|
||||
this->items[y].amount = new_count;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->num_items >= 200) {
|
||||
throw runtime_error("bank is full");
|
||||
throw runtime_error("no free space in bank");
|
||||
}
|
||||
auto& last_item = this->items[this->num_items];
|
||||
last_item.data = item;
|
||||
@@ -486,21 +480,10 @@ void PlayerBank::add_item(const ItemData& item) {
|
||||
}
|
||||
|
||||
ItemData PlayerBank::remove_item(uint32_t item_id, uint32_t amount) {
|
||||
ItemData ret;
|
||||
|
||||
if (item_id == 0xFFFFFFFF) {
|
||||
if (amount > this->meseta) {
|
||||
throw out_of_range("player does not have enough meseta");
|
||||
}
|
||||
ret.data1[0] = 0x04;
|
||||
ret.data2d = amount;
|
||||
this->meseta -= amount;
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t index = this->find_item(item_id);
|
||||
auto& bank_item = this->items[index];
|
||||
|
||||
ItemData ret;
|
||||
if (amount && (bank_item.data.stack_size() > 1) && (amount < bank_item.data.data1[5])) {
|
||||
ret = bank_item.data;
|
||||
ret.data1[5] = amount;
|
||||
@@ -669,7 +652,7 @@ void PlayerInventory::encode_for_client(shared_ptr<Client> c) {
|
||||
this->hp_from_materials = 0;
|
||||
this->tp_from_materials = 0;
|
||||
this->language = 0;
|
||||
} else if (c->version() != Version::PC_V2) {
|
||||
} else if ((c->version() != Version::PC_NTE) && (c->version() != Version::PC_V2)) {
|
||||
if (this->language > 4) {
|
||||
this->language = 0;
|
||||
}
|
||||
@@ -694,62 +677,72 @@ size_t PlayerBank::find_item(uint32_t item_id) {
|
||||
throw out_of_range("item not present");
|
||||
}
|
||||
|
||||
void PlayerBank::sort() {
|
||||
std::sort(this->items.data(), this->items.data() + this->num_items);
|
||||
}
|
||||
|
||||
void PlayerBank::assign_ids(uint32_t base_id) {
|
||||
for (size_t z = 0; z < this->num_items; z++) {
|
||||
this->items[z].data.id = base_id + z;
|
||||
}
|
||||
}
|
||||
|
||||
BattleRules::BattleRules(const JSON& json) {
|
||||
static const JSON empty_list = JSON::list();
|
||||
|
||||
this->tech_disk_mode = json.get_enum("tech_disk_mode", this->tech_disk_mode);
|
||||
this->weapon_and_armor_mode = json.get_enum("weapon_and_armor_mode", this->weapon_and_armor_mode);
|
||||
this->mag_mode = json.get_enum("mag_mode", this->mag_mode);
|
||||
this->tool_mode = json.get_enum("tool_mode", this->tool_mode);
|
||||
this->trap_mode = json.get_enum("trap_mode", this->trap_mode);
|
||||
this->unused_F817 = json.get_int("unused_F817", this->unused_F817);
|
||||
this->respawn_mode = json.get_int("respawn_mode", this->respawn_mode);
|
||||
this->replace_char = json.get_int("replace_char", this->replace_char);
|
||||
this->drop_weapon = json.get_int("drop_weapon", this->drop_weapon);
|
||||
this->is_teams = json.get_int("is_teams", this->is_teams);
|
||||
this->hide_target_reticle = json.get_int("hide_target_reticle", this->hide_target_reticle);
|
||||
this->meseta_mode = json.get_enum("meseta_mode", this->meseta_mode);
|
||||
this->death_level_up = json.get_int("death_level_up", this->death_level_up);
|
||||
const JSON& trap_counts_json = json.get("trap_counts", empty_list);
|
||||
this->tech_disk_mode = json.get_enum("TechDiskMode", this->tech_disk_mode);
|
||||
this->weapon_and_armor_mode = json.get_enum("WeaponAndArmorMode", this->weapon_and_armor_mode);
|
||||
this->mag_mode = json.get_enum("MagMode", this->mag_mode);
|
||||
this->tool_mode = json.get_enum("ToolMode", this->tool_mode);
|
||||
this->trap_mode = json.get_enum("TrapMode", this->trap_mode);
|
||||
this->unused_F817 = json.get_int("UnusedF817", this->unused_F817);
|
||||
this->respawn_mode = json.get_int("RespawnMode", this->respawn_mode);
|
||||
this->replace_char = json.get_int("ReplaceChar", this->replace_char);
|
||||
this->drop_weapon = json.get_int("DropWeapon", this->drop_weapon);
|
||||
this->is_teams = json.get_int("IsTeams", this->is_teams);
|
||||
this->hide_target_reticle = json.get_int("HideTargetReticle", this->hide_target_reticle);
|
||||
this->meseta_mode = json.get_enum("MesetaMode", this->meseta_mode);
|
||||
this->death_level_up = json.get_int("DeathLevelUp", this->death_level_up);
|
||||
const JSON& trap_counts_json = json.get("TrapCounts", empty_list);
|
||||
for (size_t z = 0; z < trap_counts_json.size(); z++) {
|
||||
this->trap_counts[z] = trap_counts_json.at(z).as_int();
|
||||
}
|
||||
this->enable_sonar = json.get_int("enable_sonar", this->enable_sonar);
|
||||
this->sonar_count = json.get_int("sonar_count", this->sonar_count);
|
||||
this->forbid_scape_dolls = json.get_int("forbid_scape_dolls", this->forbid_scape_dolls);
|
||||
this->lives = json.get_int("lives", this->lives);
|
||||
this->max_tech_level = json.get_int("max_tech_level", this->max_tech_level);
|
||||
this->char_level = json.get_int("char_level", this->char_level);
|
||||
this->time_limit = json.get_int("time_limit", this->time_limit);
|
||||
this->death_tech_level_up = json.get_int("death_tech_level_up", this->death_tech_level_up);
|
||||
this->box_drop_area = json.get_int("box_drop_area", this->box_drop_area);
|
||||
this->enable_sonar = json.get_int("EnableSonar", this->enable_sonar);
|
||||
this->sonar_count = json.get_int("SonarCount", this->sonar_count);
|
||||
this->forbid_scape_dolls = json.get_int("ForbidScapeDolls", this->forbid_scape_dolls);
|
||||
this->lives = json.get_int("Lives", this->lives);
|
||||
this->max_tech_level = json.get_int("MaxTechLevel", this->max_tech_level);
|
||||
this->char_level = json.get_int("CharLevel", this->char_level);
|
||||
this->time_limit = json.get_int("TimeLimit", this->time_limit);
|
||||
this->death_tech_level_up = json.get_int("DeathTechLevelUp", this->death_tech_level_up);
|
||||
this->box_drop_area = json.get_int("BoxDropArea", this->box_drop_area);
|
||||
}
|
||||
|
||||
JSON BattleRules::json() const {
|
||||
return JSON::dict({
|
||||
{"tech_disk_mode", this->tech_disk_mode},
|
||||
{"weapon_and_armor_mode", this->weapon_and_armor_mode},
|
||||
{"mag_mode", this->mag_mode},
|
||||
{"tool_mode", this->tool_mode},
|
||||
{"trap_mode", this->trap_mode},
|
||||
{"unused_F817", this->unused_F817},
|
||||
{"respawn_mode", this->respawn_mode},
|
||||
{"replace_char", this->replace_char},
|
||||
{"drop_weapon", this->drop_weapon},
|
||||
{"is_teams", this->is_teams},
|
||||
{"hide_target_reticle", this->hide_target_reticle},
|
||||
{"meseta_mode", this->meseta_mode},
|
||||
{"death_level_up", this->death_level_up},
|
||||
{"trap_counts", JSON::list({this->trap_counts[0], this->trap_counts[1], this->trap_counts[2], this->trap_counts[3]})},
|
||||
{"enable_sonar", this->enable_sonar},
|
||||
{"sonar_count", this->sonar_count},
|
||||
{"forbid_scape_dolls", this->forbid_scape_dolls},
|
||||
{"lives", this->lives.load()},
|
||||
{"max_tech_level", this->max_tech_level.load()},
|
||||
{"char_level", this->char_level.load()},
|
||||
{"time_limit", this->time_limit.load()},
|
||||
{"death_tech_level_up", this->death_tech_level_up.load()},
|
||||
{"box_drop_area", this->box_drop_area.load()},
|
||||
{"TechDiskMode", this->tech_disk_mode},
|
||||
{"WeaponAndArmorMode", this->weapon_and_armor_mode},
|
||||
{"MagMode", this->mag_mode},
|
||||
{"ToolMode", this->tool_mode},
|
||||
{"TrapMode", this->trap_mode},
|
||||
{"UnusedF817", this->unused_F817},
|
||||
{"RespawnMode", this->respawn_mode},
|
||||
{"ReplaceChar", this->replace_char},
|
||||
{"DropWeapon", this->drop_weapon},
|
||||
{"IsTeams", this->is_teams},
|
||||
{"HideTargetReticle", this->hide_target_reticle},
|
||||
{"MesetaMode", this->meseta_mode},
|
||||
{"DeathLevelUp", this->death_level_up},
|
||||
{"TrapCounts", JSON::list({this->trap_counts[0], this->trap_counts[1], this->trap_counts[2], this->trap_counts[3]})},
|
||||
{"EnableSonar", this->enable_sonar},
|
||||
{"SonarCount", this->sonar_count},
|
||||
{"ForbidScapeDolls", this->forbid_scape_dolls},
|
||||
{"Lives", this->lives.load()},
|
||||
{"MaxTechLevel", this->max_tech_level.load()},
|
||||
{"CharLevel", this->char_level.load()},
|
||||
{"TimeLimit", this->time_limit.load()},
|
||||
{"DeathTechLevelUp", this->death_tech_level_up.load()},
|
||||
{"BoxDropArea", this->box_drop_area.load()},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+59
-13
@@ -10,13 +10,14 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "ChoiceSearch.hh"
|
||||
#include "FileContentsCache.hh"
|
||||
#include "ItemData.hh"
|
||||
#include "LevelTable.hh"
|
||||
#include "Text.hh"
|
||||
#include "Version.hh"
|
||||
|
||||
struct Client;
|
||||
class Client;
|
||||
class ItemParameterTable;
|
||||
|
||||
// PSO V2 stored some extra data in the character structs in a format that I'm
|
||||
@@ -62,6 +63,10 @@ struct PlayerBankItem {
|
||||
/* 14 */ le_uint16_t amount = 0;
|
||||
/* 16 */ le_uint16_t present = 0;
|
||||
/* 18 */
|
||||
|
||||
inline bool operator<(const PlayerBankItem& other) const {
|
||||
return this->data < other.data;
|
||||
}
|
||||
} __attribute__((packed));
|
||||
|
||||
struct PlayerInventory {
|
||||
@@ -98,6 +103,9 @@ struct PlayerBank {
|
||||
void add_item(const ItemData& item);
|
||||
ItemData remove_item(uint32_t item_id, uint32_t amount);
|
||||
size_t find_item(uint32_t item_id);
|
||||
|
||||
void sort();
|
||||
void assign_ids(uint32_t base_id);
|
||||
} __attribute__((packed));
|
||||
|
||||
struct PlayerDispDataBB;
|
||||
@@ -105,7 +113,7 @@ struct PlayerDispDataBB;
|
||||
struct PlayerVisualConfig {
|
||||
/* 00 */ pstring<TextEncoding::ASCII, 0x10> name;
|
||||
/* 10 */ parray<uint8_t, 8> unknown_a2;
|
||||
/* 18 */ le_uint32_t name_color = 0x00000000; // ARGB
|
||||
/* 18 */ le_uint32_t name_color = 0xFFFFFFFF; // ARGB
|
||||
/* 1C */ uint8_t extra_model = 0;
|
||||
/* 1D */ parray<uint8_t, 0x0F> unused;
|
||||
// See compute_name_color_checksum for details on how this is computed. This
|
||||
@@ -453,17 +461,6 @@ struct PlayerRecords_Battle {
|
||||
/* 18 */
|
||||
} __attribute__((packed));
|
||||
|
||||
template <typename ItemIDT>
|
||||
struct ChoiceSearchConfig {
|
||||
// 0 = enabled, 1 = disabled. Unused for command C3
|
||||
le_uint32_t disabled = 1;
|
||||
struct Entry {
|
||||
ItemIDT parent_category_id = 0;
|
||||
ItemIDT category_id = 0;
|
||||
} __attribute__((packed));
|
||||
parray<Entry, 5> entries;
|
||||
} __attribute__((packed));
|
||||
|
||||
template <typename DestT, typename SrcT = DestT>
|
||||
DestT convert_player_disp_data(const SrcT&, uint8_t, uint8_t) {
|
||||
static_assert(always_false<DestT, SrcT>::v,
|
||||
@@ -493,6 +490,55 @@ inline PlayerDispDataBB convert_player_disp_data<PlayerDispDataBB>(
|
||||
return src;
|
||||
}
|
||||
|
||||
struct QuestFlagsForDifficulty {
|
||||
parray<uint8_t, 0x80> data;
|
||||
|
||||
inline bool get(uint16_t flag_index) const {
|
||||
size_t byte_index = flag_index >> 3;
|
||||
uint8_t mask = 0x80 >> (flag_index & 7);
|
||||
return !!(this->data[byte_index] & mask);
|
||||
}
|
||||
inline void set(uint16_t flag_index) {
|
||||
size_t byte_index = flag_index >> 3;
|
||||
uint8_t mask = 0x80 >> (flag_index & 7);
|
||||
this->data[byte_index] |= mask;
|
||||
}
|
||||
inline void clear(uint16_t flag_index) {
|
||||
size_t byte_index = flag_index >> 3;
|
||||
uint8_t mask = 0x80 >> (flag_index & 7);
|
||||
this->data[byte_index] &= (~mask);
|
||||
}
|
||||
inline void update_all(bool set) {
|
||||
if (set) {
|
||||
this->data.clear(0xFF);
|
||||
} else {
|
||||
this->data.clear(0x00);
|
||||
}
|
||||
}
|
||||
} __attribute__((packed));
|
||||
|
||||
struct QuestFlags {
|
||||
parray<QuestFlagsForDifficulty, 4> data;
|
||||
|
||||
inline bool get(uint8_t difficulty, uint16_t flag_index) const {
|
||||
return this->data[difficulty].get(flag_index);
|
||||
}
|
||||
inline void set(uint8_t difficulty, uint16_t flag_index) {
|
||||
this->data[difficulty].set(flag_index);
|
||||
}
|
||||
inline void clear(uint8_t difficulty, uint16_t flag_index) {
|
||||
this->data[difficulty].clear(flag_index);
|
||||
}
|
||||
inline void update_all(uint8_t difficulty, bool set) {
|
||||
this->data[difficulty].update_all(set);
|
||||
}
|
||||
inline void update_all(bool set) {
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
this->update_all(z, set);
|
||||
}
|
||||
}
|
||||
} __attribute__((packed));
|
||||
|
||||
struct BattleRules {
|
||||
enum class TechDiskMode : uint8_t {
|
||||
ALLOW = 0,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user