Compare commits

...

470 Commits

Author SHA1 Message Date
Martin Michelsen e2d76f77be extend switch assist to 4-player doors 2024-03-14 00:14:40 -07:00
Martin Michelsen 0b80af3f41 fix format code in event action stream disassembly 2024-03-13 22:04:39 -07:00
Martin Michelsen f65acda803 reorder initializers in Map::Object construction 2024-03-13 10:06:07 -07:00
Martin Michelsen 53f485b8f2 fix variable overshadow in 6x6F queued case 2024-03-13 09:53:47 -07:00
Martin Michelsen 69f40f9157 extend persistence to enemy, set, and switch flags 2024-03-12 23:43:08 -07:00
Martin Michelsen 84bb946e05 fix error message for bad entry in trap card list 2024-03-12 20:15:53 -07:00
Martin Michelsen eb132f38d2 fix Ep3 map formatting bug 2024-03-12 20:15:53 -07:00
Martin Michelsen 0f1fbb1069 fix infinite loop edge case in text transcoding 2024-03-12 12:09:12 -07:00
Martin Michelsen c9f7ca2259 add BULK and DEATH_GUNNER to rare tables 2024-03-10 15:21:29 -07:00
Martin Michelsen 8594e5af3c add condition clearing and auto-revive to infinite hp mode 2024-03-10 12:07:30 -07:00
Martin Michelsen 6b5e657630 make name colors appear correctly in v2/v3 crossplay 2024-03-10 12:07:30 -07:00
Martin Michelsen a7845e4b0e add logging for p36 target mode in Ep3 2024-03-10 12:07:30 -07:00
Martin Michelsen c0624334c4 fix format width in log messages 2024-03-09 11:59:48 -08:00
Martin Michelsen 34bac4c5b5 add enemy, object, and event tracking for persistence 2024-03-09 11:28:49 -08:00
Martin Michelsen b81385efdb add TODO for item table serialization 2024-03-09 09:56:49 -08:00
Martin Michelsen 2aae90e65a add option to use game creator section ID 2024-03-09 09:45:20 -08:00
Martin Michelsen 64f2cb8f9e add ServerGlobalDropRateMultiplier 2024-03-09 09:21:36 -08:00
Martin Michelsen 2820b8866c update readme for $secid change 2024-03-08 21:24:30 -08:00
Martin Michelsen a39881fa89 change game section ID on leader change 2024-03-08 21:19:56 -08:00
Martin Michelsen 9d4116f035 fix size field when forwarding 6x7C 2024-03-08 14:31:14 -08:00
Martin Michelsen 287296cf48 fix PCv2 6x7C command 2024-03-08 13:42:54 -08:00
Martin Michelsen b491a57f57 don't load maps for ep3 games on proxy server 2024-03-08 09:17:23 -08:00
Martin Michelsen 19e7f1c677 add confirmation for clear license action 2024-03-08 00:02:50 -08:00
Martin Michelsen 8a7e19757a add --multiply option to convert-rare-item-set 2024-03-07 22:51:32 -08:00
Martin Michelsen 70c57e7727 add V_V1Present token in quest conditions 2024-03-07 21:18:51 -08:00
Martin Michelsen 4a8415308e support extended attributes in json rare tables 2024-03-07 20:52:40 -08:00
Martin Michelsen 0e3df10fc0 print Devolution phone numbers during startup 2024-03-06 13:03:10 -08:00
Martin Michelsen 33b95015a2 add option to override name colors by game version 2024-03-06 13:03:10 -08:00
Martin Michelsen 2ecef68a72 update option_flags description 2024-03-06 12:49:03 -08:00
Martin Michelsen 0db0a55e6b update Ep3 lobby banner instructions 2024-03-06 09:53:48 -08:00
Martin Michelsen 0aedfcc17f don't let exceptions fall out of reload config 2024-03-05 10:11:15 -08:00
Martin Michelsen 581f95051d filter solo-extra quests by episode for consistency 2024-03-05 08:52:32 -08:00
Martin Michelsen 31005ec39d add option to disable chat commands 2024-03-04 22:48:05 -08:00
Martin Michelsen b0b3bb6140 fix NPC last-hit EXP 2024-03-04 21:50:48 -08:00
Martin Michelsen 7e4bc52d99 enable episode filter flag on solo-story category 2024-03-04 21:50:48 -08:00
Martin Michelsen b9f1a1d964 add commands for announcements via Simple Mail 2024-03-04 19:59:21 -08:00
Martin Michelsen a48f79eafa auto-port several codes 2024-03-04 19:47:17 -08:00
Martin Michelsen 907c4fda3c add poison room test 2024-03-04 09:21:30 -08:00
Martin Michelsen 3189b71d46 fix 6x2F client ID check 2024-03-03 23:34:24 -08:00
Martin Michelsen 6ae08e9b05 update event metadata for quests 2024-03-03 23:22:40 -08:00
Martin Michelsen 7cd5aa1c2d fix event lookups in quest availability expressions 2024-03-03 23:15:57 -08:00
Martin Michelsen 6d6a8621bb fix per-lobby events in config.json 2024-03-03 23:15:35 -08:00
Martin Michelsen db254a977b fix long credentials on 11/2000 2024-03-03 22:36:12 -08:00
Martin Michelsen 454bcf107b add DC NTE format for 6x06 command 2024-03-03 22:33:55 -08:00
Martin Michelsen 52688982ea use MARKED encoding for info board 2024-03-03 21:32:56 -08:00
Martin Michelsen 2432d8b32b handle JP heart symbol correctly 2024-03-03 21:24:13 -08:00
Martin Michelsen 7f71b87b9b add $variations command 2024-03-03 21:01:41 -08:00
Martin Michelsen 4faad54872 split team points update 2024-03-02 18:38:31 -08:00
Martin Michelsen e2da4322e2 fix name field in BB 6x70 2024-03-02 16:52:23 -08:00
Martin Michelsen f44706570a alias ep3 item indexes to v3 index 2024-03-02 11:00:54 -08:00
Martin Michelsen b452b11854 handle GC_NTE 6x7C properly 2024-03-02 10:55:53 -08:00
Martin Michelsen f2b5f0950f fix describe-item action 2024-03-02 10:55:40 -08:00
Martin Michelsen f43563edb3 add full versions in get_cli_version 2024-03-02 10:54:59 -08:00
Martin Michelsen bec6d741d4 fix gc nte mag encoding 2024-03-02 10:54:47 -08:00
Martin Michelsen d93e6405c3 fix v1-encoded item descriptions 2024-03-01 23:19:18 -08:00
Martin Michelsen a2e3f4882d make quest episode filter configurable 2024-03-01 21:22:14 -08:00
Martin Michelsen ef101894d1 update solo story quest flag expressions 2024-03-01 20:52:09 -08:00
Martin Michelsen 6eb896f83d clean up some is_nte flags in ep3 server 2024-03-01 19:51:47 -08:00
Martin Michelsen c7812bf764 make bcarray not packed 2024-02-29 23:33:31 -08:00
Martin Michelsen 11f49af6f9 fix using incorrect card object in 59:SLAYERS_ASSASSINS 2024-02-29 22:49:06 -08:00
Martin Michelsen af1c51b2b5 fix v1 unidentified item logic 2024-02-29 21:28:15 -08:00
Martin Michelsen f7c63d82f9 fix material usage on GC NTE 2024-02-29 19:25:14 -08:00
Martin Michelsen a00c25ee17 port vip card patch to all ep3 versions 2024-02-29 09:54:38 -08:00
Martin Michelsen 913f7d04f7 fix non-Japanese encoding in Episode 3 maps 2024-02-28 21:57:25 -08:00
Martin Michelsen b37224a453 add asan definition in comments 2024-02-28 21:53:54 -08:00
Martin Michelsen 8375c61236 add some tools for ep3 replay 2024-02-28 21:08:04 -08:00
Martin Michelsen 424f191bc6 ignore client's equip slot if item can't be equipped in it 2024-02-28 19:52:15 -08:00
Martin Michelsen 90152b4138 add TODO for proxy meet user extension 2024-02-28 19:49:02 -08:00
Martin Michelsen c8041558f5 fix Poison Lily rare check 2024-02-28 19:49:02 -08:00
Martin Michelsen 1f10d03923 describe 6x6B and 6x6C more completely 2024-02-28 19:49:02 -08:00
Martin Michelsen bb560c1153 add XBOX-US1 handlers 2024-02-28 19:38:36 -08:00
Martin Michelsen 72794ad50e write xb decoction patch 2024-02-27 23:07:35 -08:00
Martin Michelsen af1c0a548d add map event files 2024-02-27 00:14:15 -08:00
Martin Michelsen 2f5d547c19 delay all new TCP PSH frames until timeout or ACK is received 2024-02-26 20:28:38 -08:00
Martin Michelsen 32f056c6eb add HTTP /y/data/common-tables 2024-02-26 20:07:28 -08:00
Martin Michelsen ac62cc455c add more xbox patches 2024-02-25 21:55:25 -08:00
Martin Michelsen 79f85f46dc add xbe patch translator shell 2024-02-25 21:40:58 -08:00
Martin Michelsen e2e5875c8d fix xb item loss patches 2024-02-25 10:55:18 -08:00
Martin Michelsen 3868a9fc50 fix eu xb movement patches 2024-02-25 10:23:55 -08:00
Martin Michelsen 28cb1c52b5 support full DC NTE credentials 2024-02-24 22:49:37 -08:00
Martin Michelsen 70325793d9 add missing include on linux 2024-02-24 22:00:58 -08:00
Martin Michelsen a2d1eb4532 add non-US versions of XB item loss patch 2024-02-24 21:54:19 -08:00
Martin Michelsen b17ccd264a move HTTP server to separate thread 2024-02-24 21:53:17 -08:00
Martin Michelsen eaa02b2b78 add ep3 cards and rare tables to HTTP server 2024-02-24 19:13:18 -08:00
Martin Michelsen c3b3cf5140 add other projects to readme 2024-02-24 18:14:17 -08:00
Martin Michelsen 3be7b5f56b add PPPRawListen to example config 2024-02-24 18:03:14 -08:00
Martin Michelsen 14bf23c496 only send next TCP PSH if client's acked seq has changed 2024-02-24 10:24:03 -08:00
Martin Michelsen 5b79785c96 remove unused alias 2024-02-24 09:46:13 -08:00
Martin Michelsen f92fe61aa7 fix ep3 dice range override 2024-02-24 09:42:31 -08:00
Martin Michelsen b7c9fb3864 fix Japanese symbol chat name 2024-02-24 09:40:42 -08:00
Martin Michelsen 294d180e68 use system randomness by default unless overridden 2024-02-23 23:58:10 -08:00
Martin Michelsen 7dc5a02a83 bring back history section in readme 2024-02-23 23:58:10 -08:00
Martin Michelsen 82004b05dc add PPP_RAW protocol 2024-02-23 23:52:17 -08:00
Martin Michelsen a4f69f6ca3 add xbox movement patch 2024-02-23 23:52:17 -08:00
Martin Michelsen 66571d751f color unidentified weapon names in $what 2024-02-23 09:25:29 -08:00
Martin Michelsen 680a1a797c define some flags in 6x0A 2024-02-23 09:25:04 -08:00
Martin Michelsen 543bbb45dc add Xbox beta to handler-tables 2024-02-22 19:11:02 -08:00
Martin Michelsen 38504b3133 clear x bit on all files in system/ 2024-02-22 18:28:21 -08:00
Martin Michelsen f0d15be552 decompress PC NTE map files 2024-02-22 18:20:13 -08:00
Martin Michelsen 0383dc90b8 allow overriding stack sizes 2024-02-22 00:10:42 -08:00
Martin Michelsen 4e4ba5650d add B/T/K language markers 2024-02-20 22:59:53 -08:00
Martin Michelsen 29baaf2d95 fix loading long names on BB 2024-02-20 21:34:30 -08:00
Martin Michelsen 67e64d6836 update readme 2024-02-20 21:34:30 -08:00
Martin Michelsen af8c27dcef mark XB beta as tested 2024-02-20 21:31:02 -08:00
Martin Michelsen 163ec73c04 fix JP v1.3 D6 behavior 2024-02-20 20:47:07 -08:00
Martin Michelsen b74ad9d639 add Quest field in game summary JSON 2024-02-20 09:27:11 -08:00
Martin Michelsen 42c72b92ac fix some edge cases in GC NTE item creation 2024-02-19 23:22:22 -08:00
Martin Michelsen b46be572a6 enforce name length limit at edge only 2024-02-19 21:25:50 -08:00
Martin Michelsen 5d2d4cf2ad fix 6x70 transcoding between BB/non-BB 2024-02-19 21:21:01 -08:00
Martin Michelsen 2ba4224a83 add server info to api 2024-02-19 21:13:12 -08:00
Martin Michelsen 9687a0e522 split game flags in api according to game episode 2024-02-19 20:59:20 -08:00
Martin Michelsen cd77fae4e3 fix play time field and marked utf16 fields 2024-02-19 20:59:20 -08:00
Martin Michelsen f2f1007cee clarify $sropmode text a bit 2024-02-19 20:59:20 -08:00
Martin Michelsen db2c2a4774 implement $dropmode on proxy server 2024-02-18 22:41:42 -08:00
Martin Michelsen f16b8ef983 add HTTP server 2024-02-18 22:41:42 -08:00
Martin Michelsen bd13950ba6 fix system file updates when overlay is present 2024-02-18 10:05:25 -08:00
Martin Michelsen cda86e586d fix Dragon and De Rol Le drops on v1 2024-02-18 09:33:38 -08:00
Martin Michelsen 255878bf60 add $itemnotifs every mode 2024-02-18 09:33:21 -08:00
Martin Michelsen 1d42faac3e move patch servers to separate threads 2024-02-17 22:28:03 -08:00
Martin Michelsen 350a89f3da describe 6x7C command 2024-02-17 17:49:04 -08:00
Martin Michelsen 5bfda213c7 move shell to separate thread 2024-02-16 22:52:46 -08:00
Martin Michelsen d3d63dd36c fix battle table disconnect hook 2024-02-16 18:19:53 -08:00
Martin Michelsen 4dd7b75232 don't show item notifs option on ep3 2024-02-15 20:11:47 -08:00
Martin Michelsen 26abf2f306 update readme 2024-02-15 20:11:34 -08:00
Martin Michelsen 9ff7d6fff3 fix Ep3 NTE DEF die rules not working 2024-02-14 18:53:15 -08:00
Michael Stenberg 8c514a0688 fix/add GC NTE ClassMaxes 2024-02-14 08:33:38 -08:00
Martin Michelsen 08ba5d821b fix case where map selection is changed during setup 2024-02-13 21:37:15 -08:00
Martin Michelsen 35e2a9d6f4 use quest extended rules if present 2024-02-13 21:23:33 -08:00
Martin Michelsen 46e509aa69 fix segfault when attacks default back to SC 2024-02-11 21:39:17 -08:00
Martin Michelsen 198db59816 make invalid label index errors clearer 2024-02-11 15:50:53 -08:00
Martin Michelsen 46667bce46 fix 6xB4x3D NTE format 2024-02-11 15:50:38 -08:00
Martin Michelsen 639c1c3e95 add 06 phase to 93 notes 2024-02-11 15:50:28 -08:00
Martin Michelsen 07ebafa8c6 fix Ep3 NTE tournament menu bugs 2024-02-11 12:17:48 -08:00
Martin Michelsen f548fc04e2 make some text messages shorter 2024-02-11 10:54:16 -08:00
Martin Michelsen c55b19dbc0 fix $dicerange 2024-02-11 10:50:34 -08:00
Martin Michelsen c78c91d408 add Ep3 NTE AR codes 2024-02-11 10:49:55 -08:00
Martin Michelsen e07f65eec5 fix Ep3 NTE target replacement function 2024-02-10 21:53:21 -08:00
Martin Michelsen cfbbdc7216 add nop command in shell 2024-02-10 21:53:21 -08:00
Martin Michelsen cb34b350b0 fix Ep4 boss battle param indexes 2024-02-10 21:53:21 -08:00
Martin Michelsen 23f3bfabaa fix angle_x type in AttackData 2024-02-10 21:53:21 -08:00
Martin Michelsen b66069c10b name PlayerStats::esp 2024-02-10 21:53:21 -08:00
Martin Michelsen 093ba1fd38 replace $defrange with $dicerange 2024-02-10 14:29:37 -08:00
Martin Michelsen a312191ced add AllCards patch for Ep3 NTE 2024-02-10 12:29:54 -08:00
Martin Michelsen 841c722178 fix assembly of F_ARGS opcodes on pre-v3 2024-02-10 12:17:04 -08:00
Martin Michelsen 1ed2112bff update to-do list 2024-02-10 10:23:32 -08:00
Martin Michelsen d015406fa6 fix DEF die behavior not being editable in NTE 2024-02-10 10:06:22 -08:00
Martin Michelsen eea9eaf672 update tests for recording semantic change 2024-02-10 09:47:07 -08:00
Martin Michelsen c79e5017ad clear ep3 server state on 6F 2024-02-10 09:37:47 -08:00
Martin Michelsen c3d56f630e add Ep3 NTE COM decks 2024-02-10 00:44:51 -08:00
Martin Michelsen b1f419e337 use a more concise format for xb patches 2024-02-10 00:44:40 -08:00
Martin Michelsen 068ef68dd6 add sjis case for text set encode/decode 2024-02-10 00:44:28 -08:00
Martin Michelsen 51d74b092a add cases for Ep3 NTE cards HTML 2024-02-09 20:46:43 -08:00
Martin Michelsen 884a5ce75a replace is_trial with is_nte 2024-02-09 19:12:02 -08:00
Martin Michelsen d0c3e1b7d8 fix Ep3 NTE 6xB5 masking 2024-02-09 18:17:03 -08:00
Martin Michelsen 0fe28c021a add English code for Ep3 NTE 2024-02-09 18:17:03 -08:00
Martin Michelsen e6e599d760 don't send media updates to Ep3 NTE clients 2024-02-09 11:20:32 -08:00
Martin Michelsen 753c8da4bb update readme 2024-02-09 00:41:43 -08:00
Martin Michelsen 8165f240dc don't expect mask_key from Ep3 NTE 2024-02-09 00:40:12 -08:00
Martin Michelsen f98fae470b add Ep3 NTE differences notes 2024-02-09 00:09:34 -08:00
Martin Michelsen fcc274ce3e fix some bugs introduced by Ep3 NTE work 2024-02-09 00:06:05 -08:00
Martin Michelsen 47533e1a5f fix incorrect player state presence checks 2024-02-08 09:30:29 -08:00
Martin Michelsen 20f5a92d81 implement E1/E3 commands on NTE 2024-02-08 09:13:34 -08:00
Martin Michelsen dcea0e4520 use Ep3 NTE command formats 2024-02-08 01:02:23 -08:00
Martin Michelsen 729d9af4b0 Ep3 NTE checkpoint 5 2024-02-08 01:02:14 -08:00
Martin Michelsen 01afe12487 fix unusual unit modifiers 2024-02-07 23:21:25 -08:00
Martin Michelsen c57dc64950 add missing header 2024-02-07 10:28:29 -08:00
Martin Michelsen 07996444a1 fix download quests with PVR files 2024-02-07 10:23:37 -08:00
Martin Michelsen ba53f67097 Ep3 NTE checkpoint 4 2024-02-07 00:59:15 -08:00
Martin Michelsen 7fad72ef9c fix 4OEU item loss patch 2024-02-05 21:04:47 -08:00
Martin Michelsen 964f646654 fix enum/non-enum ternary 2024-02-05 08:38:01 -08:00
Martin Michelsen 7a23b37c0c Ep3 NTE battles checkpoint 3 2024-02-05 00:18:50 -08:00
Martin Michelsen bfd5c246de don't use 6x97 for challenge retries on BB 2024-02-04 17:13:43 -08:00
Martin Michelsen b89f18ce4e add fallthrough tag 2024-02-04 17:13:31 -08:00
Martin Michelsen 97cf9c5093 fix challenge overlays after retry on non-BB versions 2024-02-04 17:08:03 -08:00
Martin Michelsen c6e930b994 Ep3 NTE battles checkpoint 2 2024-02-04 17:08:03 -08:00
Martin Michelsen 611193610b add $itemnotifs on proxy server 2024-02-03 18:30:46 -08:00
Martin Michelsen 4c735d055e Ep3 NTE battles checkpoint 1 2024-02-03 18:30:45 -08:00
Martin Michelsen adb79e8a41 add description of why the F0 command exists 2024-02-03 18:30:45 -08:00
Martin Michelsen 0f4e4fa48e don't mask Ep3 NTE game commands 2024-02-03 18:30:45 -08:00
Martin Michelsen 5bf868e2aa fix warp command argument name 2024-02-03 18:30:45 -08:00
Matt Swift f6f5c358eb Add shared serials list in notes 2024-02-02 08:36:40 -08:00
Martin Michelsen 50f3ebca5e add support for shared serial mechanics 2024-02-01 21:28:35 -08:00
Martin Michelsen ef89699d59 accept misspelling of Greennill in chat commands 2024-01-31 20:35:00 -08:00
Martin Michelsen b6817e278a add $qgread and $qgwrite commands 2024-01-31 20:23:58 -08:00
Martin Michelsen 4830f5a41e fix battle area number normalization and add more structs/enums 2024-01-30 21:46:03 -08:00
Martin Michelsen 340fbb8ca5 add event conditions in quest visibility 2024-01-30 20:57:09 -08:00
Martin Michelsen 7aa05f39e2 rewrite non-server features section in readme 2024-01-30 19:12:48 -08:00
Martin Michelsen 5e2cc6f07f switch back to original GC versioning convention 2024-01-30 13:58:29 -08:00
Martin Michelsen 34f05e5162 remove debug print 2024-01-29 20:45:16 -08:00
Martin Michelsen d75891e78b add a few ways to customize lobbies 2024-01-28 23:33:55 -08:00
Martin Michelsen 9bf1114535 fix spectator team whisper logic 2024-01-28 16:09:59 -08:00
Martin Michelsen 9084910235 handle missing width/height values in decode-gci-snapshot 2024-01-26 20:44:09 -08:00
Martin Michelsen 33407f88d7 make client idle timeout configurable 2024-01-26 20:43:54 -08:00
Martin Michelsen 82854604b8 remove unnecessary check 2024-01-24 21:51:37 -08:00
Martin Michelsen 6ac2ceca45 remove 6x69 command 01 check 2024-01-24 21:09:01 -08:00
Martin Michelsen 082f88d242 use ESCAPE_CONTROLS_ONLY when writing JSON 2024-01-24 21:03:48 -08:00
Martin Michelsen 0fff4ebd4e enable JP BB ports by default 2024-01-24 14:29:41 -08:00
nolrinale 36a370078c Added original BB client ports to example config 2024-01-24 14:28:09 -08:00
nolrinale 1788aebd00 Added the correct unitxt_j for BB 2024-01-23 23:58:40 -08:00
Martin Michelsen 0de3d2737f update rarely-used and unused subcommand handlers 2024-01-23 23:53:52 -08:00
Martin Michelsen fc6b0992e9 add flags to subcommand handler table 2024-01-23 21:57:06 -08:00
Martin Michelsen 111d45220e add GC GameJam debug 6x handlers 2024-01-23 00:08:20 -08:00
Martin Michelsen fed1044813 add DC HL check note to TODO 2024-01-23 00:08:20 -08:00
Martin Michelsen 3b9c887dbe update credits on patches 2024-01-23 00:08:20 -08:00
Martin Michelsen 80a57f9d3e add xbox patch support 2024-01-21 22:36:52 -08:00
Martin Michelsen db3cecdd2b fix signed/unsigned comparison 2024-01-20 16:33:12 -08:00
Martin Michelsen e13b5950ca use SetDataTable files as map indexes 2024-01-20 16:19:29 -08:00
Martin Michelsen fe1d5a874a also disassemble x86 patches 2024-01-20 16:01:20 -08:00
Martin Michelsen ea76a537fd document 24-bit time_flags field 2024-01-18 22:54:11 -08:00
ShiftaDeband be0569d2cb Adjust loading maps for GC NTE 2024-01-17 18:08:52 -08:00
Martin Michelsen c5e8d2c77c document more Ep3 NTE differences 2024-01-16 22:27:36 -08:00
Martin Michelsen 408bc1befc fix team_dice_bonus variable names 2024-01-16 21:38:44 -08:00
Martin Michelsen 86e98fbfe5 add Ep3 NTE subsubcommand handlers 2024-01-16 21:38:44 -08:00
Martin Michelsen c85b3c144e fix falz/flow drop generation on v1/v2 2024-01-16 21:38:44 -08:00
Martin Michelsen 9311483932 fix 6x0A definition 2024-01-16 21:38:44 -08:00
Martin Michelsen c15e154846 implement challenge stage unlocks 2024-01-16 21:38:44 -08:00
Martin Michelsen 02e8f8ea8b disassemble quests during Save Files 2024-01-15 10:03:48 -08:00
Elixir70 31ddde6e80 Replace Blue Burst BP files with those from pub Teth to fix the small HP differences. 2024-01-15 09:52:27 -08:00
Martin Michelsen 4a23d86f56 fix output interleaving during rare enemy search 2024-01-13 09:48:00 -08:00
Martin Michelsen 1453cd4c9c cache decompressed dat files for quests 2024-01-13 09:47:43 -08:00
Martin Michelsen be8130b621 handle v1/v2 rare rates properly in map loader 2024-01-13 09:33:13 -08:00
Martin Michelsen 9e8f7a6c6b add mutex header 2024-01-13 00:01:25 -08:00
Martin Michelsen d052163a9e add brute-force search command for game seeds that result in rare enemies 2024-01-12 23:54:23 -08:00
Martin Michelsen f188ea1554 add Ep3 NTE battles to to-do list 2024-01-12 23:52:57 -08:00
Martin Michelsen a9894e2d05 fix GC JP 1.02 handler table entries 2024-01-12 23:52:42 -08:00
Martin Michelsen 0a60a24783 update handler-tables with XBOX-US0 2024-01-11 21:23:08 -08:00
Martin Michelsen d8f8dfc53f fix Ep3 NTE disconnect on leaving game 2024-01-11 20:56:17 -08:00
Martin Michelsen cc8dd77d51 fix double start label in quest disassembly 2024-01-11 20:51:14 -08:00
Martin Michelsen d5d85bf5d9 fix ItemCreator unit table on DC NTE and GC NTE 2024-01-11 12:38:12 -08:00
Martin Michelsen 2dff814e8f fix BB stream file symlinks 2024-01-10 22:18:08 -08:00
Martin Michelsen ad86acd8ef fix DCv1 ItemCreator constructor 2024-01-10 07:48:47 -08:00
Martin Michelsen 68be13dd62 write assemble-all-patches action 2024-01-09 21:50:08 -08:00
Martin Michelsen 9e0dfc7749 fix draw distance patch name 2024-01-09 21:50:08 -08:00
nolrinale 3747025a11 Recovered original Coren map files from SEGA 2024-01-09 20:56:39 -08:00
Martin Michelsen e5d4ae1f80 Revert "delete now-unused item name tables"
This reverts commit cbf4540602.
2024-01-09 18:45:40 -08:00
Martin Michelsen 07ea97a6ea update comment in 6x6D struct 2024-01-09 18:44:25 -08:00
Martin Michelsen 9a5d8f9d1a support already-encoded GVM files for Ep3 lobby banners 2024-01-08 20:58:30 -08:00
Martin Michelsen ad2312efee delete broken symlinks 2024-01-08 20:58:30 -08:00
Martin Michelsen dfe1944d2b don't use ItemRT.rel as a fallback 2024-01-08 20:43:32 -08:00
Martin Michelsen 695404165b add support for all versions in ItemParameterTable 2024-01-07 21:33:10 -08:00
Martin Michelsen d3bc2dad4f fix ep3 lobby banner descriptions 2024-01-07 21:22:36 -08:00
Martin Michelsen 194e408863 make $rarenotifs also notify on rare tools regardless of source 2024-01-07 10:36:32 -08:00
Martin Michelsen b2350a537d update build instructions in readme 2024-01-06 18:16:26 -08:00
Martin Michelsen ba4681e35d fix Ep3 NTE proxy sessions 2024-01-06 18:16:26 -08:00
Martin Michelsen 3b9684d8ac remove conditions only works on v1/v2 2024-01-06 18:16:25 -08:00
Martin Michelsen d32c5f1d61 fix show-ep3-maps action 2024-01-06 18:16:25 -08:00
Matt cf2c8f0699 Add English translation of Episode 3 Trial quest 2024-01-06 18:16:08 -08:00
Matt c8681bcf05 Update README.md 2024-01-06 11:52:10 -08:00
Matt fe256cff2a Update README.md 2024-01-06 11:52:10 -08:00
Matt 1df03c45f7 Update README.md 2024-01-06 11:52:10 -08:00
Matt 458e2ef0cd Update README.md 2024-01-06 11:52:10 -08:00
Martin Michelsen dd4284ab63 Update issue templates 2024-01-06 11:44:53 -08:00
Martin Michelsen 251cc80233 update issue templates 2024-01-05 16:35:50 -08:00
Martin Michelsen c6baed2d23 add revision and build date to logs 2024-01-05 16:30:22 -08:00
Martin Michelsen 90e2889204 fix various 6xC6 cases 2024-01-05 12:15:14 -08:00
Martin Michelsen ea4f6da48e update word select alias table 2024-01-05 11:59:33 -08:00
Martin Michelsen b69cf96aa9 fix flags on sync commands during game join 2024-01-05 11:59:20 -08:00
Martin Michelsen cbf4540602 delete now-unused item name tables 2024-01-05 10:34:19 -08:00
nolrinale 058d1ede54 Adjusted Coren init functions for EP2 2024-01-05 09:50:44 -08:00
Martin Michelsen d3c2a0bad0 minor cleanup 2024-01-05 00:15:46 -08:00
Martin Michelsen 83f5487e7b fix GC rare enemy logic 2024-01-04 23:09:09 -08:00
Martin Michelsen d3d89f0168 catch text encode/decode errors in more places 2024-01-04 21:46:27 -08:00
Martin Michelsen b7257a793f enforce min level limits when cheat mode is disabled 2024-01-04 17:31:41 -08:00
Martin Michelsen e50d7a4e65 fix mag feed result primary identifiers 2024-01-04 12:13:00 -08:00
Martin Michelsen 4be431471c rewrite game list filtering logic for BB 2024-01-04 11:49:56 -08:00
Martin Michelsen 649a7c9871 fix incorrect primary_identifier mask 2024-01-04 11:02:46 -08:00
Martin Michelsen 7fc3cca11b fix incorrect exception type during item identification 2024-01-04 10:58:34 -08:00
Martin Michelsen c9d7fe1c2a more minor encryption code cleanup 2024-01-04 10:42:25 -08:00
Martin Michelsen 612b5d28ba fix tech disk stacking on 11/2000 2024-01-04 10:39:18 -08:00
Martin Michelsen 70207896e3 clean up v2 encryption code 2024-01-03 23:28:29 -08:00
Martin Michelsen 08437844e4 add results of rare enemy RE 2024-01-03 23:28:29 -08:00
Martin Michelsen e13b220be9 support non-BB rare enemy generation logic 2024-01-03 23:28:29 -08:00
Martin Michelsen fccc0f7346 fix 0AE8 command 2024-01-03 21:01:39 -08:00
Martin Michelsen 1449bf090b fix item ID sync bug with Challenge grave recovery items 2024-01-03 21:01:39 -08:00
Martin Michelsen c9902e386f don't allow $defrange to override tournament rules 2024-01-03 10:28:31 -08:00
Martin Michelsen fb7d70c943 Merge pull request #311 from nolrinale/master
Techs & Options strings fixes for BB unitxt_e
2024-01-03 10:13:33 -08:00
Martin Michelsen e066c383a0 clean up rt_index logic on drop handler 2024-01-03 10:08:55 -08:00
Martin Michelsen 0e9f66f72e throw if Ep3 player start location not set 2024-01-03 09:40:43 -08:00
Martin Michelsen ec99dad874 fix typo in DC NTE variation definitions 2024-01-03 01:00:25 -08:00
Martin Michelsen b85fd4fced update DC NTE and 11/2000 variations list 2024-01-03 00:40:46 -08:00
Martin Michelsen 2050173666 fix incorrect ItemPT meseta ranges giving 65535 meseta 2024-01-03 00:29:35 -08:00
Martin Michelsen df29a60a6e load maps on all versions 2024-01-03 00:22:28 -08:00
Martin Michelsen 78e407a70f document sound subcommands 2024-01-02 22:32:13 -08:00
Martin Michelsen 04e2f94e2b add maps for all versions 2024-01-02 21:33:01 -08:00
nolrinale 4124f2714a added IME patch instructions for Tethealla client 2024-01-03 02:02:25 +01:00
nolrinale e21365db78 BB unitxt_e option setting string fixes 2024-01-02 00:16:50 +01:00
nolrinale dae7946526 Removed extra space from Tech Names for BB unitxt 2024-01-01 23:51:39 +01:00
Maria J. Belmonte 6a37a2de3d Merge branch 'fuzziqersoftware:master' into master 2024-01-01 23:18:19 +01:00
Martin Michelsen 4f650bebf0 fix disk name in BB unitxt_e 2024-01-01 13:57:46 -08:00
Maria J. Belmonte eb5827e059 Merge branch 'fuzziqersoftware:master' into master 2024-01-01 21:52:20 +01:00
Martin Michelsen 6917f40d3e 11/2000 also doesn't expect mag colors 2024-01-01 12:28:15 -08:00
Martin Michelsen efe2515a44 make generated mag colors random 2024-01-01 12:08:32 -08:00
Martin Michelsen c6ce39623e add config option to enable rare notifs by default 2024-01-01 11:30:30 -08:00
Martin Michelsen 962ee6874e fix tool item stackability on 11/2000 2024-01-01 11:22:03 -08:00
Martin Michelsen 2fda85c750 restrict rare notifs to items generated from ItemRT 2024-01-01 10:24:18 -08:00
Martin Michelsen f1e00ccf0e fix crashes in some non-server actions 2024-01-01 00:05:19 -08:00
Martin Michelsen 09b7885013 fix common cross-version lobby counter animation mismatch 2023-12-31 23:55:00 -08:00
Martin Michelsen e126015b5f don't use specific initializer in StepGraph 2023-12-31 22:37:35 -08:00
Martin Michelsen 4ff4c86047 add ability to specify listening interfaces 2023-12-31 22:21:00 -08:00
Martin Michelsen cd4a8050d7 fix word select data filenames 2023-12-31 21:58:32 -08:00
Martin Michelsen c09bd56e19 add $rarenotifs command 2023-12-31 21:56:41 -08:00
Martin Michelsen 6945a55584 re-record DC NTE game smoke test 2023-12-31 21:28:26 -08:00
Martin Michelsen 32c79a7b6a fix 6x70 handling during replay sessions 2023-12-31 21:28:26 -08:00
Martin Michelsen 57f47f147a silently skip .DS_Store files when indexing quests 2023-12-31 21:28:26 -08:00
Martin Michelsen 6a65940720 remove magic numbers in version arrays 2023-12-31 21:28:26 -08:00
Martin Michelsen 40dcbb77ad fix incorrect next item IDs in synthesized 6x6D commands 2023-12-31 21:28:26 -08:00
Martin Michelsen f479f586cb rewrite ServerState dependency management 2023-12-31 21:28:26 -08:00
Martin Michelsen a24d0ad703 rewrite ItemNameIndex and index all game text 2023-12-31 21:28:26 -08:00
Martin Michelsen ac39db2f36 fix 6x6D synthesis for persistent games 2023-12-31 00:31:04 -08:00
Martin Michelsen 9b4da7e3b3 add stat_boost field in ItemParameterTable::WeaponV2 2023-12-30 20:45:37 -08:00
Martin Michelsen 1f1f4bd815 set up test harness for ep3 server log replays 2023-12-30 18:48:37 -08:00
Maria J. Belmonte 00258d4607 Merge branch 'fuzziqersoftware:master' into master 2023-12-31 00:48:57 +01:00
Martin Michelsen 3aaaf0353e use player-visible client IDs in $setassist command 2023-12-30 15:20:53 -08:00
Martin Michelsen f54d7b0476 add $setassist command 2023-12-30 15:18:42 -08:00
Martin Michelsen 111260cdf3 clean up challenge mode template syntax 2023-12-30 12:15:50 -08:00
Martin Michelsen 91c8cba0d2 make it easier to debug mag evolution bugs 2023-12-30 12:15:50 -08:00
Martin Michelsen 0f8dcd3713 fix incorrect left photon blast assignment bug 2023-12-30 12:14:05 -08:00
Martin Michelsen e89802f288 add option to use temporary licenses for NTE versions 2023-12-30 11:30:43 -08:00
Martin Michelsen c1ac34c1f7 update word select alias table 2023-12-30 09:28:35 -08:00
Martin Michelsen c74a931986 fix platform-dependent test case 2023-12-30 00:57:08 -08:00
Martin Michelsen 686bae25f3 remove unused word select table 2023-12-30 00:52:13 -08:00
Martin Michelsen ff5d0af7ad clang-format Main.cc 2023-12-30 00:51:58 -08:00
Martin Michelsen 8518349cce fix BB name encoding bug 2023-12-30 00:48:34 -08:00
Martin Michelsen 818204a93f rewrite word select table to support all versions 2023-12-30 00:48:20 -08:00
Martin Michelsen eea12d8d75 make cross-joins more compatible 2023-12-29 16:27:22 -08:00
Martin Michelsen 43ee4a9c5a fix name_color_checksum computation bug 2023-12-29 16:25:53 -08:00
Martin Michelsen 7ee7af0b0f allow $edit to change a few things even if cheat mode is disabled 2023-12-29 16:25:03 -08:00
Maria J. Belmonte d15f1cc1a3 Merge branch 'fuzziqersoftware:master' into master 2023-12-30 00:27:59 +01:00
Martin Michelsen 4f2432cbac refine 6x70 format to enable all cross-version joins 2023-12-29 10:44:25 -08:00
Martin Michelsen 60f6b609da make $debug allow all cross-version games 2023-12-28 19:42:01 -08:00
Martin Michelsen 1058998550 fix $password command 2023-12-28 19:39:44 -08:00
Martin Michelsen c00b554b56 fix go-go ball command 2023-12-28 13:06:14 -08:00
Martin Michelsen 0bd3bb7b77 fix item ID conflicts in lobbies 2023-12-28 11:29:09 -08:00
Martin Michelsen b6cfb5b2a2 fix 6x69 command 02 checks 2023-12-28 11:07:06 -08:00
Martin Michelsen c1bcd45ea1 fix incorrect item parsing in config.json 2023-12-28 10:41:59 -08:00
Maria J. Belmonte 5ba652aa38 Merge branch 'fuzziqersoftware:master' into master 2023-12-28 19:34:47 +01:00
Martin Michelsen 1ba50e96ca update lobby datas on team master transfer 2023-12-28 10:23:13 -08:00
Martin Michelsen 7b7c9d371f assign inventory item IDs in lobbies too 2023-12-28 10:22:48 -08:00
Martin Michelsen 09ac8921fe don't require full login information on patch server 2023-12-28 09:57:47 -08:00
Martin Michelsen 29a4347f2b allow overwriting equips on DC NTE and 11/2000 2023-12-28 09:45:11 -08:00
Martin Michelsen 68cf06c6d0 add 1.23.4 US BB handlers to table 2023-12-28 09:29:17 -08:00
Martin Michelsen 5307051e04 make it obvious how to compress/decompress prc files 2023-12-28 09:14:00 -08:00
Maria J. Belmonte 045ff9b169 Merge branch 'fuzziqersoftware:master' into master 2023-12-28 08:58:53 +01:00
Martin Michelsen c1122e1f90 add comment about client_config scrambling 2023-12-27 23:21:36 -08:00
Martin Michelsen d478e9b0be implement BB client's config scramble logic 2023-12-27 23:08:17 -08:00
Martin Michelsen 2aa699b5b0 always generate the same length for box arrays in ItemRT conversion 2023-12-27 21:11:13 -08:00
Martin Michelsen c96cfad4d2 fix sub_version sharing between some Ep3 and BB versions 2023-12-27 21:10:54 -08:00
Martin Michelsen bf26e437ff add missing include on linux 2023-12-27 19:54:32 -08:00
Martin Michelsen 9efdf88101 fix invalid 6x69 command checks 2023-12-27 19:35:42 -08:00
Martin Michelsen 4273ae84f4 document Change Name option 2023-12-27 18:26:01 -08:00
Martin Michelsen b49408a88b implement level table parsers for v2 and v3 2023-12-27 18:03:52 -08:00
Martin Michelsen 764fbf8841 update chat command documentation in readme 2023-12-27 18:03:39 -08:00
Martin Michelsen f74b416c19 use client's stats struct during $savechar on v1/v2 2023-12-27 11:06:22 -08:00
Martin Michelsen 8104fd0853 fix ghost items in persistent games 2023-12-27 10:42:30 -08:00
Martin Michelsen 910555f299 fix incorrect next item ID during game join 2023-12-27 10:42:30 -08:00
Martin Michelsen 2dd7601dbd fix DC prototypes level up command 2023-12-27 10:42:30 -08:00
Martin Michelsen d7e390e494 show original filenames in quest load logs 2023-12-27 10:42:30 -08:00
Maria J. Belmonte c8b001411e Merge branch 'fuzziqersoftware:master' into master 2023-12-27 16:50:29 +01:00
ShiftaDeband a5265874a2 Remove comment addition in tests config.json 2023-12-26 16:07:18 -08:00
ShiftaDeband 81eaa893b9 Update tests config.json with item spacing adjustments, ’ -> ' 2023-12-26 16:07:18 -08:00
ShiftaDeband a0e84b5d5c Update example config with item spacing adjustments, ’ -> ' 2023-12-26 16:07:18 -08:00
ShiftaDeband e8891adf8e Fix typo for "REVIVAL CUIRASS" 2023-12-26 16:07:18 -08:00
Martin Michelsen 1a2d5c1772 rename GC_EP3_TRIAL_EDITION to GC_EP3_NTE 2023-12-26 09:56:38 -08:00
Martin Michelsen 65b9048ab6 update tests for add_color bugfix 2023-12-26 07:52:29 -08:00
Martin Michelsen ccd1b56cae escape player-provided text in various places 2023-12-26 07:37:07 -08:00
Martin Michelsen 5382e12b8d support generating v1 rare item sets 2023-12-26 07:04:30 -08:00
Martin Michelsen 2cdebd5f20 don't skip blank entries when serializing REL rare item tables 2023-12-26 06:58:21 -08:00
Maria J. Belmonte 61e5460bc1 Merge branch 'fuzziqersoftware:master' into master 2023-12-26 09:07:02 +01:00
Martin Michelsen c100d76a5b add notes about protected subcommands 2023-12-25 22:41:36 -08:00
Martin Michelsen d59b59cd51 make switch assist a non-cheat command 2023-12-25 19:32:44 -08:00
Martin Michelsen c7059874d3 make infinite HP also heal conditions 2023-12-25 19:32:44 -08:00
Martin Michelsen dfc451e86a improve proxy compatibility on GC NTE 2023-12-25 19:05:56 -08:00
Martin Michelsen d1022e9b53 rename sys_guild_card_number to team_master_guild_card_number 2023-12-25 17:39:39 -08:00
Martin Michelsen 7c9309f6c5 fix next item ID set incorrectly when joining a persistent game 2023-12-25 17:11:38 -08:00
Martin Michelsen 441457a873 fix Commander Blade effect in games 2023-12-25 16:30:01 -08:00
Martin Michelsen 9255037f50 fix tests for removed client flag 2023-12-25 15:20:29 -08:00
Martin Michelsen 4c95adcdb3 update to-do list 2023-12-25 15:20:05 -08:00
Martin Michelsen 2ef6acaa0e fix incorrect team flag alpha channel when loaded from disk 2023-12-25 15:06:38 -08:00
Martin Michelsen a8061efc0d implement rename team command 2023-12-25 11:11:03 -08:00
Martin Michelsen 206552ed63 remove proxy chat filter option 2023-12-25 09:59:30 -08:00
Martin Michelsen 9e48259414 update to-do list 2023-12-24 22:55:25 -08:00
Martin Michelsen ad32c0a986 make hide_download_commands configurable 2023-12-24 22:51:59 -08:00
Martin Michelsen 84ed80365c make BB games deterministic for replays 2023-12-23 23:26:44 -08:00
Martin Michelsen 87440437fb move Revision.cc to source dir 2023-12-23 21:34:57 -08:00
Martin Michelsen 2aca408a9e create output dir if needed 2023-12-23 21:25:11 -08:00
Martin Michelsen 3991d7b534 fix Revision.cc generation 2023-12-23 21:22:02 -08:00
Martin Michelsen 3823fc94f1 add $si command 2023-12-23 20:41:21 -08:00
Maria J. Belmonte 190e89181e Merge branch 'fuzziqersoftware:master' into master 2023-12-23 12:42:42 +01:00
Martin Michelsen cf7c4674d6 add decode-sjis action 2023-12-22 21:54:59 -08:00
Martin Michelsen 4de23561b0 add option to unmask Ep3 whispers on proxy server, and prevent this from working on newserv 2023-12-22 21:54:48 -08:00
Martin Michelsen fa9b4d7f61 implement $ping on proxy server 2023-12-22 20:21:43 -08:00
Martin Michelsen 2ee6119c93 fix kap and ktp Ep3 env stat expr tokens 2023-12-22 18:26:35 -08:00
nolrinale 02839d8a77 Added Map files to spawn Coren 2023-12-22 17:47:34 -08:00
nolrinale 2af926b461 Coren labo area client function adjustments 2023-12-22 17:47:34 -08:00
Maria J. Belmonte 20ca2529ac Merge branch 'fuzziqersoftware:master' into master 2023-12-23 02:34:06 +01:00
Martin Michelsen 23d4b7d905 fix Ep3 6x70 again 2023-12-22 17:17:25 -08:00
nolrinale 143da7e5a5 Added Map files to spawn Coren 2023-12-23 02:15:20 +01:00
nolrinale 37b95f35c2 Coren labo area client function adjustments 2023-12-23 02:08:06 +01:00
Maria J. Belmonte aed2c61706 Merge branch 'fuzziqersoftware:master' into master 2023-12-23 01:47:30 +01:00
Martin Michelsen ef40007720 fix CHALLENGE16 text encoding 2023-12-22 16:46:15 -08:00
Martin Michelsen 05dcc0edfc remove note about Ep3 6x70 2023-12-22 15:29:01 -08:00
Martin Michelsen 28f896faae fix class name in Ep3 quest buffer code 2023-12-22 15:27:45 -08:00
Martin Michelsen d7bdbf19d1 fix 6x69 client ID check 2023-12-22 15:27:45 -08:00
Martin Michelsen cf0588afc8 fix Ep3 6x70 handler 2023-12-22 15:27:45 -08:00
Maria J. Belmonte 0955d1e5fd Merge branch 'fuzziqersoftware:master' into master 2023-12-22 23:10:31 +01:00
nolrinale 0a4527340d Adding Coren localized files 2023-12-22 11:04:27 -08:00
nolrinale e51924bf49 Adding Coren localized files 2023-12-22 14:30:16 +01:00
Martin Michelsen e35c0c82a5 fix 6x70 for all cross-version cases 2023-12-21 22:23:39 -08:00
Martin Michelsen b0b51b425a always block 97 command in proxy sessions 2023-12-21 22:23:39 -08:00
Martin Michelsen 98bd54b98f clean up SAVE_ENABLED flag usage 2023-12-21 19:54:01 -08:00
Martin Michelsen 30cf74ee87 check game mode for v1/v2 crossplay 2023-12-21 14:57:34 -08:00
Martin Michelsen 522c1848e1 use a cleaner method to deal with duplicate 97 commands 2023-12-21 14:53:56 -08:00
Martin Michelsen d7978aa99e fix PSO PC corruption message caused by multiple proxy sessions 2023-12-21 09:59:58 -08:00
Martin Michelsen 61e696d87c delete duplicate quest 2023-12-20 17:17:37 -08:00
Martin Michelsen b17dd5b196 make 6xE2 result weapons unidentified 2023-12-20 16:44:25 -08:00
Martin Michelsen 40c0953ebc switch 6xBE and 6xE3 order 2023-12-20 16:22:56 -08:00
Martin Michelsen 82aaf4cd34 implement 6xE2 subcommand 2023-12-20 15:42:29 -08:00
Martin Michelsen f048a4f5fb add reassembly mode in quest script disassembler 2023-12-20 14:59:39 -08:00
Martin Michelsen 2ee4249f89 fix default Black Paper reward lists 2023-12-19 16:41:40 -08:00
Martin Michelsen c68181e8c0 don't use drop command to change item visibility 2023-12-19 13:33:51 -08:00
Martin Michelsen f2f72b537d fix $loadchar slot index 2023-12-19 11:37:54 -08:00
Martin Michelsen 3284e5ddc1 add missing include on Linux 2023-12-19 10:54:23 -08:00
Martin Michelsen 1299cc345b create players directory if it does not exist 2023-12-18 23:31:09 -08:00
Martin Michelsen b7604eb643 add ability to forbid specific quest flag writes 2023-12-18 21:58:39 -08:00
Martin Michelsen e3315822de block various types of NPC FSOD from SPSOF 2023-12-18 20:33:07 -08:00
Martin Michelsen 592b013f65 use newer actions/checkout version for CI 2023-12-18 13:40:13 -08:00
Martin Michelsen 0ec685cbd0 remove duplicate function definition 2023-12-18 13:31:38 -08:00
Martin Michelsen 12f5b52680 fix name for 6x17/6x18 structs 2023-12-18 13:31:25 -08:00
Martin Michelsen 73815e1520 replace compatibility table with bullet list 2023-12-18 12:31:18 -08:00
Martin Michelsen 49c947b352 prevent various malicious SPSOF commands 2023-12-18 10:28:32 -08:00
Martin Michelsen be6d0e58cf make trial names consistent in readme 2023-12-18 10:25:21 -08:00
Martin Michelsen 58fa32b95b fix PC NTE menu item flags 2023-12-17 23:49:20 -08:00
Martin Michelsen e8431225d0 fix error in readme 2023-12-17 23:33:35 -08:00
Martin Michelsen 7581c8e175 enable chat commands by default in proxy sessions 2023-12-17 23:32:41 -08:00
Martin Michelsen 30b97df4f1 add quest debugging functions on proxy server 2023-12-17 23:32:41 -08:00
Martin Michelsen ec1337712f describe crossplay functions in readme 2023-12-17 23:32:41 -08:00
Martin Michelsen 3f9cad1ca5 add support for PC NTE 2023-12-17 23:32:41 -08:00
Martin Michelsen a6c4217875 add $where command 2023-12-17 23:32:41 -08:00
Martin Michelsen de5547ff68 clean up 6x75 structure 2023-12-17 23:32:41 -08:00
ShiftaDeband da26fb0d14 Adjust PSOPC patch directory structure 2023-12-17 18:44:16 -08:00
ShiftaDeband 29e2ad10c3 Delete system/patch-pc/data directory 2023-12-17 18:44:16 -08:00
Martin Michelsen af06741788 enforce min stack sizes for quest opcodes too 2023-12-17 18:15:30 -08:00
Martin Michelsen d64c9621af fix converted 6x70 subcommand size field 2023-12-17 18:06:45 -08:00
Martin Michelsen 8b0f62f71e don't allow creeating x0 stacks with $item 2023-12-17 17:43:54 -08:00
Martin Michelsen 7a34fb0f7a fix minimum player levels for Hard, etc. on non-V4 2023-12-17 13:50:47 -08:00
Martin Michelsen f14f7dd93b enable item tracking on NTE and 11/2000 and make $item work 2023-12-17 13:50:44 -08:00
Martin Michelsen 74604788c9 add chat bug to to-do list 2023-12-16 21:04:12 -08:00
Martin Michelsen 9fa25d6337 update flycast patch script to support multiple instances 2023-12-16 21:03:50 -08:00
Martin Michelsen 209ccd6726 switch text transcoder error case 2023-12-16 18:00:04 -08:00
Martin Michelsen 1edc40724f remove no-longer-true statement about download quests 2023-12-16 12:33:37 -08:00
Martin Michelsen 367c4e77c1 split allowed drop modes for different game modes 2023-12-16 12:00:29 -08:00
Martin Michelsen 81af488e26 add ability to hide quests based on game player count 2023-12-16 11:28:40 -08:00
Martin Michelsen a9afab9717 fix dropping items breaking extension data 2023-12-16 10:09:52 -08:00
Martin Michelsen 66d7594a36 implement nonstandard drop modes 2023-12-16 10:09:40 -08:00
Martin Michelsen 2bd43391a6 mitigate potential $persist abuse 2023-12-13 21:47:51 -08:00
Martin Michelsen 974269187b add timeout for persistent games 2023-12-13 20:52:35 -08:00
Martin Michelsen 3551b9abc3 add missing include 2023-12-13 15:56:49 -08:00
Martin Michelsen bbef5e329f add default GC patches 2023-12-13 15:39:30 -08:00
Martin Michelsen 7cb0ef9f3e fix warning in TeamIndex constructor 2023-12-13 15:39:30 -08:00
Martin Michelsen 0429638cf0 add extended patch metadata 2023-12-13 15:20:07 -08:00
Martin Michelsen a85e161020 add tools for GC patch reverse-engineering 2023-12-13 15:19:30 -08:00
Martin Michelsen d34f47405c fix typo in item name 2023-12-12 14:00:51 -08:00
Martin Michelsen 179e688cf6 add more heuristics in AR code translator 2023-12-12 14:00:43 -08:00
Martin Michelsen c4827bafdb update metadata JSON files for team quests 2023-12-11 15:56:18 -08:00
Martin Michelsen d2133aae3d add unidentified flag to item descriptions 2023-12-11 14:26:53 -08:00
Martin Michelsen 196f2de616 don't send auto-reply message if sender is blocked 2023-12-11 13:57:36 -08:00
Martin Michelsen d9cdf9804f fix ... in F_ARGS opcode assembly 2023-12-11 13:56:00 -08:00
Martin Michelsen bc017578e3 persist item state when no players are in a game 2023-12-11 12:13:36 -08:00
Martin Michelsen aa27c579f6 update to-do list 2023-12-11 12:11:58 -08:00
Martin Michelsen 6a6943e0df fix typo in arg names 2023-12-11 12:11:58 -08:00
3612 changed files with 125258 additions and 19679 deletions
+27
View File
@@ -0,0 +1,27 @@
---
name: Bug report
about: Report incorrect behavior or unexpected errors
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
Write a clear and concise description of what the bug is, and what you expected to happen instead.
**To reproduce**
Fill in steps to reproduce the behavior, such as:
1. Connect to server
2. Create a game
3. Start quest X
4. Talk to NPC Y
**Game version(s) (choose one or more of the following):**
DC NTE, DC prototype, DC v1, DC v2, PC, GC Ep1&2, GC Ep3, Xbox, BB
**Server log output**
On macOS/Linux, or in a Cygwin shell on Windows, you can run the server as `./newserv 2>&1 | tee server-log.txt` to generate a log file. Do that, then do whatever you need to do to get the bug to happen, then upload the log file here.
**Additional context**
Add any other context about the problem here.
+20
View File
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
Write a clear and concise description of what the problem is. For example, "I'm always frustrated when [...]"
**Describe the solution you'd like**
Write a clear and concise description of what you want to happen.
**Game version(s) (choose one or more of the following):**
DC NTE, DC prototype, DC v1, DC v2, PC, GC Ep1&2, GC Ep3, Xbox, BB
**Additional context**
Add any other context or screenshots about the feature request here.
+32 -32
View File
@@ -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
+4
View File
@@ -2,6 +2,7 @@
.DS_Store
# Build products
src/Revision.cc
newserv
# CMake files
@@ -9,6 +10,7 @@ cmake_install.cmake
CMakeCache.txt
CMakeFiles
CTestTestFile.cmake
CTestTestfile.cmake
install_manifest.txt
Makefile
Testing
@@ -24,6 +26,8 @@ system/players/*.psosys
system/players/*.psocard
system/players/*.nsc
system/players/*.nsa
system/teams/*.json
system/teams/*.bmp
system/patch-pc/.metadata-cache.json
system/patch-bb/.metadata-cache.json
+27 -4
View File
@@ -27,10 +27,12 @@ link_directories(${LOCAL_LIB_DIR})
find_path (LIBEVENT_INCLUDE_DIR NAMES event.h)
find_library (LIBEVENT_LIBRARY NAMES event)
find_library (LIBEVENT_CORE NAMES event_core)
find_library (LIBEVENT_PTHREADS NAMES event_pthreads)
set (LIBEVENT_INCLUDE_DIRS ${LIBEVENT_INCLUDE_DIR})
set (LIBEVENT_LIBRARIES
${LIBEVENT_LIBRARY}
${LIBEVENT_CORE})
${LIBEVENT_CORE}
${LIBEVENT_PTHREADS})
find_package(phosg REQUIRED)
find_package(Iconv REQUIRED)
@@ -38,9 +40,24 @@ find_package(resource_file QUIET)
# Git metadata
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/Revision.cc ${CMAKE_CURRENT_SOURCE_DIR}/src/__Revision__.cc
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/src/Revision-generate.sh ${CMAKE_CURRENT_SOURCE_DIR}/src/Revision.cc
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src
)
add_custom_target(
newserv-Revision-cc
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/Revision.cc ${CMAKE_CURRENT_SOURCE_DIR}/src/__Revision__.cc
)
# Executable definition
set(SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/Revision.cc
src/AFSArchive.cc
src/BattleParamsIndex.cc
src/BMLArchive.cc
@@ -66,10 +83,12 @@ set(SOURCES
src/Episode3/RulerServer.cc
src/Episode3/Server.cc
src/Episode3/Tournament.cc
src/EventUtils.cc
src/FileContentsCache.cc
src/FunctionCompiler.cc
src/GSLArchive.cc
src/GVMEncoder.cc
src/HTTPServer.cc
src/IPFrameInfo.cc
src/IPStackSimulator.cc
src/ItemCreator.cc
@@ -85,6 +104,7 @@ set(SOURCES
src/Map.cc
src/Menu.cc
src/NetworkAddresses.cc
src/PatchServer.cc
src/PatchFileIndex.cc
src/PlayerFilesManager.cc
src/PlayerSubordinates.cc
@@ -100,17 +120,16 @@ set(SOURCES
src/ReceiveCommands.cc
src/ReceiveSubcommands.cc
src/ReplaySession.cc
src/Revision.cc
src/SaveFileFormats.cc
src/SendCommands.cc
src/Server.cc
src/ServerShell.cc
src/ServerState.cc
src/Shell.cc
src/StaticGameData.cc
src/TeamIndex.cc
src/Text.cc
src/TextArchive.cc
src/UnicodeTextSet.cc
src/TextIndex.cc
src/Version.cc
src/WordSelectTable.cc
)
@@ -122,6 +141,10 @@ endif()
add_executable(newserv ${SOURCES})
target_include_directories(newserv PUBLIC ${LIBEVENT_INCLUDE_DIR} ${Iconv_INCLUDE_DIRS})
target_link_libraries(newserv phosg ${LIBEVENT_LIBRARIES} ${Iconv_LIBRARIES} pthread)
add_dependencies(newserv newserv-Revision-cc)
# target_compile_options(newserv PRIVATE -fsanitize=address)
# target_link_options(newserv PRIVATE -fsanitize=address)
if(resource_file_FOUND)
target_compile_definitions(newserv PUBLIC HAVE_RESOURCE_FILE)
+319 -182
View File
@@ -1,4 +1,4 @@
# newserv <img align="right" src="s-newserv.png" />
# newserv <img align="right" src="static/s-newserv.png" />
newserv is a game server, proxy, and reverse-engineering tool for Phantasy Star Online (PSO).
@@ -9,85 +9,226 @@ Feel free to submit GitHub issues if you find bugs or have feature requests. I'd
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**
* Background
* [History](#history)
* [Other server projects](#other-server-projects)
* [Compatibility](#compatibility)
* Setup
* [Configuration](#configuration)
* [Installing quests](#installing-quests)
* [Episode 3 features](#episode-3-features)
* [Server setup](#server-setup)
* [Client patch directories for PC and BB](#client-patch-directories)
* [Memory patches and DOL files for GC](#memory-patches-and-dol-files)
* [How to connect](#how-to-connect)
* Features and 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)
* [Memory patches, client functions, and DOL files](#memory-patches-client-functions-and-dol-files)
* [Using newserv as a proxy](#using-newserv-as-a-proxy)
* [Chat commands](#chat-commands)
* How to connect
* Connecting local clients
* [PSO DC](#pso-dc)
* [PSO DC on Flycast](#pso-dc-on-flycast)
* [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)
## Compatibility
# History
newserv supports several versions of PSO, including various development prototypes. Specifically:
| Version | Lobbies | Games | Proxy |
|----------------|--------------|--------------|--------------|
| DC Trial | 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 | Yes | Yes | Yes |
| GC Ep1&2 Trial | Yes | Yes | Yes |
| GC Ep1&2 | Yes | Yes | Yes |
| GC Ep1&2 Plus | Yes | Yes | Yes |
| GC Ep3 Trial | 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 |
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="static/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="static/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="static/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="static/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).
## Other server projects
Independently of this project, there are many other PSO servers out there. Those that I know of that are (or were) public are listed here in approximate chronological order:
* (Early 2000s) **[Schtserv](https://schtserv.com/)**: The first public-access PSO server; written in Delphi by Schthack. Still active and popular as of this writing (early 2024). Schtserv is also the only other unofficial server to support all versions of PSO, including Episode 3.
* (2005) **Khyller**: An early attempt of mine to support PSO PC, GC, and BB. See above for more details.
* (2006) **Aeon**: My second attempt. Better than Khyller, but still unreliable.
* (2008) **Tethealla**: A fairly extensive implementation of PSOBB, written in C by Sodaboy. The public version of Tethealla has been [officially disowned](https://www.pioneer2.net/community/threads/tethealla-server-forums-removal.26365/) (as it is now more than 15 years old), but closed-source development continues. [Ephinea](https://ephinea.pioneer2.net/), currently the most popular PSOBB server, is the continuation of this project. Several other modern PSOBB servers are forks of the initial public version of Tethealla as well.
* (2008) **[Sylverant](https://sylverant.net/)** [(source)](https://sourceforge.net/projects/sylverant/): The second public-access PSO server; written in C by BlueCrab. Still active and popular as of this writing (early 2024).
* (2015) **[Archon](https://github.com/dcrodman/archon)**: A PSOBB server written in Go by Drew Rodman.
* (2015) **[Idola](https://github.com/HybridEidolon/idolapsoserv)**: A PSOBB server written in Rust by HybridEidolon. Functionality status unknown; the project has been archived.
* (2017) **[Aselia](https://github.com/Solybum/Aselia)**: A PSOBB server written written in C# by Soly. It seems this was planned to be open-source at some point, but that has not (yet) happened.
* (2018) **newserv**: This project right here.
* (2019) **[Mechonis](https://gitlab.com/sora3087/mechonis)**: A PSOBB server with a microservice architecture written in TypeScript by TrueVision.
* (2021) **[Phantasmal World](https://github.com/DaanVandenBosch/phantasmal-world)**: A set of PSO tools, including a web-based model viewer and quest builder, and a PSO server, written by Daan Vanden Bosch.
* (2021) **[Elseware](http://git.sharnoth.com/jake/elseware)**: A PSOBB server written in Rust by Jake.
* (2022) **[PSOSERVER](https://github.com/Sancaros/PSOSERVER)**: A server for all versions, written in C by Sancaros and based on Sylverant and newserv.
# Compatibility
newserv supports all known versions of PSO, including 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 | Yes (1) | Yes |
| GC Ep3 | Yes | Yes | Yes |
| Xbox Ep1&2 Beta | Yes | Yes | Yes |
| Xbox Ep1&2 | Yes | Yes | Yes |
| BB (vanilla) | Yes | Yes (2) | Yes |
| BB (Tethealla) | Yes | Yes (2) | Yes |
*Notes:*
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.*
1. *Ep3 NTE battles are not well-tested; some things may not work. See notes/ep3-nte-differences.txt for a list of known differences between NTE and the final version. NTE and non-NTE players cannot battle each other.*
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
# Setup
### Configuration
## Server setup
Currently newserv works on macOS, Windows, and Ubuntu Linux. It will likely work on other Linux flavors too.
There is a fairly recent macOS ARM64 release on the newserv GitHub repository. You may need to install libevent manually even if you use this release (run `brew install libevent`).
### Windows/macOS
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.
1. Download the latest release-windows-amd64.zip or release-macos-arm64.zip file from the [releases page](https://github.com/fuzziqersoftware/newserv/releases).
2. Extract the contents of the release folder to a location on your computer.
3. Edit the config.example.json file in the system folder as needed, then rename it to config.json.
4. If you plan to play Blue Burst on newserv, set up the patch directory. See [client patch directories](#client-patch-directories) for more information.
5. Run the newserv executable.
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-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.
### Linux
There are currently no precompiled releases for Linux. To run newserv on Linux, see the "Building from source" section below.
### Building from source
1. Install the packages newserv depends on.
* If you're on Windows, install [Cygwin](https://www.cygwin.com/). 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).
* If you're on macOS, run `brew install cmake libevent libiconv`.
* If you're on Linux, run `sudo apt-get install cmake libevent-dev` (or use your Linux distribution's package manager).
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.
5. Run `cmake . && make` in the newserv directory.
After building newserv or downloading a release, do this to set it up and use it:
1. In the system/ directory, make a copy of config.example.json named config.json, and edit it appropriately.
2. If you plan to play PSO Blue Burst on newserv, set up the patch directory. See the "Client patch directories" section below.
3. Run `./newserv` in the newserv directory. This will start the game server and run the interactive shell. You may need `sudo` if newserv's built-in DNS server is enabled.
4. If you set AllowUnregisteredUsers to false in config.json, use the interactive shell to add your license. Run `help` in the shell to see how to do this.
5. Set your client's network settings appropriately and start an online game. See the "Connecting local clients" or "Connecting remote clients" section to see how to get your game client to connect.
After building newserv, edit system/config.example.json as needed and rename it to system/config.json, set up [client patch directories](#client-patch-directories) if you're planning to play Blue Burst, then run `./newserv` in newserv's directory.
To use newserv in other ways (e.g. for translating data), see the end of this document.
### Installing quests
## Client patch directories
newserv implements a patch server for PSO PC and PSO BB game data. Any file or directory you put in the system/patch-bb or system/patch-pc directories will be synced to clients when they connect to the patch server.
For Blue Burst set up, the below is mandatory for a smooth experience:
1. Browse to your chosen client's data directory.
2. Copy all the map_*.dat files and the data.gsl file and place them in `system/patch-bb/data`
For BB clients, newserv reads some files out of the patch data to implement game logic, so it's important that certain game files are synchronized between the server and the client. newserv contains defaults for these files in the system/maps/bb-v4 directory, but if these don't match the client's copies of the files, odd behavior will occur in games.
To make server startup faster, newserv caches the modification times, sizes, and checksums of the files in the patch directories. If the patch server appears to be misbehaving, try deleting the .metadata-cache.json file in the relevant patch directory to force newserv to recompute all the checksums. Also, in the case when checksums are cached, newserv may not actually load the data for a patch file until it's needed by a client. Therefore, modifying any part of the patch tree while newserv is running can cause clients to see an inconsistent view of it.
Patch directory contents are cached in memory. If you've changed any of these files, you can run `reload patch-indexes` in the interactive shell to make the changes take effect without restarting the server.
## How to connect
### PSO DC
Depending on the version of PSO DC that you have, the instructions to connect to a newserv instance will vary.
If you have NTE, USv1, EUv1, or EUv2 and a Broadband Adapter, edit the broadband DNS address to newserv's IP address with newserv's DNS server running. Otherwise, it is necessary to patch the disc or use a codebreaker code to remove the Hunter License server check and/or redirect PSO to the newserv instance. Patching the disc or creating a codebreaker code is beyond the scope of this document.
### PSO DC on Flycast
If you're emulating PSO DC, the NTE, USv1, EUv1, and EUv2 versions will connect to newserv by setting the following options in Flycast's `emu.cfg` file under `[network]`:
- DNS = Your newserv's server address (newserv's DNS server must be running on port 53)
- EmulateBBA = yes
- Enable = yes
It is also necessary to save any DNS information to the flash memory of the Dreamcast to use the BBA - the easiest way to do this is to use the website option in USv2 and then choose the save to flash option.
If the server is running on the same machine as Flycast, this might not work, even if you point Flycast's DNS queries at your local IP address (instead of 127.0.0.1). In this case, you can modify the loaded executable in memory to make it connect anywhere you want. There is a script included with newserv that can do this on macOS; a similar technique could be done manually using scanmem on Linux or Cheat Engine on Windows. To use the script, do this:
1. Build and install [memwatch](https://github.com/fuzziqersoftware/memwatch).
2. Start Flycast and run PSO. (You must start PSO before running the script; it won't work if you run the script before loading the game.)
3. Run `sudo patch_flycast_memory.py <original-destination>`. Replace `<original-destination>` with the hostname that PSO wants to connect to (you can find this out by using Wireshark and looking for DNS queries). The script may take up to a minute; you can continue using Flycast while it runs, but don't start an online game until the script is done.
4. Run newserv and start an online game in PSO.
If you use this method, you'll have to run the script every time you start PSO in Flycast, but you won't have to run it again if you start another online game without restarting emulation.
If using JPv1, JPv2, or USv2, it is also necessary to remove the Hunter Licence server check, either with a disc patch or codebreaker code. Patching the disc or creating a codebreaker code is beyond the scope of this document.
### PSO PC
PSO PC has its connection addresses in `pso.exe`. Hex edit the executable with the connection address you want to connect to. Common server addresses to search for to replace are:
- pso20.sonic.isao.net
- sg207634.sonicteam.com
- pso-mp01.sonic.isao.net
- gsproduc.ath.cx
- sylverant.net
The version of PSO PC I have has the server addresses starting at offset 0x29CB34 in pso.exe. Change those addresses to "localhost" (without quotes) if you just want to connect to a locally-running newserv instance. Alternatively, you can add an entry to the Windows hosts file (C:\Windows\System32\drivers\etc\hosts) to redirect the connection to 127.0.0.1 (localhost) or any other IP address.
### PSO GC on a real GameCube
You can make PSO connect to newserv by setting its default gateway and DNS server addresses in network settings to newserv's address. newserv's DNS server must be running on port 53 and must be accessible to the GameCube.
If you have PSO Plus or Episode III, it won't want to connect to a server on the same local network as the GameCube itself, as determined by the GameCube's IP address and subnet mask. In the old days, one way to get around this was to create a fake network adapter on the server (or use an existing real one) that has an IP address on a different subnet, tell the GameCube that the server is the default gateway (as above), and have the server reply to the DNS request with its non-local IP address. To do this with newserv, just set LocalAddress in the config file to a different interface. For example, if the GameCube is on the 192.168.0.x network and your other adapter has address 10.0.1.6, set newserv's LocalAddress to 10.0.1.6 and set PSO's DNS server and default gateway addresses to the server's 192.168.0.x address. This may not work on modern systems or on non-Windows machines - I haven't tested it in many years.
### PSO GC on a Wii or Wii U
Using a Wii or Wii U to connect to newserv requires the Wii or vWii to be softmodded. How to do this is beyond the scope of this document.
Nintendont includes BBA emulation and is compatible with all PSO GameCube versions except Episodes I&II Trial Edition. To use Nintendont, enable BBA emulation in Nintendont's settings and follow the instructions in the above section (PSO GC on a real GameCube).
Devolution includes modem emulation and is compatible with all PSO GameCube versions including Episodes I&II Trial Edition. newserv can act as a PPP server, which Devolution can directly cnnect to. To do this:
1. Enable the PPPRawListen option according to the comments in config.json.
2. Start newserv.
3. In the game's network settings, set the username and password to anything (they cannot be blank), and set the phone number to the number that newserv outputs to the console during startup. (It will be near the end of all the startup log messages.) If your Wii is on the same network as newserv, use the local number; otherwise, use the external number.
### PSO GC on Dolphin
If you're using the HLE BBA type, set the BBA's DNS server address to newserv's IP address and it should work. (If newserv is on the same machine as Dolphin, you will need to use an action replay code directed at 127.0.0.1 to connect, as PSO rejects DNS queries from the same IP address.) Set PSO's network settings the same as listed below.
If you're using the TAP BBA type, you'll have to set PSO's network settings appropriately for your tap interface. Set the DNS server address in PSO's network settings to newserv's IP address.
If you're using a version of Dolphin with tapserver support, you can make it connect to a newserv instance running on the same machine via the tapserver interface. You do not need to install or run tapserver. To do this:
1. Set Dolphin's BBA type to tapserver (Config -> GameCube -> SP1).
2. Enable newserv's IP stack simulator according to the comments in config.json and start newserv.
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.
For GC clients, you'll have to use newserv's built-in DNS server or set up your own DNS server as well. If you want external clients to be able to use your DNS server, you'll have to forward UDP port 53 to your newserv instance. Remote players can then connect to your server by entering your DNS server's IP address in their client's network configuration.
# Server feature configuration
## Installing quests
newserv automatically finds quests in the subdirectories of the system/quests/ directory. To install your own quests, or to use quests you've saved using the proxy's Save Files option, just put them in one of the subdirectories there and name them appropriately. The subdirectories and their behaviors (e.g. in which game modes they should appear and for which PSO versions) is defined in the QuestCategories field in config.json.
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)
@@ -115,8 +256,8 @@ There are multiple PSO quest formats out there; newserv supports all of them. It
| 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 |
@@ -133,11 +274,36 @@ Episode 3 download quests consist only of a .bin file - there is no correspondin
When newserv indexes the quests during startup, it will warn (but not fail) if any quests are corrupt or in unrecognized formats.
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.
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 quest-index` 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
### Episode 3 features
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, items dropped in private mode 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
newserv supports many features unique to Episode 3:
* CARD battles. Not every combination of abilities has been tested yet, so if you find a feature or card ability that doesn't work like it's supposed to, please make a GitHub issue and describe the situation (the attacking card(s), defending card(s), and ability or condition that didn't work).
@@ -148,11 +314,11 @@ newserv supports many features unique to Episode 3:
* Participating in card auctions. (The auction contents must be configured in config.json.)
* Decorations in lobbies. Currently only images are supported; the game also supports loading custom 3D models in lobbies, but newserv does not implement this (yet).
#### Battle records
### 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
### Tournaments
Tournaments work differently than they did on Sega's servers. Tournaments can be created with the `create-tournament` shell command, which enables players to register for them. (Use `help` to see all the arguments - there are many!) The `start-tournament` shell command starts the tournament (and prevents further registrations), but this doesn't schedule any matches. Instead, players who are ready to play their next match can all stand at the 4-player battle table near the lobby warp in the same CARD lobby, and the tournament match will start automatically.
@@ -160,7 +326,7 @@ These tournament semantics mean that there can be multiple matches in the same t
The Meseta rewards for winning tournament matches can be configured in config.json.
#### Episode 3 files
### Episode 3 files
Episode 3 state and game data is stored in the system/ep3 directory. The files in there are:
* card-definitions.mnr: Compressed card definition list, sent to Episode 3 clients at connect time. Card stats and abilities can be changed by editing this file.
@@ -174,42 +340,35 @@ Episode 3 state and game data is stored in the system/ep3 directory. The files i
There is no public editor for Episode 3 maps and quests, but the format is described fairly thoroughly in src/Episode3/DataIndexes.hh (see the MapDefinition structure). You'll need to use `newserv decompress-prs ...` to decompress .bin or .mnm files before editing them, but you don't need to compress the files again to use them - just put the .bind or .mnmd file in the maps directory and newserv will make it available.
Like quests, Episode 3 card definitions, maps, and quests are cached in memory. If you've changed any of these files, you can run `reload ep3` in the interactive shell to make the changes take effect without restarting the server.
Like quests, Episode 3 card definitions, maps, and quests are cached in memory. If you've changed any of these files, you can run `reload ep3-data` in the interactive shell to make the changes take effect without restarting the server.
### Client patch directories
## Memory patches, client functions, and DOL files
If you're not playing PSO Blue Burst on newserv, you can skip these steps.
newserv implements a patch server for PSO PC and PSO BB game data. Any file or directory you put in the system/patch-bb or system/patch-pc directories will be synced to clients when they connect to the patch server.
To make server startup faster, newserv caches the modification times, sizes, and checksums of the files in the patch directories. If the patch server appears to be misbehaving, try deleting the .metadata-cache.json file in the relevant patch directory to force newserv to recompute all the checksums. Also, in the case when checksums are cached, newserv may not actually load the data for a patch file until it's needed by a client. Therefore, modifying any part of the patch tree while newserv is running can cause clients to see an inconsistent view of it.
For BB clients, newserv reads some files out of the patch data to implement game logic, so it's important that certain game files are synchronized between the server and the client. newserv contains defaults for these files in the system/blueburst/map directory, but if these don't match the client's copies of the files, odd behavior will occur in games.
Specifically, the patch-bb directory should contain at least the data.gsl file and all map_*.dat files from the version of PSOBB that you want to play on newserv. You can copy these files out of the client's data directory from a clean installation, and put them in system/patch-bb/data.
Patch directory contents are cached in memory. If you've changed any of these files, you can run `reload patches` in the interactive shell to make the changes take effect without restarting the server.
### Memory patches and DOL files
Everything in this section requires resource_dasm to be installed, so newserv can use the PowerPC assembler and disassembler from its libresource_file library. If resource_dasm is not installed, newserv will still build and run, but these features will not be available.
Everything in this section requires resource_dasm to be installed, so newserv can use the assemblers and disassemblers from its libresource_file library. If resource_dasm is not installed, newserv will still build and run, but these features will not be available.
In addition, these features are only supported for the following game versions:
* PSO GameCube Episodes 1&2 JP, USA, and EU (not Plus)
* PSO GameCube Episodes 1&2 Plus JP v1.04 (not v1.05)
* PSO GameCube Episodes 1&2 Trial Edition
* PSO GameCube Episodes 1&2 JP, USA, and EU but not Plus
* PSO GameCube Episodes 1&2 Plus JP v1.4 but not v1.5
* PSO GameCube Episode 3 Trial Edition
* PSO GameCube Episode 3 JP
* PSO GameCube Episode 3 USA (experimental; must be manually enabled in config.json)
* PSO Xbox (all versions)
* PSO BB
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.
*Note: newserv uses the shorter GameCube versioning convention, where discs labeled DOL-XXXX-0-0Y are version 1.Y. The PSO community seems to use the convention 1.0Y in some places instead, but these are the same version. For example, the version that newserv calls v1.4 is the same as v1.04, and is labeled DOL-GPOJ-0-04 on the underside of the disc.*
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.
You can put memory patches in the system/client-functions directory with filenames like PatchName.patch.s and they will appear in the Patches menu for PSO GC, XB, and BB clients that support patching. Memory patches are written in PowerPC or x86 assembly and are compiled when newserv is started. The assembly system's features are documented in the comments in system/client-functions/WriteMemory.ppc.s.
newserv comes with a set of patches for GC Episodes 1&2 based on AR codes originally made by Ralf at GC-Forever and Aleron Ives. 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 for GC clients. 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.ppc.s, WriteMemory.ppc.s, and RunDOL.ppc.s must be present in the system/client-functions 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.
I mainly built the DOL loading functionality for documentation purposes. By now, there are many better ways to load homebrew code on an unmodified GameCube, but to my knowledge there isn't another open-source implementation of this method in existence.
### Using newserv as a proxy
## Using newserv as a proxy
If you want to play online on remote servers rather than running your own server, newserv also includes a PSO proxy. Currently this works with PSO GC and may work with PC and DC; it also works with some BB clients in specific situations.
@@ -226,7 +385,7 @@ There are many options available when starting a proxy session. All options are
* **Block pings**: blocks automatic pings sent by the client, and responds to ping commands from the server automatically. This works around a bug in Sylverant's login server.
* **Infinite HP**: automatically heals you whenever you get hit. An attack that kills you in one hit will still kill you, however.
* **Infinite TP**: automatically restores your TP whenever you use any technique.
* **Switch assist**: attempts to unlock doors that require two players in a one-player game.
* **Switch assist**: attempts to unlock doors that require two or four players in a one-player game.
* **Infinite Meseta** (Episode 3 only): gives you 1,000,000 Meseta, regardless of the value sent by the remote server.
* **Block events**: disables holiday events sent by the remote server.
* **Block patches**: prevents any B2 (patch) commands from reaching the client.
@@ -240,47 +399,65 @@ 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
## 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.
* `$si` (game server only): Shows basic information about the server.
* `$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.
* `$itemnotifs <mode>`: Enables item drop notification messages. If the game has private drops enabled, you will only see a notification if the dropped item is visible to you; you won't be notified of other players' drops. The modes are:
* `off`: No notifications are shown.
* `rare`: You are notified when a rare item drops.
* `on`: You are notified when any item drops, except Meseta.
* `every`: You are notified when any item drops, including Meseta.
* `$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.
* `$debug` (game server only): Enable or disable debug. You need the DEBUG permission in your user license to use this command. Enabling debug does a few things:
* You'll see in-game messages from the server when you take certain actions, like killing an enemy in BB.
* You'll see the rare seed value and floor variations when you join a game.
* You'll be placed into the highest available slot in lobbies and games instead of the lowest, unless you're joining a BB solo-mode game.
* You'll be able to join games with any PSO version, not only those for which crossplay is normally supported. Be prepared for client crashes and other client-side brokenness if you do this. Please do not submit any issues for broken behaviors in crossplay, unless the situation is explicitly supported (see the "Cross-version play" section above).
* The rest of the commands in this section are enabled on the game server. (They are always enabled on the proxy server.)
* `$quest <number>` (game server only): 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.
* `$qcheck <flag-num>` (game server only): Show the value of a quest flag. This command can be used without debug mode enabled. If you're in a game, show the value of the flag in that game; if you're in the lobby, show the saved value of that quest flag for your character (BB only).
* `$qset <flag-num>` or `$qclear <flag-num>`: Set or clear a quest flag for everyone in the game. If you're in the lobby and on BB, set or clear the saved value of a quest flag in your character file.
* `$qgread <flag-num>` (game server only): Get the value of a quest counter ("global flag"). This command can be used without debug mode enabled.
* `$qgwrite <flag-num> <value>` (game server only): Set the value of a quest counter ("global flag") for yourself.
* `$qsync <reg-num> <value>`: Set a quest register's value for yourself only. `<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.
* `$qsyncall <reg-num> <value>`: Set a quest register's value for everyone in the game. `<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.
* `$sc <data>`: Send a command to yourself.
* `$ss <data>` (proxy server only): Send a command to the remote server.
* `$meseta <amount>` (game server only; Episode 3 only): Add the given amount to your Meseta total.
* `$auction` (Episode 3 only): Bring up the CARD Auction menu, regardless of how many players are in the game or if you have a VIP card.
* `$ep3battledebug` (game server only; Episode 3 only): Enable or disable TCard00_Select. If enabled, the game will enter the debug menu when you start a battle.
* Personal state commands
* `$arrow <color-id>`: Changes your lobby arrow color.
* `$secid <section-id>`: Sets your override section ID. After running this command, any games you create will use your override section ID for rare drops instead of your character's actual section ID. To revert to your actual section id, run `$secid` with no name after it. On the proxy server, this will not work if the remote server controls item drops (e.g. on BB, or on Schtserv with server drops enabled). If the server does not allow cheat mode anywhere (that is, "CheatModeBehavior" is "Off" in config.json), this command does nothing.
* `$secid <section-id>`: Sets your override section ID. After running this command, any games you create will use your override section ID for rare drops instead of your character's actual section ID. If you're in a game and you are the leader of the game, this also immediately changes the item tables used by the server when creating items. To revert to your actual section id, run `$secid` with no name after it. On the proxy server, this will not work if the remote server controls item drops (e.g. on BB, or on Schtserv with server drops enabled). If the server does not allow cheat mode anywhere (that is, "CheatModeBehavior" is "Off" in config.json), this command does nothing.
* `$rand <seed>`: Sets your override random seed (specified as a 32-bit hex value). This will make any games you create use the given seed for rare enemies. This also makes item drops deterministic in Blue Burst games hosted by newserv. On the proxy server, this command can cause desyncs with other players in the same game, since they will not see the overridden random seed. To remove the override, run `$rand` with no arguments. If the server does not allow cheat mode anywhere (that is, "CheatModeBehavior" is "Off" in config.json), this command does nothing.
* `$ln [name-or-type]`: Sets the lobby number. Visible only to you. This command exists because some non-lobby maps can be loaded as lobbies with invalid lobby numbers. See the "GC lobby types" and "Ep3 lobby types" entries in the information menu for acceptable values here. Note that non-lobby maps do not have a lobby counter, so there's no way to exit the lobby without using either `$ln` again or `$exit`. On the game server, `$ln` reloads the lobby immediately; on the proxy server, it doesn't take effect until you load another lobby yourself (which means you'll like have to use `$exit` to escape). Run this command with no argument to return to the default lobby.
* `$swa`: Enables or disables switch assist. When enabled, the server will attempt to automatically unlock two-player and four-player doors in non-quest games if you step on all the required switches sequentially.
* `$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
* Character data commands (game server only)
* `$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.
* `$edit <stat> <value>`: Modifies your character data. If you are on V3 (GameCube/Xbox), 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. If cheats are allowed on the server, `<stat>` can be any of `atp`, `mst`, `evp`, `hp`, `dfp`, `ata`, `lck`, `meseta`, `exp`, `level`, `namecolor`, `secid`, `name`, `npc`, or `tech`. If cheats are not allowed, only `namecolor`, `name`, and `npc` can be used.
* Blue Burst player commands (game server only)
* `$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.
@@ -290,27 +467,27 @@ Some commands only work on the game server and not on the proxy server. The chat
* `$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.
* `$persist`: Enable or disable persistence for the current game. When persistence is on, the game will not be deleted when the last player leaves. The states of enemies, objects, and switches will be saved, and items left on the floor will not be deleted (except items only visible to the leaving player). If the game is empty for too long (15 minutes by default), it is then deleted. There is an edge case with persistence: if the player defeats a boss, leaves the room, joins again, and returns to the boss arena, neither the boss nor the exit warp will spawn, so they will be stuck there and have to use $warp or Quit Game to get out. For this reason, `$warp 0` is allowed in boss arenas once the boss is defeated, even if cheat mode is disabled.
* 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.
* `$inftime`: Toggles infinite-time mode. Must be used before starting a battle. If infinite-time mode is enabled, the overall and per-phase time limits will be disabled regardless of the values chosen during battle setup. After completing a battle, infinite-time mode is reset to the server's default value (which can be set in Episode3BehaviorFlags in config.json).
* `$defrange <min>-<max>`: Sets the DEF dice range for the next battle. If this is used, the dice range set during battle rules setup will apply only to ATK dice; DEF dice will use this range instead. Assist cards and other dice effects will still apply. Dice exchange also still applies if it is enabled.
* `$dicerange [d:L-H] [1:L-H] [a1:L-H] [d1:L-H]`: Sets override dice ranges for the next battle. The min and max dice values from the rules setup menu always apply to the ATK dice, but you can specify a different range for the DEF dice with `d:2-4` (for example). The `1:` override applies to the 1-player team in a 2v1 game (so you would set the 2-player team's desired dice range in the rules menu). You can also specify the 1-player team's ATK and DEF ranges separately with the `a1:` and `d1:` overrides. Note that these ranges will only be used if the chosen map or quest does not override them.
* `$stat <what>`: Shows a statistic about your player or team in the current battle. `<what>` can be `duration`, `fcs-destroyed`, `cards-destroyed`, `damage-given`, `damage-taken`, `opp-cards-destroyed`, `own-cards-destroyed`, `move-distance`, `cards-set`, `fcs-set`, `attack-actions-set`, `techs-set`, `assists-set`, `defenses-self`, `defenses-ally`, `cards-drawn`, `max-attack-damage`, `max-combo`, `attacks-given`, `attacks-taken`, `sc-damage`, `damage-defended`, or `rank`.
* `$surrender`: Causes your team to immediately lose the current battle.
* `$saverec <name>`: Saves the recording of the last battle.
* `$playrec <name>`: Plays a battle recording. This command creates a spectator team and replays the specified battle log within it. There is a bug in Dolphin that makes use of this command unstable in emulation (see the "Battle records" section above).
* Cheat mode commands
* `$cheat`: Enables or disables cheat mode for the current game. All other cheat mode commands do nothing if cheat mode is disabled. By default, cheat mode is off in new games but can be enabled; there is an option in config.json that allows you to disable cheat mode entirely, or set it to on by default in new games.
* `$infhp` / `$inftp`: Enables or disables infinite HP or TP mode. Applies to only you. In infinite HP mode, one-hit KO attacks will still kill you.
* `$warpme <floor-id>`: Warps yourself to the given floor.
* `$cheat` (game server only): Enables or disables cheat mode for the current game. All other cheat mode commands do nothing if cheat mode is disabled. By default, cheat mode is off in new games but can be enabled; there is an option in config.json that allows you to disable cheat mode entirely, or set it to on by default in new games. Cheat mode is always enabled on the proxy server, unless cheat mode is disabled on the entire server.
* `$infhp` / `$inftp`: Enables or disables infinite HP or TP mode. Applies to only you. In infinite HP mode, one-hit KO attacks will still kill you. On V1 and V2, infinite HP also automatically cures status ailments.
* `$warpme <floor-id>` (or `$warp <floor-id>`): Warps yourself to the given floor.
* `$warpall <floor-id>`: Warps everyone in the game to the given floor. You must be the leader to use this command, unless you're on the proxy server.
* `$next`: Warps yourself to the next floor.
* `$swa`: Enables or disables switch assist. When enabled, the server will attempt to automatically unlock two-player doors in solo games if you step on both switches sequentially.
* `$item <desc>` (or `$i <desc>`): Create an item. `desc` may be a description of the item (e.g. "Hell Saber +5 0/10/25/0/10") or a string of hex data specifying the item code. Item codes are 16 hex bytes; at least 2 bytes must be specified, and all unspecified bytes are zeroes. If you are on the proxy server, you must not be using Blue Burst for this command to work. On the game server, this command works for all versions.
* `$unset <index>`: In an Episode 3 battle, removes one of your set cards from the field. `<index>` is the index of the set card as it appears on your screen - 1 is the card next to your SC's icon, 2 is the card to the right of 1, etc. This does not cause a Hunters-side SC to lose HP, as they normally do when their items are destroyed.
* `$unset <index>` (game server only): In an Episode 3 battle, removes one of your set cards from the field. `<index>` is the index of the set card as it appears on your screen - 1 is the card next to your SC's icon, 2 is the card to the right of 1, etc. This does not cause a Hunters-side SC to lose HP, as they normally do when their items are destroyed.
* `$dropmode [mode]` (proxy server): Changes the way item drops behave in the current game, if you are not on BB. Unlike the game server version of this command, using this on the proxy server requires cheats to be enabled. This works by intercepting the drop requests sent to and from the leader. (So, if you are the leader and not using server drop mode on the remote server, it affects the entire game; otherwise, it affects only items generated by your actions.) `mode` can be `none` (no drops), `default` (normal drops), or `proxy` (use newserv's drop tables instead of the remote server's). If `mode` is not given, tells you the current drop mode without changing it.
* Configuration commands
* `$event <event>`: Sets the current holiday event in the current lobby. Holiday events are documented in the "Using $event" item in the information menu. If you're on the proxy server, this applies to all lobbies and games you join, but only you will see the new event - other players will not.
@@ -318,94 +495,54 @@ Some commands only work on the game server and not on the proxy server. The chat
* `$song <song-id>` (Episode 3 only): Plays a specific song in the current lobby.
* Administration commands (game server only)
* `$ann <message>`: Sends an announcement message. The message text is sent to all players in all games and lobbies.
* `$ann <message>`: Sends an announcement message. The message is sent as temporary on-screen text to all players in all games and lobbies.
* `$ann! <message>`: Sends an announcement message. The message is sent as a Simple Mail message to all players in all games and lobbies.
* `$ax <message>`: Sends a message to the server's terminal. This cannot be used to run server shell commands; it only prints text to stderr.
* `$silence <identifier>`: Silences a player (remove their ability to chat) or unsilences a player. The identifier may be the player's name or Guild Card number.
* `$kick <identifier>`: Disconnects a player. The identifier may be the player's name or Guild Card number.
* `$ban <identifier>`: Bans a player. The identifier may be the player's name or Guild Card number.
### Connecting local clients
# Non-server features
#### PSO DC
newserv has many CLI options, which can be used to access functionality other than the game and proxy server. Run `newserv help` to see a full list of the options and how to use each one.
Some versions of PSO DC will connect to a private server if you just set their DNS server address (in the network configuration) to newserv's address, and enable newserv's DNS server. This will not work for other versions; for those, you'll need a cheat code. Creating such a code is beyond the scope of this document.
The data formats that newserv can convert to/from are:
If you're emulating PSO DC or have a disc image, you can patch the appropriate files within the disc image to make it connect to any address you want. Creating such a patch is also beyond the scope of this document.
| Format | Encode/compress action | Decode/extract action |
|--------------------------------|---------------------------|------------------------------|
| PRS compression | `compress-prs` | `decompress-prs` |
| PR2/PRC compression | `compress-pr2` | `decompress-pr2` |
| BC0 compression | `compress-bc0` | `decompress-bc0` |
| Raw encrypted data | `encrypt-data` | `decrypt-data` |
| Episode 3 command mask | `encrypt-trivial-data` | `decrypt-trivial-data` |
| Challenge Mode rank text | `encrypt-challenge-data` | `decrypt-challenge-data` |
| PSO DC quest file (.vms) | None | `decode-vms` |
| PSO GC quest file (.gci) | None | `decode-gci` |
| Download quest file (.dlq) | None | `decode-dlq` |
| Server quest file (.qst) | `encode-qst` | `decode-qst` |
| PSO PC save file | `encrypt-pc-save` | `decrypt-pc-save` |
| PSO GC save file (.gci) | `encrypt-gci-save` | `decrypt-gci-save` |
| PSO GC snapshot file | None | `decode-gci-snapshot` |
| Quest script (.bin) | `assemble-quest-script` | `disassemble-quest-script` |
| Quest map (.dat) | None | `disassemble-quest-map` |
| AFS archive | None | `extract-afs` |
| BML archive | None | `extract-bml` |
| GSL archive | None | `extract-gsl` |
| GVM texture | `encode-gvm` | None |
| Text archive | `encode-text-archive` | `decode-text-archive` |
| Unicode text set | `encode-unicode-text-set` | `decode-unicode-text-set` |
| Word Select data set | None | `decode-word-select-set` |
| Set data table | None | `disassemble-set-data-table` |
| Rare item table (AFS/GSL/JSON) | `convert-rare-item-set` | `convert-rare-item-set` |
#### PSO DC on Flycast
There are several actions that don't fit well into the table above, which let you do other things:
If you're emulating PSO DC, all versions will connect to newserv by setting the following options in Flycast's `emu.cfg` file under `[network]`:
- DNS = Your newserv's server address (newserv's DNS server must be running on port 53)
- EmulateBBA = yes
- Enable = yes
It is also necessary to save any DNS information to the flash memory of the Dreamcast to use the BBA - the easiest way to do this is to use the website option in USv2 and then choose the save to flash option.
Once set up, the EU and US versions will work without any extra set up (other than the HL Check Disable code for USv2), while the JP versions require HL Check Disable codes to be running.
If the server is running on the same machine as Flycast, this might not work, even if you point Flycast's DNS queries at your local IP address (instead of 127.0.0.1). In this case, you can modify the loaded executable in memory to make it connect anywhere you want. There is a script included with newserv that can do this on macOS; a similar technique could be done manually using scanmem on Linux or Cheat Engine on Windows. To use the script, do this:
1. Build and install memwatch (https://github.com/fuzziqersoftware/memwatch).
2. Start Flycast and run PSO. (You must start PSO before running the script; it won't work if you run the script before loading the game.)
3. Run `sudo patch_flycast_memory.py <original-destination>`. Replace `<original-destination>` with the hostname that PSO wants to connect to (you can find this out by using Wireshark and looking for DNS queries). The script may take up to a minute; you can continue using Flycast while it runs, but don't start an online game until the script is done.
4. Run newserv and start an online game in PSO.
If you use this method, you'll have to run the script every time you start PSO in Flycast, but you won't have to run it again if you start another online game without restarting emulation.
#### PSO PC
The version of PSO PC I have has the server addresses starting at offset 0x29CB34 in pso.exe. Using a hex editor, change those to "localhost" (without quotes) if you just want to connect to a locally-running newserv instance. Alternatively, you can add an entry to the Windows hosts file (C:\Windows\System32\drivers\etc\hosts) to redirect the connection to 127.0.0.1 (localhost) or any other IP address.
#### PSO GC on a real GameCube
You can make PSO connect to newserv by setting its default gateway and DNS server addresses to newserv's address. newserv's DNS server must be running on port 53 and must be accessible to the GameCube.
If you have PSO Plus or Episode III, it won't want to connect to a server on the same local network as the GameCube itself, as determined by the GameCube's IP address and subnet mask. In the old days, one way to get around this was to create a fake network adapter on the server (or use an existing real one) that has an IP address on a different subnet, tell the GameCube that the server is the default gateway (as above), and have the server reply to the DNS request with its non-local IP address. To do this with newserv, just set LocalAddress in the config file to a different interface. For example, if the GameCube is on the 192.168.0.x network and your other adapter has address 10.0.1.6, set newserv's LocalAddress to 10.0.1.6 and set PSO's DNS server and default gateway addresses to the server's 192.168.0.x address. This may not work on modern systems or on non-Windows machines - I haven't tested it in many years.
#### PSO GC on Dolphin
If you're using the HLE BBA type, set the BBA's DNS server address to newserv's IP address and it should work. (If newserv is on the same machine as Dolphin, try your local IP address or 127.0.0.1.) In PSO, use the example values below in PSO's network configuration.
If you're using the TAP BBA type, you'll have to set PSO's network settings appropriately for your tap interface. Set the DNS server address in PSO's network settings to newserv's IP address.
If you're using a version of Dolphin with tapserver support, you can make it connect to a newserv instance running on the same machine via the tapserver interface. You do not need to install or run tapserver. To do this:
1. Set Dolphin's BBA type to tapserver (Config -> GameCube -> SP1).
2. Enable newserv's IP stack simulator according to the comments in config.json and start newserv.
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.
For GC clients, you'll have to use newserv's built-in DNS server or set up your own DNS server as well. If you want external clients to be able to use your DNS server, you'll have to forward UDP port 53 to your newserv instance. Remote players can then connect to your server by entering your DNS server's IP address in their client's network configuration.
### Non-server features
newserv has many CLI options, which can be used to access functionality other than the game and proxy server. Run `newserv help` to see these options and how to use them. The non-server things newserv can do are:
* Compress or decompress data in PRS, PR2, or BC0 format (`compress-prs`, `compress-pr2`, `compress-bc0`, `decompress-prs`, `decompress-pr2`, `decompress-bc0`)
* Compute the decompressed size of compressed PRS data without decompressing it (`prs-size`)
* Encrypt or decrypt data using any PSO version's network encryption scheme (`encrypt-data`, `decrypt-data`)
* Encrypt or decrypt data using Episode 3's trivial scheme (`encrypt-trivial-data`, `decrypt-trivial-data`)
* Encrypt or decrypt data using the Challenge Mode text algorithm (`encrypt-challenge-data`, `decrypt-challenge-data`)
* Encrypt or decrypt PSO GC save data (.gci files) (`encrypt-gci-save`, `decrypt-gci-save`)
* Convert a PSO GC or Episode 3 snapshot file to a BMP image (`decode-gci-snapshot`)
* Find the likely round1 or round2 seed for a corrupt save file (`salvage-gci`)
* Run a brute-force search for a decryption seed (`find-decryption-seed`)
* 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`)
* 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`)
* Format Episode 3 game data in a human-readable manner (`show-ep3-maps`, `show-ep3-cards`, `generate-ep3-cards-html`)
* Format Blue Burst battle parameter files in a human-readable manner (`show-battle-params`)
* Search for rare enemy seeds that result in rare enemies on console versions (`find-rare-enemy-seeds`)
* Convert item data to a human-readable description, or vice versa (`describe-item`)
* Connect to another PSO server and pretend to be a client (`cat-client`)
* Replay a session log for testing (`replay-log`)
* Extract the contents of a .gsl or .bml archive (`extract-gsl`, `extract-bml`)
* Generate or describe DC serial numbers (`generate-dc-serial-number`, `inspect-dc-serial-number`)
+9 -7
View File
@@ -1,20 +1,22 @@
## General
- Encapsulate BB server-side random state and make replays deterministic
- Write a simple status API
- Implement per-game logging
- 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
- Add an idle connection timeout for proxy sessions
- Clean up ItemParameterTable implementation (see comment at the top of the class definition)
- Handle MeetUserExtensions properly in 41 and C4 commands on the proxy (rewrite the embedded 19 command and store a map of )
## PSO DC
- Investigate if https://crates.io/crates/blaze-ssl-async can be used to implement the HL check server
## Episode 3
- Enforce tournament deck restrictions (e.g. rank checks, No Assist option) when populating COMs at tournament start time
- Add support for recording battles on the proxy server (both in primary and spectator teams)
- Make `reload licenses` not vulnerable to online players' licenses overwriting licenses on disk somehow
- Implement ranks (based on total Meseta earned)
- Make an AR code that gets rid of the SAMPLE overlays on NTE
## PSO XBOX
@@ -24,6 +26,6 @@
## PSOBB
- Test all quest item subcommands
- Check if Commander Blade effect works and implement it if not
- Figure out which quest flags are required for solo quests and write appropriate JSON files
- Figure out why Pouilly Slime EXP doesn't work
- Make server-specified rare enemies work with maps loaded by the proxy
- Implement serialization for various table types (ItemPMT, ItemPT, etc.)
+121 -35
View File
@@ -1,29 +1,83 @@
(Ep1&2 USA) Unlock all songs in BGM test
Unlock all songs in BGM test
(Note: sadly, there are no secret/unused ones)
04368960 38600001
04368964 4E800020
Ep12-JP12 => 04367A68 38600001
04367A6C 4E800020
Ep12-JP13 => 04368ED8 38600001
04368EDC 4E800020
Ep12-JP14 => 0436A434 38600001
0436A438 4E800020
Ep12-JP15 => 0436A1E8 38600001
0436A1EC 4E800020
Ep12-US10 => 0436891C 38600001
04368920 4E800020
Ep12-US11 => 04368960 38600001
04368964 4E800020
Ep12-US12 => 0436A5B4 38600001
0436A5B8 4E800020
Ep12-EU => 043699A8 38600001
043699AC 4E800020
Ep3-NTE => 041EA948 38600001
041EA94C 4E800020
Ep3-JP => 041D8CF0 38600001
041D8CF4 4E800020
Ep3-US => 041D8D7C 38600001
041D8D80 4E800020
Ep3-EU => 041D93F0 38600001
041D93F4 4E800020
(Ep1&2 USA v1.01) Play lobby (and event) music on Pioneer 2 also
0417E0F0 60000000
Play lobby (and event) music in Morgue also
Ep12-JP12 => 0417DD34 60000000
Ep12-JP13 => 0417E0E8 60000000
Ep12-JP14 => 0417E24C 60000000
Ep12-JP15 => 0417E1AC 60000000
Ep12-US10 => 0417E0F0 60000000
Ep12-US11 => 0417E0F0 60000000
Ep12-US12 => 0417E210 60000000
Ep12-EU => 0417E6D4 60000000
Ep3-NTE => 040B8C7C 60000000
Ep3-US => 040B7028 60000000
Ep3-JP => 040B7044 60000000
Ep3-EU => 040B746C 60000000
(Ep3 USA) Play lobby (and event) music in Morgue also
040B7028 60000000
Skip white logo screens during startup
Ep12-JP12 => 0413EE54 38000007
Ep12-JP13 => 0413F1DC 38000007
Ep12-JP14 => 0413F338 38000007
Ep12-JP15 => 0413F298 38000007
Ep12-US10 => 0413F190 38000007
Ep12-US11 => 0413F190 38000007
Ep12-US12 => 0413F2A8 38000007
Ep12-EU => 0413F524 38000007
Ep3-NTE => 0409E10C 38000007
Ep3-JP => 0409D810 38000007
Ep3-US => 0409D774 38000007
Ep3-EU => 0409D9A4 38000007
(Ep3 USA) Skip white logo screens during startup
0409D774 38000007
(Episodes 1&2 USA v1.01) Skip white logo screens during startup
0413F190 38000007
Skip agreement prompts before online game
Ep12-JP12 => 0432737C 38000003
Ep12-JP13 => 043283CC 38000003
Ep12-JP14 => 043298E8 38000003
Ep12-JP15 => 04329690 38000003
Ep12-US10 => 04327D3C 38000003
Ep12-US11 => 04327D80 38000003
Ep12-US12 => 0432984C 38000003
Ep12-EU => 04328C58 38000003
Ep3-NTE => 041C67D0 38000003
Ep3-JP => 041B5234 38000003
Ep3-US => 041B50C8 38000003
Ep3-EU => 041B574C 38000003
(Ep3 USA) Skip agreement prompts before online game
041B50C8 38000003
(Episodes 1&2 USA v1.01) Skip agreement prompt before online game
04327D80 38000003
Disable rate limit for pressing A during loading screens
Ep3-NTE => 042E1030 38000000
Ep3-JP => 042F8BE4 38000000
Ep3-US => 042F9B30 38000000
Ep3-EU => 042FA734 38000000
(Ep3 USA) Disable rate limit for pressing A during loading screens
042F9B30 38000000
(Ep3 USA) Auto-press A as fast as possible during loading screens
042F9AC0 60000000
Auto-press A as fast as possible during loading screens
Ep3-EU => 042FA6C4 60000000
Ep3-US => 042F9AC0 60000000
Ep3-NTE => 040C2C48 60000000
Ep3-JP => 042F8B74 60000000
(Ep3 USA) Replace loading screen A button sounds with random sounds
042F9B18 4804BB19
@@ -32,6 +86,13 @@
042F9B24 64630005
042F9B28 38800000
(Ep3 NTE) Replace loading screen A button sounds with random sounds
042E1018 480309A9
042E101C 5463063E
042E1020 60631400
042E1024 64630005
042E1028 38800000
(Ep3 USA) Change color of loading screens
(Replace AA, RR, GG, BB appropriately)
042FA704 3CC0AARR
@@ -43,11 +104,16 @@
0400BD64 EC5D00B2
0400BD68 4E800020
(Ep3 USA) Disable darkening effect during battle details mode
042F951C 4E800020
Disable darkening effect during battle details mode
Ep3-NTE => 042E09D8 4E800020
Ep3-JP => 042F85D0 4E800020
Ep3-US => 042F951C 4E800020
Ep3-EU => 042FA120 4E800020
(Ep3 USA) Unlock all COM decks
042CA908 38600001
Unlock all COM decks
Ep3-JP => 042C9B34 38600001
Ep3-EU => 042CB414 38600001
Ep3-US => 042CA908 38600001
(Ep3 USA) Enable all lobby counter options in non-CARD lobbies
04096A8C 480000C0
@@ -103,8 +169,11 @@
040002BC 7C633050
040002C0 4E800020
(Ep3 USA) Unlock all offline free battle maps
042CAA00 38600001
Unlock all offline free battle maps
Ep3-NTE => 042BE538 38600001
Ep3-JP => 042C9C2C 38600001
Ep3-EU => 042CB50C 38600001
Ep3-US => 042CAA00 38600001
(This unlocks ALL maps, including a bunch of maps with garbage names that crash if you try to play them)
(Ep3 USA) Talk to auction counter offline to get all cards
@@ -155,7 +224,7 @@
0400BEAC 7C0803A6
0400BEB0 482E9FC0
(Episodes 1&2 USA v1.01) Press L for enemy debug; enable various other debug messages
(Episodes 1&2 USA v1.1) Press L for enemy debug; enable various other debug messages
040FD9D8 38600001 # Various enemy debug messages
00153E53 00000001 # Poison fog debug 1
00153E4B 00000001 # Poison fog debug 2
@@ -165,8 +234,10 @@
025CB6AA 00000001
TODO: Figure out more debug message conditionals (vars/functions) and add them here
(Episode 3 USA) Able to find VIP cards offline (but they're still rare)
042C0B20 4800000C
Able to find VIP cards offline (but they're still rare)
Ep3-EU => 042C15DC 4800000C
Ep3-JP => 042BFE24 4800000C
Ep3-US => 042C0B20 4800000C
(Ep3 USA) Hold L when starting battle to enter debug menu
042C5460 4BD3AF78
@@ -181,8 +252,11 @@ TODO: Figure out more debug message conditionals (vars/functions) and add them h
040003F8 3800001A
040003FC 482C5068
(Ep3 USA) Dressing room always accessible
041A16FC 38600001
Dressing room always accessible
Ep3-NTE => 041B2A2C 38600001
Ep3-JP => 041A1920 38600001
Ep3-EU => 041A1C84 38600001
Ep3-US => 041A16FC 38600001
(Ep3 USA) Full dressing room v1
Can't change your class, but you start with your existing appearance
@@ -201,8 +275,11 @@ Go online with this code on after using the dressing room to fully save changes
(Ep3 USA) Replace Options menu with debug menu
04149E70 38600019
(Ep3 USA) Jukebox is free
0430D1DC 48000024
Jukebox is free
Ep3-NTE => 042248C4 48000024 (useless because the jukebox isn't loaded in NTE, but apparently the code for it exists)
Ep3-JP => 0430C178 48000024
Ep3-US => 0430D1DC 48000024
Ep3-EU => 0430DE3C 48000024
(Ep3 USA) Use own character in battle (online only)
041FFAB0 4800001C
@@ -233,8 +310,11 @@ Go online with this code on after using the dressing room to fully save changes
0412F8D4 7D0803A6
0412F8D8 4BEDEBF4
(Ep3 USA) Metal tiles don't appear in Simulator map
04296904 4E800020
Metal tiles don't appear in Simulator map
Ep3-NTE => 0428FED8 4E800020
Ep3-JP => 04296054 4E800020
Ep3-US => 04296904 4E800020
Ep3-EU => 04297278 4E800020
(Ep3 USA) Enable Boooo and Laughter soundchat sounds
Note: Without a TextEnglish.pr2/pr3 patch, the menu items for these sounds will be blank (but they will still work)
@@ -264,3 +344,9 @@ Note: Without a TextEnglish.pr2/pr3 patch, the menu items for these sounds will
0442B6D8 804D804E
0442B6DC 804F802A
0442B6E0 802C0000
(Ep3 NTE) Use English language files
0408E414 38600001
0408E448 38000001
0408E44C 900DA62C
0408E450 4E800020
+28
View File
@@ -0,0 +1,28 @@
This is a list of common shared serials for the Dreamcast version of the game.
These serials are listed in decimal format for use with newserv and are not valid
for use in the game itself.
If you are looking for a serial number to use for your Dreamcast copy of the game,
please use newserv's DC serial number generator, or PSO Tool GUI at
https://segaxtreme.net/resources/pso-tool-gui-by-razorx.224/
To allow the below shared serials to be used on your server by multiple users, use
the below command (this works if the serial is already registered too):
add-license serial=<serial-number> flags=80000000
---
144243108
297233506
400533035
446310728
532044219
1315107383
1567634924
1748940599
2004318071
2309795986
3811232030
3828776100
4098754580
+56
View File
@@ -0,0 +1,56 @@
List of differences in Ep3 NTE compared to Final:
- Assist cards
- - Dice Fever sets dice to 6, not 5, and there is no Dice Fever +
- - Rich + and Charity + also don't exist
- - Powerless Rain, Brave Wind, Influence, Fix apply at a different phase of the attack procedure
- - Tech Field applies to SCs only; on Final, it applies to SCs and creatures
- - The denominator for Vengeance is 2; on Final it's 3
- - AP Absorption logic is different (TODO: see apply_ap_and_tp_adjust_assists_to_attack)
- - God Whim can use ANY assist card, not only the normally-obtainable ones, and it assigns all 4 players an assist, not only those who already had assists
- - Inflation and Deflation only cause +1 or -1 cost per action, not per card
- - Exchange can be set on other players
- - The SET_MV condition overrides Snail Pace and Stamina completely
- - Stamina sets your effective MV to 99 instead of 9
- - Land Price is 2x instead of 1.5x
- - Shuffle All and Shuffle Group don't respect deck shuffle/loop disabled settings
- - Assist Vanish clears immediately, which means it can override other assists that happen at the same time (Trash 1, Empty Hand, etc.); in Final it happens after those
- Abilities
- - Rampage and Pierce are not player-specific; that is, if an attack has Rampage against one target, it has Rampage against all targets (this distinction is important for conditional abilities like Major Rampage and Heavy Pierce)
- - Several abilities don't exist (TODO: Which ones? 0x64 and above?)
- - Abnormal conditions do not have priorities like they do on Final
- - Ability Trap seems incompletely implemented (or not implemented at all?)
- - It appears that Major Pierce doesn't work against Arkz SCs, and this was fixed in Final
- Conditions
- - Anti-Abnormality doesn't prevent Freeze, Drop, Guom, or Curse
- - SCs can get Freeze (they can't in Final)
- - Bosses do not have automatic Anti-Abnormality
- - Ability Trap prevents all abnormal conditions
- Traps
- - Traps trigger as soon as you move into their tile; on Final, they trigger at the end of the Move phase
- - Traps may use any assist card, and this can be configured in the map definition (TODO: verify this last part)
- Rules
- - Dice Boost does not exist
- - ATK and DEF dice ranges can be set independently, but there are only 7 options for each: 1-6, 1-1, 2-2, 3-3, 4-4, 5-5, 6-6
- - There may be a bug when either die is set to 1-1 so you'll always get 2 instead (TODO: verify this)
- COM interference is not implemented
- The target's defense power is computed after checking if the attack is Resta instead of before
- Card definitions
- - The n21 and n22 arg2 conditions don't exist
- - The p25 condition finds cards with Paralyze or Fly in NTE, vs. Aerial or Fly in Final; looks like a copy-paste error by Sega
- - The p36 condition includes SCs and items on NTE, but only SCs on Final
- - The p41 condition includes only your team on NTE, but both teams on Final
- - Several tokens can't be used in expr fields: ddm, sat, edm, ldm, rdm, fdm, ndm, ehp
- Missing rule checks
- - Boss SCs can use items
- - Move logic is different, which I didn't reverse-engineer because I was too lazy and couldn't imagine how it could be meaningfully different from Final
- - Many values are not clamped (in Final, many are clamped to 0-9 or -99-99)
- - You can set cards that aren't actually in your hand
- - The game assumes team A always is at the top facing down and team B is always at the bottom facing up; if the map defines them to start on different edges or facing different directions than expected, the creature summoning areas will be wrong
- - Character HP rule completely overrides the HP stat on SC cards; in Final, the SC's HP stat is added to Character HP
- - Boss SCs are not exempt from this either; they have the same HP as normal SCs
- - Cards marked as dead but not yet deleted can still attack
- - The HOLD (6) and CANNOT_DEFEND (7) conditions don't actually stop you from defending
- - There is no hard limit of 1000 turns for any battle
- - In case of a draw, the first two tiebreaker rules (number of dead SCs and remaining SC HP) are skipped
- The server cannot override EXP result values (thus post-battle EXP loss cannot be disabled)
- Surprisingly, the code for PBs is identical between NTE and Final; it seems like they didn't spend any time on PBs after NTE at all
+1 -1
View File
@@ -81,7 +81,7 @@ blr
Ep1&2 v1.01 version of the above code
Ep1&2 v1.1 version of the above code
send_D9
./m68kdasm --assemble-ppc32 --ppc32 --start-address=801DA398
+163
View File
@@ -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 WriteCodeBlocksGC\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()
+1026 -984
View File
File diff suppressed because it is too large Load Diff
+933
View File
@@ -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
Draw Distance
*** name=Draw Distance
*** 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
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+32
View File
@@ -0,0 +1,32 @@
########################################################################
Restore JP PSOBB original IME Behavior
########################################################################
The default Tethealla client included a custom patch to disable the IME
system in-game which allows you to type in Japanese (presumably to allow
English versions of Windows to type properly)
However, if you plan to play PSOBB in it's original Japanese language it
is recommended you remove this patch to restore the original functions
Open a unpacked PSOBB.exe in a hex editor and:
FIND 9CC38E
REPLACE WITH A8838F
Make sure to install Japanese Language Support in Windows 10/11 to enable
the Japanese keyboard and IME.
If there's a problem, you can also use the Legacy IME by heading into the
options of the Japanese Language settings and scroll down to the bottom of
the page to enable Legacy IME Support to restore the original Pre-Windows 7
IME system.
Last but not least, remember the default Tethealla client is the original
Japanese client, so you don't need to apply any other special patch but this
one and make sure you have the original Japanese files set in your data folder
the game should start entirely in Japanese.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
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
View File
@@ -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))
+10
View File
@@ -2,7 +2,17 @@
#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 void run_xbe_patch_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");
}
+569 -83
View File
@@ -1,99 +1,311 @@
#include "ARCodeTranslator.hh"
#include <array>
#include <future>
#include <phosg/Filesystem.hh>
#include <phosg/Strings.hh>
#include <resource_file/ExecutableFormats/DOLFile.hh>
#include <resource_file/ExecutableFormats/XBEFile.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, make_shared<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 = this->files.at(this->src_filename);
}
void find_rtoc_global_regs() const {
for (const auto& it : this->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 : this->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 +313,328 @@ 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;
};
class XBEPatchTranslator {
public:
enum class ExpandMethod {
FORWARD = 0,
BACKWARD,
BOTH,
};
static const char* name_for_expand_method(ExpandMethod method) {
switch (method) {
case ExpandMethod::FORWARD:
return "FORWARD";
case ExpandMethod::BACKWARD:
return "BACKWARD";
case ExpandMethod::BOTH:
return "BOTH";
default:
throw logic_error("invalid expand method");
}
}
XBEPatchTranslator(const string& directory)
: log("[xbe-trans] "),
directory(directory) {
while (ends_with(this->directory, "/")) {
this->directory.pop_back();
}
for (const auto& filename : list_directory(this->directory)) {
if (ends_with(filename, ".xbe")) {
string name = filename.substr(0, filename.size() - 4);
string path = directory + "/" + filename;
this->files.emplace(name, make_shared<XBEFile>(path.c_str()));
this->log.info("Loaded %s", name.c_str());
}
}
}
~XBEPatchTranslator() = 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 = this->files.at(this->src_filename);
}
uint32_t find_match(
shared_ptr<const XBEFile> dest_file,
uint32_t src_address,
uint32_t src_size,
ExpandMethod expand_method) const {
if (!this->src_file) {
throw runtime_error("no source file selected");
}
const XBEFile::Section* src_section = nullptr;
for (const auto& sec : this->src_file->sections) {
if (src_address >= sec.addr && src_address < sec.addr + sec.file_size) {
src_section = &sec;
break;
}
}
if (!src_section) {
throw runtime_error("source address not within any section");
}
const char* method_token = this->name_for_expand_method(expand_method);
size_t src_offset = src_address - src_section->addr;
size_t src_bytes_available_before = src_offset;
size_t src_bytes_available_after = src_section->file_size - src_offset - src_size;
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 + src_size < 0x100) {
size_t num_matches = 0;
size_t last_match_address = 0;
size_t match_length = match_bytes_before + match_bytes_after + src_size;
auto src_r = this->src_file->read_from_addr(src_section->addr + 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 + match_length <= dest_section.file_size; dest_match_offset++) {
src_r.go(0);
StringReader dest_r = dest_file->read_from_addr(dest_section.addr + dest_match_offset, match_length);
size_t z;
for (z = 0; z < match_length; z++) {
uint8_t src_data = src_r.get_u8();
uint8_t dest_data = dest_r.get_u8();
if (src_data != dest_data) {
break;
}
}
if (z == match_length) {
num_matches++;
last_match_address = dest_section.addr + dest_match_offset + match_bytes_before;
}
}
}
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:
can_expand_backward = (src_bytes_available_before > match_bytes_before);
break;
case ExpandMethod::FORWARD:
can_expand_forward = (src_bytes_available_after > match_bytes_after);
break;
case ExpandMethod::BOTH:
can_expand_backward = (src_bytes_available_before > match_bytes_before);
can_expand_forward = (src_bytes_available_after > match_bytes_after);
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++;
}
if (can_expand_forward) {
match_bytes_after++;
}
}
throw runtime_error("scan field too long; too many matches");
}
void find_all_matches(uint32_t src_addr, uint32_t src_size) 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>, 3> futures;
static const array<ExpandMethod, 3> methods = {
ExpandMethod::FORWARD,
ExpandMethod::BACKWARD,
ExpandMethod::BOTH,
};
for (size_t z = 0; z < methods.size(); z++) {
futures[z] = async(&XBEPatchTranslator::find_match, this, it.second, src_addr, src_size, 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");
}
strip_trailing_whitespace(tokens[tokens.size() - 1]);
if (tokens[0] == "use") {
this->set_source_file(tokens.at(1));
} else if (tokens[0] == "match") {
this->find_all_matches(stoul(tokens.at(1), nullptr, 16), stoul(tokens.at(2), nullptr, 16));
} else if (!tokens[0].empty()) {
throw runtime_error("unknown command");
}
}
void run_shell() {
while (!feof(stdin)) {
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> ", this->directory.c_str());
}
fflush(stdout);
string command = fgets(stdin);
try {
this->handle_command(command);
} catch (const exception& e) {
this->log.error("Failed: %s", e.what());
}
}
fputc('\n', stdout);
}
private:
PrefixedLogger log;
string directory;
unordered_map<string, shared_ptr<const XBEFile>> files;
string src_filename;
shared_ptr<const XBEFile> 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();
}
}
void run_xbe_patch_translator(const std::string& directory, const std::string& use_filename, const std::string& command) {
XBEPatchTranslator 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;
}
+8 -2
View File
@@ -1,5 +1,11 @@
#pragma once
#include <string>
#include <stdint.h>
void run_ar_code_translator(const std::string& initial_directory, const std::string& use_file, const std::string& command);
#include <string>
#include <utility>
#include <vector>
void run_ar_code_translator(const std::string& directory, const std::string& use_filename, const std::string& command);
void run_xbe_patch_translator(const std::string& directory, const std::string& use_filename, 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);
+1 -1
View File
@@ -20,7 +20,7 @@ void BattleParamsIndex::Table::print(FILE* stream) const {
e.char_stats.dfp.load(),
e.char_stats.ata.load(),
e.char_stats.lck.load(),
e.unknown_a1.load(),
e.esp.load(),
e.experience.load(),
e.meseta.load());
};
+1 -1
View File
@@ -24,7 +24,7 @@ public:
/* 04 */ le_int16_t ata_bonus;
/* 06 */ le_uint16_t unknown_a4;
/* 08 */ le_float distance_x;
/* 0C */ le_float angle_x;
/* 0C */ le_uint32_t angle_x; // Out of 0x10000 (high 16 bits are unused)
/* 10 */ le_float distance_y;
/* 14 */ le_uint16_t unknown_a8;
/* 16 */ le_uint16_t unknown_a9;
+65 -14
View File
@@ -31,21 +31,19 @@
using namespace std;
CatSession::exit_shell::exit_shell() : runtime_error("shell exited") {}
CatSession::CatSession(
shared_ptr<struct event_base> base,
const struct sockaddr_storage& remote,
Version version,
shared_ptr<const PSOBBEncryption::KeyFile> bb_key_file)
: Shell(base),
log(string_printf("[CatSession:%s] ", name_for_enum(version)), proxy_server_log.min_level),
channel(
version,
1,
CatSession::dispatch_on_channel_input,
CatSession::dispatch_on_channel_error,
this,
"CatSession"),
: log(string_printf("[CatSession:%s] ", name_for_enum(version)), proxy_server_log.min_level),
base(base),
read_event(event_new(this->base.get(), 0, EV_READ | EV_PERSIST, CatSession::dispatch_read_stdin, this), event_free),
channel(version, 1, CatSession::dispatch_on_channel_input, CatSession::dispatch_on_channel_error, this, "CatSession"),
bb_key_file(bb_key_file) {
if (remote.ss_family != AF_INET) {
throw runtime_error("remote is not AF_INET");
}
@@ -64,6 +62,14 @@ CatSession::CatSession(
reinterpret_cast<const sockaddr*>(&remote), sizeof(struct sockaddr_in)) != 0) {
throw runtime_error(string_printf("failed to connect (%d)", EVUTIL_SOCKET_ERROR()));
}
event_add(this->read_event.get(), nullptr);
this->poll.add(0, POLLIN);
}
void CatSession::execute_command(const std::string& command) {
string full_cmd = parse_data_string(command, nullptr, ParseDataFlags::ALLOW_FILES);
send_command_with_header(this->channel, full_cmd.data(), full_cmd.size());
}
void CatSession::dispatch_on_channel_input(
@@ -129,9 +135,54 @@ void CatSession::on_channel_error(short events) {
}
}
void CatSession::print_prompt() {}
void CatSession::execute_command(const std::string& command) {
string full_cmd = parse_data_string(command, nullptr, ParseDataFlags::ALLOW_FILES);
send_command_with_header(this->channel, full_cmd.data(), full_cmd.size());
void CatSession::dispatch_read_stdin(evutil_socket_t, short, void* ctx) {
reinterpret_cast<CatSession*>(ctx)->read_stdin();
}
void CatSession::read_stdin() {
bool any_command_read = false;
for (;;) {
auto poll_result = this->poll.poll();
short fd_events = 0;
try {
fd_events = poll_result.at(0);
} catch (const out_of_range&) {
}
if (!(fd_events & POLLIN)) {
break;
}
string command(2048, '\0');
if (!fgets(command.data(), command.size(), stdin)) {
if (!any_command_read) {
// ctrl+d probably; we should exit
fputc('\n', stderr);
event_base_loopexit(this->base.get(), nullptr);
return;
} else {
break; // probably not EOF; just no more commands for now
}
}
// trim the extra data off the string
size_t len = strlen(command.c_str());
if (len == 0) {
break;
}
if (command[len - 1] == '\n') {
len--;
}
command.resize(len);
any_command_read = true;
try {
execute_command(command);
} catch (const exit_shell&) {
event_base_loopexit(this->base.get(), nullptr);
return;
} catch (const exception& e) {
fprintf(stderr, "FAILED: %s\n", e.what());
}
}
}
+18 -5
View File
@@ -14,28 +14,41 @@
#include "PSOEncryption.hh"
#include "PSOProtocol.hh"
#include "ServerState.hh"
#include "Shell.hh"
class CatSession : public Shell {
class CatSession {
public:
CatSession(
std::shared_ptr<struct event_base> base,
const struct sockaddr_storage& remote,
Version version,
std::shared_ptr<const PSOBBEncryption::KeyFile> bb_key_file);
CatSession(const CatSession&) = delete;
CatSession(CatSession&&) = delete;
CatSession& operator=(const CatSession&) = delete;
CatSession& operator=(CatSession&&) = delete;
virtual ~CatSession() = default;
protected:
PrefixedLogger log;
std::shared_ptr<struct event_base> base;
std::unique_ptr<struct event, void (*)(struct event*)> read_event;
Poll poll;
Channel channel;
std::shared_ptr<const PSOBBEncryption::KeyFile> bb_key_file;
virtual void print_prompt();
class exit_shell : public std::runtime_error {
public:
exit_shell();
~exit_shell() = default;
};
virtual void execute_command(const std::string& command);
static void dispatch_on_channel_input(
Channel& ch, uint16_t command, uint32_t flag, std::string& msg);
static void dispatch_read_stdin(evutil_socket_t fd, short events, void* ctx);
static void dispatch_on_channel_input(Channel& ch, uint16_t command, uint32_t flag, std::string& msg);
static void dispatch_on_channel_error(Channel& ch, short events);
void on_channel_input(uint16_t command, uint32_t flag, std::string& msg);
void on_channel_error(short events);
void read_stdin();
};
+2 -1
View File
@@ -271,7 +271,7 @@ void Channel::send(uint16_t cmd, uint32_t flag, const std::vector<std::pair<cons
case Version::DC_V2:
case Version::GC_NTE:
case Version::GC_V3:
case Version::GC_EP3_TRIAL_EDITION:
case Version::GC_EP3_NTE:
case Version::GC_EP3:
case Version::XB_V3: {
PSOCommandHeaderDCV3 header;
@@ -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()) {
+656 -193
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -113,13 +113,14 @@ const vector<ChoiceSearchCategory> CHOICE_SEARCH_CATEGORIES({
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_NTE:
case Version::GC_EP3:
return (choice_id == 0x0005);
case Version::BB_V4:
+152 -52
View File
@@ -23,7 +23,15 @@ static atomic<uint64_t> next_id(1);
void Client::Config::set_flags_for_version(Version version, int64_t sub_version) {
this->set_flag(Flag::PROXY_CHAT_COMMANDS_ENABLED);
this->set_flag(Flag::PROXY_CHAT_FILTER_ENABLED);
// BB shares some sub_version values with GC Episode 3, so we handle it
// separately first.
if (version == Version::BB_V4) {
this->set_flag(Flag::NO_D6);
this->set_flag(Flag::SAVE_ENABLED);
this->set_flag(Flag::SEND_FUNCTION_CALL_NO_CACHE_PATCH);
return;
}
switch (sub_version) {
case -1: // Initial check (before sub_version recognition)
@@ -40,6 +48,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);
@@ -47,7 +56,7 @@ void Client::Config::set_flags_for_version(Version version, int64_t sub_version)
break;
case Version::GC_NTE:
case Version::GC_V3:
case Version::GC_EP3_TRIAL_EDITION:
case Version::GC_EP3_NTE:
case Version::GC_EP3:
break;
case Version::XB_V3:
@@ -55,11 +64,6 @@ void Client::Config::set_flags_for_version(Version version, int64_t sub_version)
this->set_flag(Flag::NO_D6_AFTER_LOBBY);
this->set_flag(Flag::SEND_FUNCTION_CALL_NO_CACHE_PATCH);
break;
case Version::BB_V4:
this->set_flag(Flag::NO_D6);
this->set_flag(Flag::SAVE_ENABLED);
this->set_flag(Flag::SEND_FUNCTION_CALL_NO_CACHE_PATCH);
break;
default:
throw logic_error("invalid game version");
}
@@ -69,8 +73,6 @@ void Client::Config::set_flags_for_version(Version version, int64_t sub_version)
case 0x21: // DCv1 US
this->set_flag(Flag::NO_D6);
this->set_flag(Flag::NO_SEND_FUNCTION_CALL);
// In the case of DCNTE, the IS_DC_TRIAL_EDITION flag is already set when
// we get here
break;
case 0x23: // DCv1 EU
this->set_flag(Flag::NO_D6);
@@ -87,36 +89,32 @@ void Client::Config::set_flags_for_version(Version version, int64_t sub_version)
this->set_flag(Flag::SEND_FUNCTION_CALL_CHECKSUM_ONLY);
this->set_flag(Flag::SEND_FUNCTION_CALL_NO_CACHE_PATCH);
break;
case 0x30: // GC Ep1&2 GameJam demo, GC Ep1&2 Trial Edition, GC Ep1&2 JP v1.02, at least one version of XB
case 0x31: // GC Ep1&2 US v1.00, GC US v1.01, XB US
case 0x34: // GC Ep1&2 JP v1.03
// In the case of GC Trial Edition, the IS_GC_TRIAL_EDITION flag is
// already set when we get here (because the client has used V2 encryption
// instead of V3)
case 0x30: // GC Ep1&2 GameJam demo, GC Ep1&2 Trial Edition, GC Ep1&2 JP v1.2, at least one version of XB
case 0x31: // GC Ep1&2 US v1.0, GC US v1.1, XB US
break;
case 0x32: // GC Ep1&2 EU 50Hz
case 0x33: // GC Ep1&2 EU 60Hz
case 0x34: // GC Ep1&2 JP v1.3
this->set_flag(Flag::NO_D6_AFTER_LOBBY);
break;
case 0x35: // GC Ep1&2 JP v1.04 (Plus)
case 0x35: // GC Ep1&2 JP v1.4 (Plus)
this->set_flag(Flag::NO_D6_AFTER_LOBBY);
this->set_flag(Flag::ENCRYPTED_SEND_FUNCTION_CALL);
this->set_flag(Flag::SEND_FUNCTION_CALL_NO_CACHE_PATCH);
break;
case 0x36: // GC Ep1&2 US v1.02 (Plus)
case 0x39: // GC Ep1&2 JP v1.05 (Plus)
case 0x36: // GC Ep1&2 US v1.2 (Plus)
case 0x39: // GC Ep1&2 JP v1.5 (Plus)
this->set_flag(Flag::NO_D6_AFTER_LOBBY);
this->set_flag(Flag::NO_SEND_FUNCTION_CALL);
break;
case 0x40: // GC Ep3 JP and Trial Edition
case 0x40: // GC Ep3 JP and Trial Edition (and BB)
this->set_flag(Flag::NO_D6_AFTER_LOBBY);
this->set_flag(Flag::ENCRYPTED_SEND_FUNCTION_CALL);
this->set_flag(Flag::SEND_FUNCTION_CALL_NO_CACHE_PATCH);
// sub_version can't be used to tell JP final and Trial Edition apart; we
// instead look at header.flag in the 61 command and set the
// IS_EP3_TRIAL_EDITION flag there.
// instead look at header.flag in the 61 command and set the version then.
break;
case 0x41: // GC Ep3 US
case 0x41: // GC Ep3 US (and BB)
this->set_flag(Flag::NO_D6_AFTER_LOBBY);
this->set_flag(Flag::USE_OVERFLOW_FOR_SEND_FUNCTION_CALL);
this->set_flag(Flag::SEND_FUNCTION_CALL_NO_CACHE_PATCH);
@@ -131,6 +129,38 @@ void Client::Config::set_flags_for_version(Version version, int64_t sub_version)
}
}
Client::ItemDropNotificationMode Client::Config::get_drop_notification_mode() const {
uint8_t mode_s = (this->check_flag(Flag::ITEM_DROP_NOTIFICATIONS_1) ? 1 : 0) |
(this->check_flag(Flag::ITEM_DROP_NOTIFICATIONS_2) ? 2 : 0);
return static_cast<Client::ItemDropNotificationMode>(mode_s);
}
void Client::Config::set_drop_notification_mode(ItemDropNotificationMode new_mode) {
uint8_t mode_s = static_cast<uint8_t>(new_mode);
if (mode_s & 1) {
this->set_flag(Client::Flag::ITEM_DROP_NOTIFICATIONS_1);
} else {
this->clear_flag(Client::Flag::ITEM_DROP_NOTIFICATIONS_1);
}
if (mode_s & 2) {
this->set_flag(Client::Flag::ITEM_DROP_NOTIFICATIONS_2);
} else {
this->clear_flag(Client::Flag::ITEM_DROP_NOTIFICATIONS_2);
}
}
bool Client::Config::should_update_vs(const Config& other) const {
constexpr uint64_t mask = static_cast<uint64_t>(Flag::CLIENT_SIDE_MASK);
return ((this->enabled_flags ^ other.enabled_flags) & mask) ||
(this->specific_version != other.specific_version) ||
(this->override_random_seed != other.override_random_seed) ||
(this->override_section_id != other.override_section_id) ||
(this->override_lobby_event != other.override_lobby_event) ||
(this->override_lobby_number != other.override_lobby_number) ||
(this->proxy_destination_address != other.proxy_destination_address) ||
(this->proxy_destination_port != other.proxy_destination_port);
}
Client::Client(
shared_ptr<Server> server,
struct bufferevent* bev,
@@ -179,9 +209,12 @@ Client::Client(
external_bank_character_index(-1),
last_play_time_update(0) {
this->config.set_flags_for_version(version, -1);
auto s = server->get_state();
if (is_v1_or_v2(this->version()) ? s->default_rare_notifs_enabled_v1_v2 : s->default_rare_notifs_enabled_v3_v4) {
this->config.set_drop_notification_mode(ItemDropNotificationMode::RARES_ONLY);
}
this->config.specific_version = default_specific_version_for_version(version, -1);
this->last_switch_enabled_command.header.subcommand = 0;
memset(&this->next_connection_addr, 0, sizeof(this->next_connection_addr));
this->reschedule_save_game_data_event();
@@ -190,7 +223,8 @@ Client::Client(
// Don't print data sent to patch clients to the logs. The patch server
// protocol is fully understood and data logs for patch clients are generally
// more annoying than helpful at this point.
if ((this->channel.version == Version::PC_PATCH) || (this->channel.version == Version::BB_PATCH)) {
if ((s->hide_download_commands) &&
((this->channel.version == Version::PC_PATCH) || (this->channel.version == Version::BB_PATCH))) {
this->channel.terminal_recv_color = TerminalFormat::END;
this->channel.terminal_send_color = TerminalFormat::END;
}
@@ -220,9 +254,10 @@ void Client::reschedule_save_game_data_event() {
}
void Client::reschedule_ping_and_timeout_events() {
struct timeval ping_tv = usecs_to_timeval(30000000); // 30 seconds
auto s = this->require_server_state();
struct timeval ping_tv = usecs_to_timeval(s->client_ping_interval_usecs);
event_add(this->send_ping_event.get(), &ping_tv);
struct timeval idle_tv = usecs_to_timeval(60000000); // 1 minute
struct timeval idle_tv = usecs_to_timeval(s->client_idle_timeout_usecs);
event_add(this->idle_timeout_event.get(), &idle_tv);
}
@@ -238,6 +273,24 @@ void Client::set_license(shared_ptr<License> l) {
this->license = l;
}
void Client::convert_license_to_temporary_if_nte() {
// If the session is a prototype version and the license was created and we
// should use a temporary license instead, delete the permanent license and
// replace it with a temporary license.
auto s = this->require_server_state();
if (s->use_temp_licenses_for_prototypes &&
this->config.check_flag(Client::Flag::LICENSE_WAS_CREATED) &&
is_any_nte(this->version())) {
this->log.info("Client is a prototype version and the license was created during this session; converting permanent license to temporary license");
s->license_index->remove(this->license->serial_number);
auto new_l = s->license_index->create_temporary_license();
this->license->delete_file();
*new_l = std::move(*this->license);
this->set_license(new_l);
this->config.clear_flag(Client::Flag::LICENSE_WAS_CREATED);
}
}
shared_ptr<ServerState> Client::require_server_state() const {
auto server = this->server.lock();
if (!server) {
@@ -295,30 +348,52 @@ shared_ptr<const TeamIndex::Team> Client::team() const {
return team;
}
bool Client::can_see_quest(shared_ptr<const Quest> q, uint8_t difficulty) const {
if (this->license && (this->license->flags & License::Flag::DISABLE_QUEST_REQUIREMENTS)) {
bool Client::evaluate_quest_availability_expression(
shared_ptr<const QuestAvailabilityExpression> expr,
uint8_t event,
uint8_t difficulty,
size_t num_players,
bool v1_present) const {
if (this->license && this->license->check_flag(License::Flag::DISABLE_QUEST_REQUIREMENTS)) {
return true;
}
if (!q->available_expression) {
if (!expr) {
return true;
}
string expr = q->available_expression->str();
bool ret = q->available_expression->evaluate(this->character()->quest_flags.data.at(difficulty), this->team());
this->log.info("Evaluating quest availability expression %s => %s", expr.c_str(), ret ? "TRUE" : "FALSE");
auto l = this->lobby.lock();
auto p = this->character();
QuestAvailabilityExpression::Env env = {
.flags = (l && !l->quest_flags_known) ? &l->quest_flag_values->data.at(difficulty) : &p->quest_flags.data.at(difficulty),
.challenge_records = &p->challenge_records,
.team = this->team(),
.num_players = num_players,
.event = event,
.v1_present = v1_present,
};
int64_t ret = expr->evaluate(env);
if (this->log.should_log(LogLevel::INFO)) {
string expr_str = expr->str();
this->log.info("Evaluated quest availability expression %s => %s", expr_str.c_str(), ret ? "TRUE" : "FALSE");
}
return ret;
}
bool Client::can_play_quest(shared_ptr<const Quest> q, uint8_t difficulty) const {
if (this->license && (this->license->flags & License::Flag::DISABLE_QUEST_REQUIREMENTS)) {
bool Client::can_see_quest(shared_ptr<const Quest> q, uint8_t event, uint8_t difficulty, size_t num_players, bool v1_present) const {
return this->evaluate_quest_availability_expression(q->available_expression, event, difficulty, num_players, v1_present);
}
bool Client::can_play_quest(shared_ptr<const Quest> q, uint8_t event, uint8_t difficulty, size_t num_players, bool v1_present) const {
return this->evaluate_quest_availability_expression(q->enabled_expression, event, difficulty, num_players, v1_present);
}
bool Client::can_use_chat_commands() const {
if (!this->license) {
return false;
}
if (this->license->check_flag(License::Flag::ALWAYS_ENABLE_CHAT_COMMANDS)) {
return true;
}
if (!q->enabled_expression) {
return true;
}
string expr = q->enabled_expression->str();
bool ret = q->enabled_expression->evaluate(this->character()->quest_flags.data.at(difficulty), this->team());
this->log.info("Evaluating quest enabled expression %s => %s", expr.c_str(), ret ? "TRUE" : "FALSE");
return ret;
return this->require_server_state()->enable_chat_commands;
}
void Client::dispatch_save_game_data(evutil_socket_t, short, void* ctx) {
@@ -398,7 +473,7 @@ void Client::create_battle_overlay(shared_ptr<const BattleRules> rules, shared_p
stats.reset_to_base(char_class, level_table);
stats.advance_to_level(char_class, target_level, level_table);
stats.unknown_a1 = 40;
stats.esp = 40;
stats.meseta = 300;
}
if (rules->tech_disk_mode == BattleRules::TechDiskMode::LIMIT_LEVEL) {
@@ -444,7 +519,7 @@ void Client::create_challenge_overlay(Version version, size_t template_index, sh
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.esp = 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;
@@ -739,7 +814,7 @@ void Client::load_all_files() {
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->play_time_seconds = 0;
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;
@@ -756,7 +831,7 @@ void Client::load_all_files() {
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;
this->character_data->quest_counters = nsc_data.quest_counters;
if (nsa_data) {
this->character_data->option_flags = nsa_data->option_flags;
this->character_data->symbol_chats = nsa_data->symbol_chats;
@@ -768,11 +843,6 @@ void Client::load_all_files() {
}
}
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) {
@@ -781,6 +851,10 @@ void Client::load_all_files() {
}
if (this->character_data) {
// Clear legacy play_time field
this->character_data->disp.name.clear_after_bytes(0x18);
this->license->auto_reply_message = this->character_data->auto_reply.decode();
this->license->save();
this->last_play_time_update = now();
}
}
@@ -853,8 +927,7 @@ void Client::save_character_file() {
// 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;
this->character_data->play_time_seconds += seconds;
player_data_log.info("Added %" PRIu64 " seconds to play time", seconds);
this->last_play_time_update = t;
}
@@ -977,3 +1050,30 @@ void Client::use_character_bank(int8_t index) {
}
}
}
void Client::print_inventory(FILE* stream) const {
auto s = this->require_server_state();
auto p = this->character();
fprintf(stream, "[PlayerInventory] Meseta: %" PRIu32 "\n", p->disp.stats.meseta.load());
fprintf(stream, "[PlayerInventory] %hhu items\n", p->inventory.num_items);
for (size_t x = 0; x < p->inventory.num_items; x++) {
const auto& item = p->inventory.items[x];
auto hex = item.data.hex();
auto name = s->describe_item(this->version(), item.data, false);
fprintf(stream, "[PlayerInventory] %2zu: [+%08" PRIX32 "] %s (%s)\n", x, item.flags.load(), hex.c_str(), name.c_str());
}
}
void Client::print_bank(FILE* stream) const {
auto s = this->require_server_state();
auto p = this->character();
fprintf(stream, "[PlayerBank] Meseta: %" PRIu32 "\n", p->bank.meseta.load());
fprintf(stream, "[PlayerBank] %" PRIu32 " items\n", p->bank.num_items.load());
for (size_t x = 0; x < p->bank.num_items; x++) {
const auto& item = p->bank.items[x];
const char* present_token = item.present ? "" : " (missing present flag)";
auto hex = item.data.hex();
auto name = s->describe_item(this->version(), item.data, false);
fprintf(stream, "[PlayerBank] %3zu: %s (%s) (x%hu)%s\n", x, hex.c_str(), name.c_str(), item.amount.load(), present_token);
}
}
+89 -46
View File
@@ -30,57 +30,79 @@ public:
enum class Flag : uint64_t {
// clang-format off
// This mask specifies which flags are sent to the client
// TODO: It'd be nice to use a pattern here (e.g. all server-side flags are
// in the high bits) but that would require re-recording or manually
// rewriting all the tests
CLIENT_SIDE_MASK = 0xFF3CFFFF7C0FFFFB,
// Version-related flags
CHECKED_FOR_DC_V1_PROTOTYPE = 0x0000000000000002,
NO_D6_AFTER_LOBBY = 0x0000000000000100,
NO_D6 = 0x0000000000000200,
FORCE_ENGLISH_LANGUAGE_BB = 0x0000000000000400,
CHECKED_FOR_DC_V1_PROTOTYPE = 0x0000000000000002,
LICENSE_WAS_CREATED = 0x0000000000000004, // Server-side only
NO_D6_AFTER_LOBBY = 0x0000000000000100,
NO_D6 = 0x0000000000000200,
FORCE_ENGLISH_LANGUAGE_BB = 0x0000000000000400,
// Flags describing the behavior for send_function_call
NO_SEND_FUNCTION_CALL = 0x0000000000001000,
ENCRYPTED_SEND_FUNCTION_CALL = 0x0000000000002000,
SEND_FUNCTION_CALL_CHECKSUM_ONLY = 0x0000000000004000,
SEND_FUNCTION_CALL_NO_CACHE_PATCH = 0x0000000000008000,
USE_OVERFLOW_FOR_SEND_FUNCTION_CALL = 0x0000000000010000,
NO_SEND_FUNCTION_CALL = 0x0000000000001000,
ENCRYPTED_SEND_FUNCTION_CALL = 0x0000000000002000,
SEND_FUNCTION_CALL_CHECKSUM_ONLY = 0x0000000000004000,
SEND_FUNCTION_CALL_NO_CACHE_PATCH = 0x0000000000008000,
USE_OVERFLOW_FOR_SEND_FUNCTION_CALL = 0x0000000000010000,
// State flags
LOADING = 0x0000000000100000,
LOADING_QUEST = 0x0000000000200000,
LOADING_RUNNING_JOINABLE_QUEST = 0x0000000000400000,
LOADING_TOURNAMENT = 0x0000000000800000,
IN_INFORMATION_MENU = 0x0000000001000000,
AT_WELCOME_MESSAGE = 0x0000000002000000,
SAVE_ENABLED = 0x0000000004000000,
HAS_EP3_CARD_DEFS = 0x0000000008000000,
HAS_EP3_MEDIA_UPDATES = 0x0000000010000000,
USE_OVERRIDE_RANDOM_SEED = 0x0000000020000000,
HAS_GUILD_CARD_NUMBER = 0x0000000040000000,
AT_BANK_COUNTER = 0x0000000080000000,
LOADING = 0x0000000000100000, // Server-side only
LOADING_QUEST = 0x0000000000200000, // Server-side only
LOADING_RUNNING_JOINABLE_QUEST = 0x0000000000400000, // Server-side only
LOADING_TOURNAMENT = 0x0000000000800000, // Server-side only
IN_INFORMATION_MENU = 0x0000000001000000, // Server-side only
AT_WELCOME_MESSAGE = 0x0000000002000000, // Server-side only
SAVE_ENABLED = 0x0000000004000000,
HAS_EP3_CARD_DEFS = 0x0000000008000000,
HAS_EP3_MEDIA_UPDATES = 0x0000000010000000,
USE_OVERRIDE_RANDOM_SEED = 0x0000000020000000,
HAS_GUILD_CARD_NUMBER = 0x0000000040000000,
AT_BANK_COUNTER = 0x0000000080000000, // Server-side only
SHOULD_SEND_ARTIFICIAL_ITEM_STATE = 0x0001000000000000, // Server-side only
SHOULD_SEND_ARTIFICIAL_ENEMY_AND_SET_STATE = 0x0040000000000000, // Server-side only
SHOULD_SEND_ARTIFICIAL_OBJECT_STATE = 0x0080000000000000, // Server-side only
SHOULD_SEND_ARTIFICIAL_FLAG_STATE = 0x0002000000000000, // Server-side only
SHOULD_SEND_ENABLE_SAVE = 0x0004000000000000,
SWITCH_ASSIST_ENABLED = 0x0000000100000000,
// Cheat mode flags
SWITCH_ASSIST_ENABLED = 0x0000000100000000,
INFINITE_HP_ENABLED = 0x0000000200000000,
INFINITE_TP_ENABLED = 0x0000000400000000,
DEBUG_ENABLED = 0x0000000800000000,
// Cheat mode and option flags
INFINITE_HP_ENABLED = 0x0000000200000000,
INFINITE_TP_ENABLED = 0x0000000400000000,
DEBUG_ENABLED = 0x0000000800000000,
ITEM_DROP_NOTIFICATIONS_1 = 0x0010000000000000,
ITEM_DROP_NOTIFICATIONS_2 = 0x0020000000000000,
// Proxy option flags
PROXY_SAVE_FILES = 0x0000001000000000,
PROXY_CHAT_COMMANDS_ENABLED = 0x0000002000000000,
PROXY_CHAT_FILTER_ENABLED = 0x0000004000000000,
PROXY_PLAYER_NOTIFICATIONS_ENABLED = 0x0000008000000000,
PROXY_SUPPRESS_CLIENT_PINGS = 0x0000010000000000,
PROXY_SUPPRESS_REMOTE_LOGIN = 0x0000020000000000,
PROXY_ZERO_REMOTE_GUILD_CARD = 0x0000040000000000,
PROXY_EP3_INFINITE_MESETA_ENABLED = 0x0000080000000000,
PROXY_EP3_INFINITE_TIME_ENABLED = 0x0000100000000000,
PROXY_RED_NAME_ENABLED = 0x0000200000000000,
PROXY_BLANK_NAME_ENABLED = 0x0000400000000000,
PROXY_BLOCK_FUNCTION_CALLS = 0x0000800000000000,
PROXY_SAVE_FILES = 0x0000001000000000,
PROXY_CHAT_COMMANDS_ENABLED = 0x0000002000000000,
PROXY_PLAYER_NOTIFICATIONS_ENABLED = 0x0000008000000000,
PROXY_SUPPRESS_CLIENT_PINGS = 0x0000010000000000,
PROXY_SUPPRESS_REMOTE_LOGIN = 0x0000020000000000,
PROXY_ZERO_REMOTE_GUILD_CARD = 0x0000040000000000,
PROXY_EP3_INFINITE_MESETA_ENABLED = 0x0000080000000000,
PROXY_EP3_INFINITE_TIME_ENABLED = 0x0000100000000000,
PROXY_RED_NAME_ENABLED = 0x0000200000000000,
PROXY_BLANK_NAME_ENABLED = 0x0000400000000000,
PROXY_BLOCK_FUNCTION_CALLS = 0x0000800000000000,
PROXY_EP3_UNMASK_WHISPERS = 0x0008000000000000,
// clang-format on
};
enum class ItemDropNotificationMode {
NOTHING = 0,
RARES_ONLY = 1,
ALL_ITEMS = 2,
ALL_ITEMS_INCLUDING_MESETA = 3,
};
static constexpr uint64_t DEFAULT_FLAGS = static_cast<uint64_t>(Flag::PROXY_CHAT_COMMANDS_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
@@ -91,6 +113,11 @@ public:
Config() = default;
bool operator==(const Config& other) const = default;
bool operator!=(const Config& other) const = default;
bool should_update_vs(const Config& other) const;
[[nodiscard]] static inline bool check_flag(uint64_t enabled_flags, Flag flag) {
return !!(enabled_flags & static_cast<uint64_t>(flag));
}
@@ -110,6 +137,9 @@ public:
void set_flags_for_version(Version version, int64_t sub_version);
ItemDropNotificationMode get_drop_notification_mode() const;
void set_drop_notification_mode(ItemDropNotificationMode new_mode);
template <size_t Bytes>
void parse_from(const parray<uint8_t, Bytes>& data) {
StringReader r(data.data(), data.size());
@@ -131,7 +161,7 @@ public:
StringWriter w;
w.put_u32l(CLIENT_CONFIG_MAGIC);
w.put_u32l(this->specific_version);
w.put_u64l(this->enabled_flags);
w.put_u64l(this->enabled_flags & static_cast<uint64_t>(Flag::CLIENT_SIDE_MASK));
w.put_u32l(this->override_random_seed);
w.put_u32b(this->proxy_destination_address);
w.put_u16l(this->proxy_destination_port);
@@ -167,11 +197,10 @@ public:
uint8_t bb_connection_phase;
uint64_t ping_start_time;
// Patch server
std::vector<PatchFileChecksumRequest> patch_file_checksum_requests;
// Lobby/positioning
Config config;
Config synced_config;
std::unique_ptr<parray<le_uint32_t, 0x20>> override_variations;
int32_t sub_version;
float x;
float z;
@@ -221,7 +250,7 @@ public:
// Miscellaneous (used by chat commands)
uint32_t next_exp_value; // next EXP value to give
G_SwitchStateChanged_6x05 last_switch_enabled_command;
RecentSwitchFlags recent_switch_flags; // used for switch assist
bool can_chat;
struct PendingCharacterExport {
std::shared_ptr<const License> license;
@@ -254,14 +283,25 @@ public:
}
void set_license(std::shared_ptr<License> l);
void convert_license_to_temporary_if_nte();
void sync_config();
std::shared_ptr<ServerState> require_server_state() const;
std::shared_ptr<Lobby> require_lobby() const;
std::shared_ptr<const TeamIndex::Team> team() const;
bool can_see_quest(std::shared_ptr<const Quest> q, uint8_t difficulty) const;
bool can_play_quest(std::shared_ptr<const Quest> q, uint8_t difficulty) const;
bool evaluate_quest_availability_expression(
std::shared_ptr<const QuestAvailabilityExpression> expr,
uint8_t event,
uint8_t difficulty,
size_t num_players,
bool v1_present) const;
bool can_see_quest(std::shared_ptr<const Quest> q, uint8_t event, uint8_t difficulty, size_t num_players, bool v1_present) const;
bool can_play_quest(std::shared_ptr<const Quest> q, uint8_t event, uint8_t difficulty, size_t num_players, bool v1_present) const;
bool can_use_chat_commands() const;
static void dispatch_save_game_data(evutil_socket_t, short, void* ctx);
void save_game_data();
@@ -328,6 +368,9 @@ public:
void use_character_bank(int8_t bb_character_index);
void use_default_bank();
void print_inventory(FILE* stream) const;
void print_bank(FILE* stream) 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
+980 -641
View File
File diff suppressed because it is too large Load Diff
+112
View File
@@ -1,11 +1,123 @@
#include "CommonItemSet.hh"
#include "AFSArchive.hh"
#include "EnemyType.hh"
#include "GSLArchive.hh"
#include "StaticGameData.hh"
using namespace std;
template <typename IntT, size_t Count>
JSON to_json(const parray<IntT, Count>& v) {
auto ret = JSON::list();
for (size_t z = 0; z < Count; z++) {
ret.emplace_back(v[z]);
}
return ret;
}
template <typename IntT, size_t Count>
JSON to_json(const parray<CommonItemSet::Table::Range<IntT>, Count>& v) {
auto ret = JSON::list();
for (size_t z = 0; z < Count; z++) {
ret.emplace_back(to_json(v[z]));
}
return ret;
}
template <typename IntT>
JSON to_json(const CommonItemSet::Table::Range<IntT>& v) {
if (v.min == v.max) {
return JSON(v.min);
} else {
return JSON::list({v.min, v.max});
}
}
template <typename IntT, size_t Count1, size_t Count2>
JSON to_json(const parray<parray<IntT, Count2>, Count1>& v) {
auto ret = JSON::list();
for (size_t z = 0; z < Count1; z++) {
ret.emplace_back(to_json(v[z]));
}
return ret;
}
JSON CommonItemSet::Table::json() const {
JSON enemy_meseta_ranges_json = JSON::dict();
JSON enemy_type_drop_probs_json = JSON::dict();
JSON enemy_item_classes_json = JSON::dict();
for (size_t z = 0; z < 0x64; z++) {
static const array<Episode, 3> episodes = {Episode::EP1, Episode::EP2, Episode::EP4};
for (Episode episode : episodes) {
JSON enemy_meseta_ranges_episode_json = JSON::dict();
JSON enemy_type_drop_probs_episode_json = JSON::dict();
JSON enemy_item_classes_episode_json = JSON::dict();
for (auto type : enemy_types_for_rare_table_index(episode, z)) {
string type_str = name_for_enum(type);
enemy_meseta_ranges_episode_json.emplace(type_str, to_json(this->enemy_meseta_ranges[z]));
enemy_type_drop_probs_episode_json.emplace(type_str, this->enemy_type_drop_probs[z]);
enemy_item_classes_episode_json.emplace(type_str, this->enemy_item_classes[z]);
}
string name = name_for_episode(episode);
enemy_meseta_ranges_json.emplace(name, std::move(enemy_meseta_ranges_episode_json));
enemy_type_drop_probs_json.emplace(name, std::move(enemy_type_drop_probs_episode_json));
enemy_item_classes_json.emplace(name, std::move(enemy_item_classes_episode_json));
}
}
return JSON::dict({
{"BaseWeaponTypeProbTable", to_json(this->base_weapon_type_prob_table)},
{"SubtypeBaseTable", to_json(this->subtype_base_table)},
{"SubtypeAreaLengthTable", to_json(this->subtype_area_length_table)},
{"GrindProbTable", to_json(this->grind_prob_table)},
{"ArmorShieldTypeIndexProbTable", to_json(this->armor_shield_type_index_prob_table)},
{"ArmorSlotCountProbTable", to_json(this->armor_slot_count_prob_table)},
{"EnemyMesetaRanges", std::move(enemy_meseta_ranges_json)},
{"EnemyTypeDropProbs", std::move(enemy_type_drop_probs_json)},
{"EnemyItemClasses", std::move(enemy_item_classes_json)},
{"BoxMesetaRanges", to_json(this->box_meseta_ranges)},
{"HasRareBonusValueProbTable", this->has_rare_bonus_value_prob_table},
{"BonusValueProbTable", to_json(this->bonus_value_prob_table)},
{"NonRareBonusProbSpec", to_json(this->nonrare_bonus_prob_spec)},
{"BonusTypeProbTable", to_json(this->bonus_type_prob_table)},
{"SpecialMult", to_json(this->special_mult)},
{"SpecialPercent", to_json(this->special_percent)},
{"ToolClassProbTable", to_json(this->tool_class_prob_table)},
{"TechniqueIndexProbTable", to_json(this->technique_index_prob_table)},
{"TechniqueLevelRanges", to_json(this->technique_level_ranges)},
{"ArmorOrShieldTypeBias", this->armor_or_shield_type_bias},
{"UnitMaxStarsTable", to_json(this->unit_max_stars_table)},
{"BoxItemClassProbTable", to_json(this->box_item_class_prob_table)},
});
}
JSON CommonItemSet::json() const {
auto modes_dict = JSON::dict();
static const array<GameMode, 4> modes = {GameMode::NORMAL, GameMode::BATTLE, GameMode::CHALLENGE, GameMode::SOLO};
for (const auto& mode : modes) {
auto episodes_dict = JSON::dict();
static const array<Episode, 3> episodes = {Episode::EP1, Episode::EP2, Episode::EP4};
for (const auto& episode : episodes) {
auto difficulty_dict = JSON::dict();
for (uint8_t difficulty = 0; difficulty < 4; difficulty++) {
auto section_id_dict = JSON::dict();
for (uint8_t section_id = 0; section_id < 10; section_id++) {
try {
auto table = this->get_table(episode, mode, difficulty, section_id);
section_id_dict.emplace(name_for_section_id(section_id), table->json());
} catch (const runtime_error&) {
}
}
difficulty_dict.emplace(token_name_for_difficulty(difficulty), std::move(section_id_dict));
}
episodes_dict.emplace(token_name_for_episode(episode), std::move(difficulty_dict));
}
modes_dict.emplace(name_for_mode(mode), std::move(episodes_dict));
}
return modes_dict;
}
CommonItemSet::Table::Table(const StringReader& r, bool is_big_endian, bool is_v3) {
if (is_big_endian) {
this->parse_itempt_t<true>(r, is_v3);
+7 -4
View File
@@ -2,6 +2,7 @@
#include <array>
#include <phosg/Encoding.hh>
#include <phosg/JSON.hh>
#include "GSLArchive.hh"
#include "PSOEncryption.hh"
@@ -45,6 +46,7 @@ public:
parray<parray<uint8_t, 10>, 7> box_item_class_prob_table;
void print_enemy_table(FILE* stream) const;
JSON json() const;
private:
template <bool IsBigEndian>
@@ -256,6 +258,7 @@ public:
};
std::shared_ptr<const Table> get_table(Episode episode, GameMode mode, uint8_t difficulty, uint8_t secid) const;
JSON json() const;
protected:
CommonItemSet() = default;
@@ -298,22 +301,22 @@ struct ProbabilityTable {
return this->items[--this->count];
}
void shuffle(PSOLFGEncryption& random_crypt) {
void shuffle(std::shared_ptr<PSOLFGEncryption> opt_rand_crypt) {
for (size_t z = 1; z < this->count; z++) {
size_t other_z = random_crypt.next() % (z + 1);
size_t other_z = random_from_optional_crypt(opt_rand_crypt) % (z + 1);
ItemT t = this->items[z];
this->items[z] = this->items[other_z];
this->items[other_z] = t;
}
}
ItemT sample(PSOLFGEncryption& random_crypt) const {
ItemT sample(std::shared_ptr<PSOLFGEncryption> opt_rand_crypt) const {
if (this->count == 0) {
throw std::runtime_error("sample from empty probability table");
} else if (this->count == 1) {
return this->items[0];
} else {
return this->items[random_crypt.next() % this->count];
return this->items[random_from_optional_crypt(opt_rand_crypt) % this->count];
}
}
};
+134 -110
View File
@@ -38,6 +38,8 @@ const char* name_for_enum<EnemyType>(EnemyType type) {
return "BOOTA";
case EnemyType::BULCLAW:
return "BULCLAW";
case EnemyType::BULK:
return "BULK";
case EnemyType::CANADINE:
return "CANADINE";
case EnemyType::CANADINE_GROUP:
@@ -287,6 +289,7 @@ EnemyType enum_for_name<EnemyType>(const char* name) {
{"BOOMA", EnemyType::BOOMA},
{"BOOTA", EnemyType::BOOTA},
{"BULCLAW", EnemyType::BULCLAW},
{"BULK", EnemyType::BULK},
{"CANADINE", EnemyType::CANADINE},
{"CANADINE_GROUP", EnemyType::CANADINE_GROUP},
{"CANANE", EnemyType::CANANE},
@@ -409,150 +412,152 @@ bool enemy_type_valid_for_episode(Episode episode, EnemyType enemy_type) {
switch (episode) {
case Episode::EP1:
switch (enemy_type) {
case EnemyType::MOTHMANT:
case EnemyType::MONEST:
case EnemyType::SAVAGE_WOLF:
case EnemyType::BARBAROUS_WOLF:
case EnemyType::POISON_LILY:
case EnemyType::NAR_LILY:
case EnemyType::SINOW_BEAT:
case EnemyType::CANADINE:
case EnemyType::CANADINE_GROUP:
case EnemyType::CANANE:
case EnemyType::CHAOS_SORCERER:
case EnemyType::CHAOS_BRINGER:
case EnemyType::DARK_BELRA:
case EnemyType::DE_ROL_LE:
case EnemyType::DRAGON:
case EnemyType::SINOW_GOLD:
case EnemyType::RAG_RAPPY:
case EnemyType::AL_RAPPY:
case EnemyType::NANO_DRAGON:
case EnemyType::DUBCHIC:
case EnemyType::GILLCHIC:
case EnemyType::GARANZ:
case EnemyType::DARK_GUNNER:
case EnemyType::BARBAROUS_WOLF:
case EnemyType::BOOMA:
case EnemyType::BULCLAW:
case EnemyType::BULK:
case EnemyType::CANADINE_GROUP:
case EnemyType::CANADINE:
case EnemyType::CANANE:
case EnemyType::CHAOS_BRINGER:
case EnemyType::CHAOS_SORCERER:
case EnemyType::CLAW:
case EnemyType::VOL_OPT_2:
case EnemyType::POUILLY_SLIME:
case EnemyType::POFUILLY_SLIME:
case EnemyType::PAN_ARMS:
case EnemyType::HIDOOM:
case EnemyType::MIGIUM:
case EnemyType::DARVANT:
case EnemyType::DARVANT_ULTIMATE:
case EnemyType::DARK_BELRA:
case EnemyType::DARK_FALZ_1:
case EnemyType::DARK_FALZ_2:
case EnemyType::DARK_FALZ_3:
case EnemyType::HILDEBEAR:
case EnemyType::HILDEBLUE:
case EnemyType::BOOMA:
case EnemyType::GOBOOMA:
case EnemyType::GIGOBOOMA:
case EnemyType::GRASS_ASSASSIN:
case EnemyType::EVIL_SHARK:
case EnemyType::PAL_SHARK:
case EnemyType::GUIL_SHARK:
case EnemyType::DARK_GUNNER:
case EnemyType::DARVANT_ULTIMATE:
case EnemyType::DARVANT:
case EnemyType::DE_ROL_LE:
case EnemyType::DEATH_GUNNER:
case EnemyType::DELSABER:
case EnemyType::DIMENIAN:
case EnemyType::DRAGON:
case EnemyType::DUBCHIC:
case EnemyType::EVIL_SHARK:
case EnemyType::GARANZ:
case EnemyType::GIGOBOOMA:
case EnemyType::GILLCHIC:
case EnemyType::GOBOOMA:
case EnemyType::GRASS_ASSASSIN:
case EnemyType::GUIL_SHARK:
case EnemyType::HIDOOM:
case EnemyType::HILDEBEAR:
case EnemyType::HILDEBLUE:
case EnemyType::LA_DIMENIAN:
case EnemyType::MIGIUM:
case EnemyType::MONEST:
case EnemyType::MOTHMANT:
case EnemyType::NANO_DRAGON:
case EnemyType::NAR_LILY:
case EnemyType::PAL_SHARK:
case EnemyType::PAN_ARMS:
case EnemyType::POFUILLY_SLIME:
case EnemyType::POISON_LILY:
case EnemyType::POUILLY_SLIME:
case EnemyType::RAG_RAPPY:
case EnemyType::SAVAGE_WOLF:
case EnemyType::SINOW_BEAT:
case EnemyType::SINOW_GOLD:
case EnemyType::SO_DIMENIAN:
case EnemyType::VOL_OPT_2:
return true;
default:
return false;
}
case Episode::EP2:
switch (enemy_type) {
case EnemyType::MOTHMANT:
case EnemyType::MONEST:
case EnemyType::SAVAGE_WOLF:
case EnemyType::BARBAROUS_WOLF:
case EnemyType::POISON_LILY:
case EnemyType::NAR_LILY:
case EnemyType::SINOW_BERILL:
case EnemyType::GEE:
case EnemyType::CHAOS_SORCERER:
case EnemyType::DELBITER:
case EnemyType::DARK_BELRA:
case EnemyType::BARBA_RAY:
case EnemyType::GOL_DRAGON:
case EnemyType::SINOW_SPIGELL:
case EnemyType::RAG_RAPPY:
case EnemyType::LOVE_RAPPY:
case EnemyType::SAINT_RAPPY:
case EnemyType::EGG_RAPPY:
case EnemyType::HALLO_RAPPY:
case EnemyType::GI_GUE:
case EnemyType::DUBCHIC:
case EnemyType::GILLCHIC:
case EnemyType::GARANZ:
case EnemyType::GAL_GRYPHON:
case EnemyType::EPSILON:
case EnemyType::BARBAROUS_WOLF:
case EnemyType::CHAOS_SORCERER:
case EnemyType::DARK_BELRA:
case EnemyType::DEL_LILY:
case EnemyType::ILL_GILL:
case EnemyType::OLGA_FLOW_1:
case EnemyType::OLGA_FLOW_2:
case EnemyType::GAEL:
case EnemyType::DELBITER:
case EnemyType::DELDEPTH:
case EnemyType::PAN_ARMS:
case EnemyType::HIDOOM:
case EnemyType::MIGIUM:
case EnemyType::MERICAROL:
case EnemyType::UL_GIBBON:
case EnemyType::ZOL_GIBBON:
case EnemyType::GIBBLES:
case EnemyType::MORFOS:
case EnemyType::RECOBOX:
case EnemyType::RECON:
case EnemyType::SINOW_ZOA:
case EnemyType::SINOW_ZELE:
case EnemyType::MERIKLE:
case EnemyType::MERICUS:
case EnemyType::HILDEBEAR:
case EnemyType::HILDEBLUE:
case EnemyType::MERILLIA:
case EnemyType::MERILTAS:
case EnemyType::GRASS_ASSASSIN:
case EnemyType::DOLMOLM:
case EnemyType::DOLMDARL:
case EnemyType::DELSABER:
case EnemyType::DIMENIAN:
case EnemyType::DOLMDARL:
case EnemyType::DOLMOLM:
case EnemyType::DUBCHIC:
case EnemyType::EGG_RAPPY:
case EnemyType::EPSILON:
case EnemyType::GAEL:
case EnemyType::GAL_GRYPHON:
case EnemyType::GARANZ:
case EnemyType::GEE:
case EnemyType::GI_GUE:
case EnemyType::GIBBLES:
case EnemyType::GILLCHIC:
case EnemyType::GOL_DRAGON:
case EnemyType::GRASS_ASSASSIN:
case EnemyType::HALLO_RAPPY:
case EnemyType::HIDOOM:
case EnemyType::HILDEBEAR:
case EnemyType::HILDEBLUE:
case EnemyType::ILL_GILL:
case EnemyType::LA_DIMENIAN:
case EnemyType::LOVE_RAPPY:
case EnemyType::MERICAROL:
case EnemyType::MERICUS:
case EnemyType::MERIKLE:
case EnemyType::MERILLIA:
case EnemyType::MERILTAS:
case EnemyType::MIGIUM:
case EnemyType::MONEST:
case EnemyType::MORFOS:
case EnemyType::MOTHMANT:
case EnemyType::NAR_LILY:
case EnemyType::OLGA_FLOW_1:
case EnemyType::OLGA_FLOW_2:
case EnemyType::PAN_ARMS:
case EnemyType::POISON_LILY:
case EnemyType::RAG_RAPPY:
case EnemyType::RECOBOX:
case EnemyType::RECON:
case EnemyType::SAINT_RAPPY:
case EnemyType::SAVAGE_WOLF:
case EnemyType::SINOW_BERILL:
case EnemyType::SINOW_SPIGELL:
case EnemyType::SINOW_ZELE:
case EnemyType::SINOW_ZOA:
case EnemyType::SO_DIMENIAN:
case EnemyType::UL_GIBBON:
case EnemyType::ZOL_GIBBON:
return true;
default:
return false;
}
case Episode::EP4:
switch (enemy_type) {
case EnemyType::BOOTA:
case EnemyType::ZE_BOOTA:
case EnemyType::BA_BOOTA:
case EnemyType::SAND_RAPPY:
case EnemyType::DEL_RAPPY:
case EnemyType::ZU:
case EnemyType::PAZUZU:
case EnemyType::ASTARK:
case EnemyType::SATELLITE_LIZARD:
case EnemyType::YOWIE:
case EnemyType::DORPHON:
case EnemyType::DORPHON_ECLAIR:
case EnemyType::GORAN:
case EnemyType::PYRO_GORAN:
case EnemyType::GORAN_DETONATOR:
case EnemyType::SAND_RAPPY_ALT:
case EnemyType::BA_BOOTA:
case EnemyType::BOOTA:
case EnemyType::DEL_RAPPY_ALT:
case EnemyType::DEL_RAPPY:
case EnemyType::DORPHON_ECLAIR:
case EnemyType::DORPHON:
case EnemyType::GIRTABLULU:
case EnemyType::GORAN_DETONATOR:
case EnemyType::GORAN:
case EnemyType::KONDRIEU:
case EnemyType::MERISSA_A:
case EnemyType::MERISSA_AA:
case EnemyType::ZU_ALT:
case EnemyType::PAZUZU_ALT:
case EnemyType::SATELLITE_LIZARD_ALT:
case EnemyType::YOWIE_ALT:
case EnemyType::GIRTABLULU:
case EnemyType::PAZUZU:
case EnemyType::PYRO_GORAN:
case EnemyType::SAINT_MILLION:
case EnemyType::SAND_RAPPY_ALT:
case EnemyType::SAND_RAPPY:
case EnemyType::SATELLITE_LIZARD_ALT:
case EnemyType::SATELLITE_LIZARD:
case EnemyType::SHAMBERTIN:
case EnemyType::KONDRIEU:
case EnemyType::YOWIE_ALT:
case EnemyType::YOWIE:
case EnemyType::ZE_BOOTA:
case EnemyType::ZU_ALT:
case EnemyType::ZU:
return true;
default:
return false;
@@ -611,8 +616,10 @@ uint8_t battle_param_index_for_enemy_type(Episode episode, EnemyType enemy_type)
case EnemyType::GARANZ:
return 0x1D;
case EnemyType::DARK_GUNNER:
case EnemyType::DEATH_GUNNER:
return 0x1E;
case EnemyType::BULCLAW:
case EnemyType::BULK:
return 0x1F;
case EnemyType::CLAW:
return 0x20;
@@ -834,9 +841,11 @@ uint8_t battle_param_index_for_enemy_type(Episode episode, EnemyType enemy_type)
case EnemyType::GIRTABLULU:
return 0x1F;
case EnemyType::SAINT_MILLION:
case EnemyType::SHAMBERTIN:
case EnemyType::KONDRIEU:
return 0x22;
case EnemyType::SHAMBERTIN:
return 0x26;
case EnemyType::KONDRIEU:
return 0x2A;
default:
throw runtime_error(string_printf("%s does not have battle parameters in Episode 4", name_for_enum(enemy_type)));
}
@@ -863,6 +872,8 @@ uint8_t rare_table_index_for_enemy_type(EnemyType enemy_type) {
return 0x09;
case EnemyType::BOOTA:
return 0x4D;
case EnemyType::BULK:
return 0x27;
case EnemyType::BULCLAW:
return 0x28;
case EnemyType::CANADINE:
@@ -884,6 +895,8 @@ uint8_t rare_table_index_for_enemy_type(EnemyType enemy_type) {
return 0x2F;
case EnemyType::DARK_GUNNER:
return 0x22;
case EnemyType::DEATH_GUNNER:
return 0x23;
case EnemyType::DE_ROL_LE:
return 0x2D;
case EnemyType::DEL_LILY:
@@ -1094,3 +1107,14 @@ const vector<EnemyType>& enemy_types_for_rare_table_index(Episode episode, uint8
return empty_vec;
}
}
bool enemy_type_is_rare(EnemyType type) {
return ((type == EnemyType::HILDEBLUE) ||
(type == EnemyType::AL_RAPPY) ||
(type == EnemyType::NAR_LILY) ||
(type == EnemyType::POUILLY_SLIME) ||
(type == EnemyType::MERISSA_AA) ||
(type == EnemyType::PAZUZU_ALT) ||
(type == EnemyType::DORPHON_ECLAIR) ||
(type == EnemyType::KONDRIEU));
}
+2
View File
@@ -20,6 +20,7 @@ enum class EnemyType {
BOOMA,
BOOTA,
BULCLAW,
BULK,
CANADINE,
CANADINE_GROUP,
CANANE,
@@ -145,3 +146,4 @@ bool enemy_type_valid_for_episode(Episode episode, EnemyType enemy_type);
uint8_t battle_param_index_for_enemy_type(Episode episode, EnemyType enemy_type);
uint8_t rare_table_index_for_enemy_type(EnemyType enemy_type);
const std::vector<EnemyType>& enemy_types_for_rare_table_index(Episode episode, uint8_t rt_index);
bool enemy_type_is_rare(EnemyType type);
+40 -19
View File
@@ -6,21 +6,38 @@ using namespace std;
namespace Episode3 {
// Note: This order matches the order that the cards are defined in the original
// code. This is relevant for consistency of results when choosing a random card
// (for God Whim).
const vector<uint16_t> ALL_ASSIST_CARD_IDS = {
0x0018, 0x0019, 0x001A, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA,
0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, 0x0100, 0x0101, 0x0102, 0x0103,
0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x010A, 0x010B, 0x010C,
0x010D, 0x010E, 0x010F, 0x0121, 0x0125, 0x0126, 0x0127, 0x0128, 0x0129,
0x012A, 0x012B, 0x012C, 0x012D, 0x012E, 0x012F, 0x0130, 0x0131, 0x0132,
0x0133, 0x0134, 0x0135, 0x0136, 0x0137, 0x0138, 0x0139, 0x013A, 0x013B,
0x013C, 0x013D, 0x013E, 0x013F, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144,
0x0145, 0x0146, 0x0148, 0x014A, 0x014B, 0x014C, 0x014D, 0x014E, 0x023F,
0x0240, 0x0241, 0x0242};
const vector<uint16_t>& all_assist_card_ids(bool is_nte) {
// Note: This order matches the order that the cards are defined in the original
// code. This is relevant for consistency of results when choosing a random card
// (for God Whim).
static const vector<uint16_t> ALL_ASSIST_CARD_IDS_TRIAL = {
0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD,
0x00FE, 0x00FF, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106,
0x0107, 0x0108, 0x0109, 0x010A, 0x010B, 0x010C, 0x010D, 0x010E, 0x010F,
0x0121, 0x0125, 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x012B, 0x012C,
0x012D, 0x012E, 0x012F, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, 0x0135,
0x0136, 0x0137, 0x0138, 0x0139, 0x013A, 0x013B, 0x013C, 0x013D, 0x013E,
0x013F, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x0145, 0x0146, 0x0148,
0x014A, 0x014B, 0x014C, 0x014D, 0x014E, 0x023F, 0x0240, 0x0241, 0x0242};
static const vector<uint16_t> ALL_ASSIST_CARD_IDS_FINAL = {
0x0018, 0x0019, 0x001A, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA,
0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, 0x0100, 0x0101, 0x0102, 0x0103,
0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x010A, 0x010B, 0x010C,
0x010D, 0x010E, 0x010F, 0x0121, 0x0125, 0x0126, 0x0127, 0x0128, 0x0129,
0x012A, 0x012B, 0x012C, 0x012D, 0x012E, 0x012F, 0x0130, 0x0131, 0x0132,
0x0133, 0x0134, 0x0135, 0x0136, 0x0137, 0x0138, 0x0139, 0x013A, 0x013B,
0x013C, 0x013D, 0x013E, 0x013F, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144,
0x0145, 0x0146, 0x0148, 0x014A, 0x014B, 0x014C, 0x014D, 0x014E, 0x023F,
0x0240, 0x0241, 0x0242};
return is_nte ? ALL_ASSIST_CARD_IDS_TRIAL : ALL_ASSIST_CARD_IDS_FINAL;
}
AssistEffect assist_effect_number_for_card_id(uint16_t card_id) {
AssistEffect assist_effect_number_for_card_id(uint16_t card_id, bool is_nte) {
static const unordered_map<uint16_t, AssistEffect> card_id_to_effect_final_only({
{0x0018, /* 0x0049 */ AssistEffect::DICE_FEVER_PLUS},
{0x0019, /* 0x004A */ AssistEffect::RICH_PLUS},
{0x001A, /* 0x004B */ AssistEffect::CHARITY_PLUS},
});
static const unordered_map<uint16_t, AssistEffect> card_id_to_effect({
{0x00F5, /* 0x0001 */ AssistEffect::DICE_HALF},
{0x00F6, /* 0x0002 */ AssistEffect::DICE_PLUS_1},
@@ -94,15 +111,18 @@ AssistEffect assist_effect_number_for_card_id(uint16_t card_id) {
{0x0240, /* 0x0046 */ AssistEffect::BOMB},
{0x0241, /* 0x0047 */ AssistEffect::SKIP_TURN},
{0x0242, /* 0x0048 */ AssistEffect::BATTLE_ROYALE},
{0x0018, /* 0x0049 */ AssistEffect::DICE_FEVER_PLUS},
{0x0019, /* 0x004A */ AssistEffect::RICH_PLUS},
{0x001A, /* 0x004B */ AssistEffect::CHARITY_PLUS},
});
try {
return card_id_to_effect.at(card_id);
} catch (const out_of_range&) {
return AssistEffect::NONE;
}
if (!is_nte) {
try {
return card_id_to_effect_final_only.at(card_id);
} catch (const out_of_range&) {
}
}
return AssistEffect::NONE;
}
AssistServer::AssistServer(shared_ptr<Server> server)
@@ -224,6 +244,7 @@ AssistEffect AssistServer::get_active_assist_by_index(size_t index) const {
}
void AssistServer::populate_effects() {
bool is_nte = this->server()->options.is_nte();
for (size_t z = 0; z < 4; z++) {
this->assist_card_defs[z] = nullptr;
this->assist_effects[z] = AssistEffect::NONE;
@@ -232,7 +253,7 @@ void AssistServer::populate_effects() {
uint16_t card_id = hes->assist_card_id == 0xFFFF
? this->card_id_for_card_ref(hes->assist_card_ref)
: hes->assist_card_id.load();
this->assist_effects[z] = assist_effect_number_for_card_id(card_id);
this->assist_effects[z] = assist_effect_number_for_card_id(card_id, is_nte);
if (this->assist_effects[z] != AssistEffect::NONE) {
this->assist_card_defs[z] = this->definition_for_card_id(card_id);
}
+9 -10
View File
@@ -13,9 +13,8 @@ namespace Episode3 {
class Server;
extern const std::vector<uint16_t> ALL_ASSIST_CARD_IDS;
AssistEffect assist_effect_number_for_card_id(uint16_t card_id);
const std::vector<uint16_t>& all_assist_card_ids(bool is_nte);
AssistEffect assist_effect_number_for_card_id(uint16_t card_id, bool is_nte);
class AssistServer {
public:
@@ -40,17 +39,17 @@ private:
public:
parray<AssistEffect, 4> assist_effects;
std::shared_ptr<const CardIndex::CardEntry> assist_card_defs[4];
bcarray<std::shared_ptr<const CardIndex::CardEntry>, 4> assist_card_defs;
uint32_t num_assist_cards_set;
parray<uint8_t, 4> client_ids_with_assists;
parray<AssistEffect, 4> active_assist_effects;
std::shared_ptr<const CardIndex::CardEntry> active_assist_card_defs[4];
bcarray<std::shared_ptr<const CardIndex::CardEntry>, 4> active_assist_card_defs;
uint32_t num_active_assists;
std::shared_ptr<HandAndEquipState> hand_and_equip_states[4];
std::shared_ptr<parray<CardShortStatus, 0x10>> card_short_statuses[4];
std::shared_ptr<DeckEntry> deck_entries[4];
std::shared_ptr<parray<ActionChainWithConds, 9>> set_card_action_chains[4];
std::shared_ptr<parray<ActionMetadata, 9>> set_card_action_metadatas[4];
bcarray<std::shared_ptr<HandAndEquipState>, 4> hand_and_equip_states;
bcarray<std::shared_ptr<parray<CardShortStatus, 0x10>>, 4> card_short_statuses;
bcarray<std::shared_ptr<DeckEntry>, 4> deck_entries;
bcarray<std::shared_ptr<parray<ActionChainWithConds, 9>>, 4> set_card_action_chains;
bcarray<std::shared_ptr<parray<ActionMetadata, 9>>, 4> set_card_action_metadatas;
};
} // namespace Episode3
+1 -1
View File
@@ -191,7 +191,7 @@ bool BattleRecord::is_map_definition_event(const Event& ev) {
if (ev.type == Event::Type::BATTLE_COMMAND) {
auto& header = check_size_t<G_CardBattleCommandHeader>(ev.data, 0xFFFF);
if (header.subcommand == 0xB6) {
auto& header = check_size_t<G_MapSubsubcommand_GC_Ep3_6xB6>(ev.data, 0xFFFF);
auto& header = check_size_t<G_MapSubsubcommand_Ep3_6xB6>(ev.data, 0xFFFF);
if (header.subsubcommand == 0x41) {
return true;
}
+1 -3
View File
@@ -96,9 +96,7 @@ private:
class BattleRecordPlayer {
public:
BattleRecordPlayer(
std::shared_ptr<const BattleRecord> rec,
std::shared_ptr<struct event_base> base);
BattleRecordPlayer(std::shared_ptr<const BattleRecord> rec, std::shared_ptr<struct event_base> base);
~BattleRecordPlayer() = default;
std::shared_ptr<const BattleRecord> get_record() const;
+563 -297
View File
File diff suppressed because it is too large Load Diff
+19 -23
View File
@@ -15,11 +15,7 @@ class PlayerState;
class Card : public std::enable_shared_from_this<Card> {
public:
Card(
uint16_t card_id,
uint16_t card_ref,
uint16_t client_id,
std::shared_ptr<Server> server);
Card(uint16_t card_id, uint16_t card_ref, uint16_t client_id, std::shared_ptr<Server> server);
void init();
std::shared_ptr<Server> server();
std::shared_ptr<const Server> server() const;
@@ -34,29 +30,31 @@ public:
int16_t value,
int8_t dice_roll_value,
int8_t random_percent);
void apply_ap_adjust_assists_to_attack(
void apply_ap_and_tp_adjust_assists_to_attack(
std::shared_ptr<const Card> attacker_card,
int16_t* inout_attacker_ap,
int16_t* in_defense_power) const;
int16_t* in_defense_power,
int16_t* inout_attacker_tp) const;
bool card_type_is_sc_or_creature() const;
bool check_card_flag(uint32_t flags) const;
void commit_attack(
int16_t damage,
std::shared_ptr<Card> attacker_card,
G_ApplyConditionEffect_GC_Ep3_6xB4x06* cmd,
G_ApplyConditionEffect_Ep3_6xB4x06* cmd,
size_t strike_number,
int16_t* out_effective_damage);
int16_t compute_defense_power_for_attacker_card(
std::shared_ptr<const Card> attacker_card);
int16_t compute_defense_power_for_attacker_card(std::shared_ptr<const Card> attacker_card);
void destroy_set_card(std::shared_ptr<Card> attacker_card);
int32_t error_code_for_move_to_location(const Location& loc) const;
void execute_attack(std::shared_ptr<Card> attacker_card);
bool get_attack_condition_value(
bool get_condition_value(
ConditionType cond_type,
uint16_t card_ref,
uint8_t def_effect_index,
uint16_t value,
uint16_t* out_value) const;
uint16_t card_ref = 0xFFFF,
uint8_t def_effect_index = 0xFF,
uint16_t value = 0xFFFF,
uint16_t* out_value = nullptr) const;
Condition* find_condition(ConditionType cond_type);
const Condition* find_condition(ConditionType cond_type) const;
std::shared_ptr<const CardIndex::CardEntry> get_definition() const;
uint16_t get_card_ref() const;
uint16_t get_card_id() const;
@@ -70,23 +68,21 @@ public:
void send_6xB4x4E_4C_4D_if_needed(bool always_send = false);
void send_6xB4x4E_if_needed(bool always_send = false);
void set_current_and_max_hp(int16_t hp);
void set_current_hp(
uint32_t new_hp, bool propagate_shared_hp = true, bool enforce_max_hp = true);
void set_current_hp(uint32_t new_hp, bool propagate_shared_hp = true, bool enforce_max_hp = true);
void update_stats_on_destruction();
void clear_action_chain_and_metadata_and_most_flags();
void compute_action_chain_results(
bool apply_action_conditions, bool ignore_this_card_ap_tp);
void compute_action_chain_results(bool apply_action_conditions, bool ignore_this_card_ap_tp);
void unknown_802380C0();
void unknown_80237F98(bool require_condition_20_or_21);
void unknown_80237F88();
void unknown_80235AA0();
void unknown_80235AD4();
void unknown_80235B10();
void draw_phase_before();
void action_phase_before();
void move_phase_before();
void unknown_80236374(std::shared_ptr<Card> other_card, const ActionState* as);
void unknown_802379BC(uint16_t card_ref);
void unknown_802379DC(const ActionState& pa);
void unknown_80237A90(const ActionState& pa, uint16_t action_card_ref);
void unknown_8023813C();
void dice_phase_before();
bool is_guard_item() const;
bool unknown_80236554(std::shared_ptr<Card> other_card, const ActionState* as);
void unknown_802362D8(std::shared_ptr<Card> other_card);
File diff suppressed because it is too large Load Diff
+50 -50
View File
@@ -45,45 +45,49 @@ public:
};
struct AttackEnvStats {
uint32_t num_set_cards; // "f" in expr
uint32_t dice_roll_value1; // "d" in expr
uint32_t effective_ap; // "ap" in expr
uint32_t effective_tp; // "tp" in expr
uint32_t current_hp; // "hp" in expr
uint32_t max_hp; // "mhp" in expr
uint32_t effective_ap_if_not_tech; // "dm" in expr
uint32_t effective_ap_if_not_physical; // "tdm" in expr
uint32_t player_num_destroyed_fcs; // "tf" in expr
uint32_t player_num_atk_points; // "ac" in expr
uint32_t defined_max_hp; // "php" in expr
uint32_t dice_roll_value2; // "dc" in expr
uint32_t card_cost; // "cs" in expr
uint32_t total_num_set_cards; // "a" in expr
uint32_t action_cards_ap; // "kap" in expr
uint32_t action_cards_tp; // "ktp" in expr
uint32_t unknown_a1; // "dn" in expr
uint32_t num_item_or_creature_cards_in_hand; // "hf" in expr
uint32_t num_destroyed_ally_fcs; // "df" in expr
uint32_t target_team_num_set_cards; // "ff" in expr
uint32_t condition_giver_team_num_set_cards; // "ef" in expr
uint32_t num_native_creatures; // "bi" in expr
uint32_t num_a_beast_creatures; // "ab" in expr
uint32_t num_machine_creatures; // "mc" in expr
uint32_t num_dark_creatures; // "dk" in expr
uint32_t num_sword_type_items; // "sa" in expr
uint32_t num_gun_type_items; // "gn" in expr
uint32_t num_cane_type_items; // "wd" in expr
uint32_t effective_ap_if_not_tech2; // "tt" in expr
uint32_t team_dice_boost; // "lv" in expr
uint32_t sc_effective_ap; // "adm" in expr
uint32_t attack_bonus; // "ddm" in expr
uint32_t num_sword_type_items_on_team; // "sat" in expr
uint32_t target_attack_bonus; // "edm" in expr
uint32_t last_attack_preliminary_damage; // "ldm" in expr
uint32_t last_attack_damage; // "rdm" in expr
uint32_t total_last_attack_damage; // "fdm" in expr
uint32_t last_attack_damage_count; // "ndm" in expr
uint32_t target_current_hp; // "ehp" in expr
/* 00 */ uint32_t num_set_cards; // "f" in expr
/* 04 */ uint32_t dice_roll_value1; // "d" in expr
/* 08 */ uint32_t effective_ap; // "ap" in expr
/* 0C */ uint32_t effective_tp; // "tp" in expr
/* 10 */ uint32_t current_hp; // "hp" in expr
/* 14 */ uint32_t max_hp; // "mhp" in expr
/* 18 */ uint32_t effective_ap_if_not_tech; // "dm" in expr
/* 1C */ uint32_t effective_ap_if_not_physical; // "tdm" in expr
/* 20 */ uint32_t player_num_destroyed_fcs; // "tf" in expr
/* 24 */ uint32_t player_num_atk_points; // "ac" in expr
/* 28 */ uint32_t defined_max_hp; // "php" in expr
/* 2C */ uint32_t dice_roll_value2; // "dc" in expr
/* 30 */ uint32_t card_cost; // "cs" in expr
/* 34 */ uint32_t total_num_set_cards; // "a" in expr
/* 38 */ uint32_t action_cards_ap; // "kap" in expr
/* 3C */ uint32_t action_cards_tp; // "ktp" in expr
/* 40 */ uint32_t unknown_a1; // "dn" in expr
/* 44 */ uint32_t num_item_or_creature_cards_in_hand; // "hf" in expr
/* 48 */ uint32_t num_destroyed_ally_fcs; // "df" in expr
/* 4C */ uint32_t target_team_num_set_cards; // "ff" in expr
/* 50 */ uint32_t non_target_team_num_set_cards; // "ef" in expr
/* 54 */ uint32_t num_native_creatures; // "bi" in expr
/* 58 */ uint32_t num_a_beast_creatures; // "ab" in expr
/* 5C */ uint32_t num_machine_creatures; // "mc" in expr
/* 60 */ uint32_t num_dark_creatures; // "dk" in expr
/* 64 */ uint32_t num_sword_type_items; // "sa" in expr
/* 68 */ uint32_t num_gun_type_items; // "gn" in expr
/* 6C */ uint32_t num_cane_type_items; // "wd" in expr
/* 70 */ uint32_t effective_ap_if_not_tech2; // "tt" in expr
/* 74 */ uint32_t team_dice_bonus; // "lv" in expr
/* 78 */ uint32_t sc_effective_ap; // "adm" in expr
// The following fields do not exist in Trial Edition. Because this struct
// is never sent to the client, we use the full struct even when playing
// Trial Edition, just for simplicity.
/* 7C */ uint32_t attack_bonus; // "ddm" in expr
/* 80 */ uint32_t num_sword_type_items_on_team; // "sat" in expr
/* 84 */ uint32_t target_attack_bonus; // "edm" in expr
/* 88 */ uint32_t last_attack_preliminary_damage; // "ldm" in expr
/* 8C */ uint32_t last_attack_damage; // "rdm" in expr
/* 90 */ uint32_t total_last_attack_damage; // "fdm" in expr
/* 94 */ uint32_t last_attack_damage_count; // "ndm" in expr
/* 98 */ uint32_t target_current_hp; // "ehp" in expr
/* 9C */
AttackEnvStats();
void clear();
@@ -159,7 +163,7 @@ public:
uint32_t* unknown_p11,
uint16_t sc_card_ref);
StatSwapType compute_stat_swap_type(std::shared_ptr<const Card> card) const;
void compute_team_dice_boost(uint8_t team_id);
void compute_team_dice_bonus(uint8_t team_id);
bool condition_has_when_20_or_21(const Condition& cond) const;
size_t count_action_cards_with_condition_for_all_current_attacks(
ConditionType cond_type, uint16_t card_ref) const;
@@ -309,14 +313,13 @@ public:
const Location& card1_loc,
std::shared_ptr<const Card> card2) const;
void unknown_8024AAB8(const ActionState& as);
void unknown_80244BE4(std::shared_ptr<Card> unknown_p2);
void unknown_80244CA8(std::shared_ptr<Card> card);
void move_phase_before_for_card(std::shared_ptr<Card> unknown_p2);
void dice_phase_before_for_card(std::shared_ptr<Card> card);
template <uint8_t When1, uint8_t When2>
void unknown1_t(
std::shared_ptr<Card> unknown_p2, const ActionState* existing_as = nullptr);
void unknown_80249060(std::shared_ptr<Card> unknown_p2);
void unknown_80249254(std::shared_ptr<Card> unknown_p2);
void unknown_8024945C(std::shared_ptr<Card> unknown_p2, const ActionState& existing_as);
void apply_effects_on_phase_change_t(std::shared_ptr<Card> unknown_p2, const ActionState* existing_as = nullptr);
void draw_phase_before_for_card(std::shared_ptr<Card> unknown_p2);
void action_phase_before_for_card(std::shared_ptr<Card> unknown_p2);
void unknown_8024945C(std::shared_ptr<Card> unknown_p2, const ActionState* existing_as);
void unknown_8024966C(std::shared_ptr<Card> unknown_p2, const ActionState* existing_as);
static std::shared_ptr<Card> sc_card_for_card(std::shared_ptr<Card> unknown_p2);
void unknown_8024A9D8(const ActionState& pa, uint16_t action_card_ref);
@@ -333,9 +336,6 @@ public:
private:
std::weak_ptr<Server> w_server;
ActionState unknown_action_state_a1;
ActionState action_state;
uint16_t unknown_a2;
};
} // namespace Episode3
File diff suppressed because it is too large Load Diff
+85 -58
View File
@@ -15,7 +15,7 @@
#include "../PlayerSubordinates.hh"
#include "../Text.hh"
#include "../TextArchive.hh"
#include "../TextIndex.hh"
namespace Episode3 {
@@ -36,6 +36,8 @@ enum BehaviorFlag : uint32_t {
DISABLE_MASKING = 0x00000080,
DISABLE_INTERFERENCE = 0x00000100,
ALLOW_NON_COM_INTERFERENCE = 0x00000200,
IS_TRIAL_EDITION = 0x00000400,
LOG_COMMANDS_IF_LOBBY_MISSING = 0x00000800,
};
enum class StatSwapType : uint8_t {
@@ -58,8 +60,6 @@ enum class AttackMedium : uint8_t {
INVALID_FF = 0xFF,
};
const char* name_for_attack_medium(AttackMedium medium);
enum class CriterionCode : uint8_t {
NONE = 0x00,
HU_CLASS_SC = 0x01,
@@ -98,8 +98,6 @@ enum class CriterionCode : uint8_t {
NON_PHYSICAL_NON_TECH_NON_UNKNOWN_ATTACK_MEDIUM_NON_SC = 0x22,
};
const char* name_for_criterion_code(CriterionCode code);
enum class CardRank : uint8_t {
N1 = 0x01,
R1 = 0x02,
@@ -137,8 +135,6 @@ enum class CardType : uint8_t {
END_CARD_LIST = 0xFF,
};
const char* name_for_card_type(CardType type);
enum class CardClass : uint16_t {
HU_SC = 0x0000,
RA_SC = 0x0001,
@@ -162,8 +158,7 @@ enum class CardClass : uint16_t {
ASSIST = 0x0028,
};
const char* name_for_card_class(CardClass cc);
bool card_class_is_tech_like(CardClass cc);
bool card_class_is_tech_like(CardClass cc, bool is_nte);
enum class TargetMode : uint8_t {
NONE = 0x00, // Used for defense cards, mags, shields, etc.
@@ -299,7 +294,7 @@ enum class ConditionType : uint8_t {
UNKNOWN_75 = 0x75,
REFLECT = 0x76, // Generate reverse attack
UNKNOWN_77 = 0x77,
ANY = 0x78, // Not a real condition; used as a wildcard in search functions
ANY = 0x78, // Not a real condition; used as a wildcard in search functions. Has value 0x64 on NTE
UNKNOWN_79 = 0x79,
UNKNOWN_7A = 0x7A,
UNKNOWN_7B = 0x7B,
@@ -309,8 +304,6 @@ enum class ConditionType : uint8_t {
ANY_FF = 0xFF, // Used as a wildcard in some search functions
};
const char* name_for_condition_type(ConditionType cond_type);
enum class AssistEffect : uint16_t {
NONE = 0x0000,
DICE_HALF = 0x0001,
@@ -407,8 +400,6 @@ enum class ActionSubphase : uint8_t {
INVALID_FF = 0xFF,
};
const char* name_for_action_subphase(ActionSubphase subphase);
enum class SetupPhase : uint8_t {
REGISTRATION = 0,
STARTER_ROLLS = 1,
@@ -438,7 +429,6 @@ enum class Direction : uint8_t {
Direction turn_left(Direction d);
Direction turn_right(Direction d);
Direction turn_around(Direction d);
const char* name_for_direction(Direction d);
struct Location {
/* 00 */ uint8_t x;
@@ -479,6 +469,7 @@ struct CardDefinition {
void decode_code();
std::string str() const;
JSON json() const;
} __attribute__((packed));
struct Effect {
@@ -514,11 +505,12 @@ struct CardDefinition {
bool is_empty() const;
static std::string str_for_arg(const std::string& arg);
std::string str(const char* separator = ", ", const TextArchive* text_archive = nullptr) const;
std::string str(const char* separator = ", ", const TextSet* text_archive = nullptr) const;
JSON json() const;
} __attribute__((packed));
/* 0000 */ be_uint32_t card_id;
/* 0004 */ parray<uint8_t, 0x40> jp_name;
/* 0004 */ pstring<TextEncoding::SJIS, 0x40> jp_name;
// The list of card definitions ends with a "sentinel" definition that isn't a
// real card, but instead has a negative number in the type field here.
@@ -764,9 +756,9 @@ struct CardDefinition {
// enormous comment? That's what this array stores.
/* 009C */ parray<be_uint16_t, 2> drop_rates;
/* 00A0 */ pstring<TextEncoding::SJIS, 0x14> en_name;
/* 00A0 */ pstring<TextEncoding::ISO8859, 0x14> en_name;
/* 00B4 */ pstring<TextEncoding::SJIS, 0x0B> jp_short_name;
/* 00BF */ pstring<TextEncoding::SJIS, 0x08> en_short_name;
/* 00BF */ pstring<TextEncoding::ISO8859, 0x08> en_short_name;
// These effects modify the card's behavior in various situations. Only
// effects for which effect_num is not zero are used.
/* 00C7 */ parray<Effect, 3> effects;
@@ -780,7 +772,8 @@ struct CardDefinition {
CardClass card_class() const;
void decode_range();
std::string str(bool single_line = true, const TextArchive* text_archive = nullptr) const;
std::string str(bool single_line = true, const TextSet* text_archive = nullptr) const;
JSON json() const;
} __attribute__((packed)); // 0x128 bytes in total
struct CardDefinitionsFooter {
@@ -800,7 +793,7 @@ struct CardDefinitionsFooter {
} __attribute__((packed));
struct DeckDefinition {
/* 00 */ pstring<TextEncoding::SJIS, 0x10> name;
/* 00 */ pstring<TextEncoding::MARKED, 0x10> name;
/* 10 */ be_uint32_t client_id; // 0-3
// List of card IDs. The card count is the number of nonzero entries here
// before a zero entry (or 50 if no entries are nonzero). The first card ID is
@@ -823,11 +816,11 @@ struct PlayerConfig {
// The game splits this internally into two structures. The first column of
// offsets is relative to the start of the first structure; the second column
// is relative to the start of the second structure.
/* 0000:---- */ pstring<TextEncoding::SJIS, 12> rank_text; // From B7 command
/* 0000:---- */ pstring<TextEncoding::MARKED, 12> rank_text; // From B7 command
/* 000C:---- */ parray<uint8_t, 0x1C> unknown_a1;
/* 0028:---- */ parray<be_uint16_t, 20> tech_menu_shortcut_entries;
/* 0050:---- */ parray<be_uint32_t, 10> choice_search_config;
// This field maps to quest_global_flags on Episodes 1 & 2
// This field maps to quest_counters on Episodes 1 & 2
/* 0078:---- */ parray<be_uint32_t, 0x30> scenario_progress;
// place_counts[0] and [1] from this field are added to the player's win and
// loss count respectively when they're shown in the status menu. However,
@@ -885,7 +878,7 @@ struct PlayerConfig {
/* 2124:1FD0 */ be_uint32_t online_clv_exp; // CLvOn = this / 100
struct PlayerReference {
/* 00 */ be_uint32_t guild_card_number;
/* 04 */ pstring<TextEncoding::SJIS, 0x18> player_name;
/* 04 */ pstring<TextEncoding::MARKED, 0x18> name;
} __attribute__((packed));
// This array is updated when a battle is started (via a 6xB4x05 command). The
// client adds the opposing players' info to ths first two entries here if the
@@ -939,8 +932,8 @@ struct Rules {
/* 00 */ uint8_t overall_time_limit = 0;
/* 01 */ uint8_t phase_time_limit = 0; // In seconds; 0 = unlimited
/* 02 */ AllowedCards allowed_cards = AllowedCards::ALL;
/* 03 */ uint8_t min_dice = 1; // 0 = default (1)
/* 04 */ uint8_t max_dice = 6; // 0 = default (6)
/* 03 */ uint8_t min_dice_value = 1; // 0 = default (1)
/* 04 */ uint8_t max_dice_value = 6; // 0 = default (6)
/* 05 */ uint8_t disable_deck_shuffle = 0; // 0 = shuffle on, 1 = off
/* 06 */ uint8_t disable_deck_loop = 0; // 0 = loop on, 1 = off
/* 07 */ uint8_t char_hp = 15;
@@ -951,8 +944,11 @@ struct Rules {
/* 0C */ uint8_t disable_dice_boost = 0; // 0 = dice boost on, 1 = off
// NOTE: The following fields are unused in PSO's implementation, but newserv
// uses them to implement extended rules.
/* 0D */ uint8_t def_dice_range = 0; // High 4 bits = min, low 4 = max
/* 0E */ parray<uint8_t, 6> unused;
/* 0D */ uint8_t def_dice_value_range = 0; // High 4 bits = min, low 4 = max
// These fields specify override dice ranges for the 1-player team in 2v1
/* 0E */ uint8_t atk_dice_value_range_2v1 = 0; // High 4 bits = min, low 4 = max
/* 0F */ uint8_t def_dice_value_range_2v1 = 0; // High 4 bits = min, low 4 = max
/* 10 */ parray<uint8_t, 4> unused;
/* 14 */
// Annoyingly, this structure is a different size in Episode 3 Trial Edition.
@@ -972,20 +968,22 @@ struct Rules {
bool check_invalid_fields() const;
bool check_and_reset_invalid_fields();
uint8_t min_def_dice() const;
uint8_t max_def_dice() const;
std::pair<uint8_t, uint8_t> atk_dice_range(bool is_1p_2v1) const;
std::pair<uint8_t, uint8_t> def_dice_range(bool is_1p_2v1) const;
std::string str() const;
} __attribute__((packed));
struct RulesTrial {
// The fields here have the same meaning as in the final version. The only
// difference is that Dice Boost does not exist in the trial version.
// Most fields here have the same meanings as in the final version.
/* 00 */ uint8_t overall_time_limit = 0;
/* 01 */ uint8_t phase_time_limit = 0;
/* 02 */ AllowedCards allowed_cards = AllowedCards::ALL;
/* 03 */ uint8_t atk_dice_max = 1;
/* 04 */ uint8_t def_dice_max = 6;
// In NTE, the dice behave differently than in non-NTE. A zero in either of
// these fields means the corresponding die is random in the range [1, 6];
// any nonzero value means that die will always take that value.
/* 03 */ uint8_t atk_die_behavior = 0;
/* 04 */ uint8_t def_die_behavior = 0;
/* 05 */ uint8_t disable_deck_shuffle = 0;
/* 06 */ uint8_t disable_deck_loop = 0;
/* 07 */ uint8_t char_hp = 15;
@@ -996,7 +994,7 @@ struct RulesTrial {
/* 0C */
RulesTrial() = default;
explicit RulesTrial(const Rules&);
RulesTrial(const Rules&);
operator Rules() const;
} __attribute__((packed));
@@ -1009,7 +1007,7 @@ struct StateFlags {
/* 06 */ SetupPhase setup_phase;
/* 07 */ RegistrationPhase registration_phase;
/* 08 */ parray<le_uint32_t, 2> team_exp;
/* 10 */ parray<uint8_t, 2> team_dice_boost;
/* 10 */ parray<uint8_t, 2> team_dice_bonus;
/* 12 */ uint8_t first_team_turn;
/* 13 */ uint8_t tournament_flag;
/* 14 */ parray<CardType, 4> client_sc_card_types;
@@ -1156,6 +1154,7 @@ struct MapDefinition { // .mnmd format; also the format of (decompressed) quests
/* 48 */
std::string str() const;
JSON json() const;
} __attribute__((packed));
// This array specifies the camera zone maps. A camera zone map is a subset of
@@ -1183,8 +1182,9 @@ struct MapDefinition { // .mnmd format; also the format of (decompressed) quests
// 10 = blocked by rock (as if the corresponding map_tiles value was 00)
// 20 = blocked by fence (as if the corresponding map_tiles value was 00)
// 30-34 = teleporters (2 of each value may be present)
// 40-44 = traps (one of each type is chosen at random to be a real trap at
// battle start time)
// 40-4F = traps on NTE
// 40-44 = traps on non-NTE (one of each type is chosen at random to be a real
// trap at battle start time)
// 50 = blocked by metal box (appears as improperly-z-buffered teal cube in
// preview; behaves like 10 and 20 in game)
// The assist cards that each trap type can contain are:
@@ -1198,10 +1198,10 @@ struct MapDefinition { // .mnmd format; also the format of (decompressed) quests
/* 1D68 */ parray<uint8_t, 0x74> unknown_a5;
/* 1DDC */ Rules default_rules;
/* 1DF0 */ pstring<TextEncoding::SJIS, 0x14> name;
/* 1E04 */ pstring<TextEncoding::SJIS, 0x14> location_name;
/* 1E18 */ pstring<TextEncoding::SJIS, 0x3C> quest_name; // == location_name if not a quest
/* 1E54 */ pstring<TextEncoding::SJIS, 0x190> description;
/* 1DF0 */ pstring<TextEncoding::MARKED, 0x14> name;
/* 1E04 */ pstring<TextEncoding::MARKED, 0x14> location_name;
/* 1E18 */ pstring<TextEncoding::MARKED, 0x3C> quest_name; // == location_name if not a quest
/* 1E54 */ pstring<TextEncoding::MARKED, 0x190> description;
// These fields describe where the map cursor on the preview screen should
// scroll to
@@ -1209,9 +1209,10 @@ struct MapDefinition { // .mnmd format; also the format of (decompressed) quests
/* 1FE6 */ be_uint16_t map_y;
struct NPCDeck {
/* 00 */ pstring<TextEncoding::SJIS, 0x18> name;
/* 00 */ pstring<TextEncoding::MARKED, 0x18> deck_name;
/* 18 */ parray<be_uint16_t, 0x20> card_ids; // Last one appears to always be FFFF
/* 58 */
JSON json(uint8_t language) const;
} __attribute__((packed));
/* 1FE8 */ parray<NPCDeck, 3> npc_decks; // Unused if name[0] == 0
@@ -1223,10 +1224,11 @@ struct MapDefinition { // .mnmd format; also the format of (decompressed) quests
/* 0000 */ parray<be_uint16_t, 2> unknown_a1;
/* 0004 */ uint8_t is_arkz;
/* 0005 */ parray<uint8_t, 3> unknown_a2;
/* 0008 */ pstring<TextEncoding::SJIS, 0x10> name;
/* 0008 */ pstring<TextEncoding::MARKED, 0x10> ai_name;
// TODO: Figure out exactly how these are used and document here.
/* 0018 */ parray<be_uint16_t, 0x7E> params;
/* 0114 */
JSON json(uint8_t language) const;
} __attribute__((packed));
/* 20F0 */ parray<AIParams, 3> npc_ai_params; // Unused if name[0] == 0
@@ -1257,9 +1259,9 @@ struct MapDefinition { // .mnmd format; also the format of (decompressed) quests
// appears after the battle if it's not blank. dispatch_message appears right
// before the player chooses a deck if it's not blank; usually it says
// something like "You can only dispatch <character>".
/* 2440 */ pstring<TextEncoding::SJIS, 0x190> before_message;
/* 25D0 */ pstring<TextEncoding::SJIS, 0x190> after_message;
/* 2760 */ pstring<TextEncoding::SJIS, 0x190> dispatch_message;
/* 2440 */ pstring<TextEncoding::MARKED, 0x190> before_message;
/* 25D0 */ pstring<TextEncoding::MARKED, 0x190> after_message;
/* 2760 */ pstring<TextEncoding::MARKED, 0x190> dispatch_message;
struct DialogueSet {
// Dialogue sets specify lines that COMs can say at certain points during
@@ -1277,8 +1279,9 @@ struct MapDefinition { // .mnmd format; also the format of (decompressed) quests
/* 0002 */ be_uint16_t percent_chance; // 0-100, or FFFF if unused
// If the dialogue set activates, the game randomly chooses one of these
// strings, excluding any that are empty or begin with the character '^'.
/* 0004 */ parray<pstring<TextEncoding::SJIS, 0x40>, 4> strings;
/* 0004 */ parray<pstring<TextEncoding::MARKED, 0x40>, 4> strings;
/* 0104 */
JSON json(uint8_t language) const;
} __attribute__((packed));
// There are up to 0x10 of these per valid NPC, but only the first 13 of them
@@ -1361,6 +1364,7 @@ struct MapDefinition { // .mnmd format; also the format of (decompressed) quests
bool operator==(const EntryState& other) const = default;
bool operator!=(const EntryState& other) const = default;
JSON json() const;
} __attribute__((packed));
/* 5A10 */ parray<EntryState, 4> entry_states;
/* 5A18 */
@@ -1376,6 +1380,7 @@ struct MapDefinition { // .mnmd format; also the format of (decompressed) quests
void assert_semantically_equivalent(const MapDefinition& other) const;
std::string str(const CardIndex* card_index, uint8_t language) const;
JSON json(uint8_t language) const;
} __attribute__((packed));
struct MapDefinitionTrial {
@@ -1396,19 +1401,19 @@ struct MapDefinitionTrial {
/* 1C68 */ parray<parray<uint8_t, 0x10>, 0x10> modification_tiles;
/* 1D68 */ parray<uint8_t, 0x74> unknown_a5;
/* 1DD4 */ RulesTrial default_rules;
/* 1DE8 */ pstring<TextEncoding::SJIS, 0x14> name;
/* 1DFC */ pstring<TextEncoding::SJIS, 0x14> location_name;
/* 1E10 */ pstring<TextEncoding::SJIS, 0x3C> quest_name;
/* 1E4C */ pstring<TextEncoding::SJIS, 0x190> description;
/* 1DE8 */ pstring<TextEncoding::MARKED, 0x14> name;
/* 1DFC */ pstring<TextEncoding::MARKED, 0x14> location_name;
/* 1E10 */ pstring<TextEncoding::MARKED, 0x3C> quest_name;
/* 1E4C */ pstring<TextEncoding::MARKED, 0x190> description;
/* 1FDC */ be_uint16_t map_x;
/* 1FDE */ be_uint16_t map_y;
/* 1FE0 */ parray<MapDefinition::NPCDeck, 3> npc_decks;
/* 20E8 */ parray<MapDefinition::AIParams, 3> npc_ai_params;
/* 2424 */ parray<uint8_t, 8> unknown_a7;
/* 242C */ parray<be_int32_t, 3> npc_ai_params_entry_index;
/* 2438 */ pstring<TextEncoding::SJIS, 0x190> before_message;
/* 25C8 */ pstring<TextEncoding::SJIS, 0x190> after_message;
/* 2758 */ pstring<TextEncoding::SJIS, 0x190> dispatch_message;
/* 2438 */ pstring<TextEncoding::MARKED, 0x190> before_message;
/* 25C8 */ pstring<TextEncoding::MARKED, 0x190> after_message;
/* 2758 */ pstring<TextEncoding::MARKED, 0x190> dispatch_message;
/* 28E8 */ parray<parray<MapDefinition::DialogueSet, 8>, 3> dialogue_sets;
/* 4148 */ parray<be_uint16_t, 0x10> reward_card_ids;
/* 4168 */ be_int32_t win_level_override;
@@ -1440,9 +1445,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;
@@ -1458,6 +1463,7 @@ public:
std::shared_ptr<const CardEntry> definition_for_name_normalized(const std::string& name) const;
std::set<uint32_t> all_ids() const;
uint64_t definitions_mtime() const;
JSON definitions_json() const;
private:
static std::string normalize_card_name(const std::string& name);
@@ -1482,7 +1488,7 @@ public:
VersionedMap(std::string&& compressed_data, uint8_t language);
std::shared_ptr<const MapDefinitionTrial> trial() const;
const std::string& compressed(bool is_trial) const;
const std::string& compressed(bool is_nte) const;
private:
mutable std::shared_ptr<const MapDefinitionTrial> trial_map;
@@ -1549,3 +1555,24 @@ template <>
Episode3::AllowedCards enum_for_name<Episode3::AllowedCards>(const char* name);
template <>
const char* name_for_enum<Episode3::AllowedCards>(Episode3::AllowedCards allowed_cards);
template <>
const char* name_for_enum<Episode3::BattlePhase>(Episode3::BattlePhase phase);
template <>
const char* name_for_enum<Episode3::SetupPhase>(Episode3::SetupPhase phase);
template <>
const char* name_for_enum<Episode3::RegistrationPhase>(Episode3::RegistrationPhase phase);
template <>
const char* name_for_enum<Episode3::ActionSubphase>(Episode3::ActionSubphase phase);
template <>
const char* name_for_enum<Episode3::AttackMedium>(Episode3::AttackMedium medium);
template <>
const char* name_for_enum<Episode3::CriterionCode>(Episode3::CriterionCode code);
template <>
const char* name_for_enum<Episode3::CardType>(Episode3::CardType type);
template <>
const char* name_for_enum<Episode3::CardClass>(Episode3::CardClass cc);
template <>
const char* name_for_enum<Episode3::ConditionType>(Episode3::ConditionType cond_type);
template <>
const char* name_for_enum<Episode3::Direction>(Episode3::Direction d);
+11 -10
View File
@@ -88,15 +88,16 @@ bool DeckState::draw_card_by_ref(uint16_t card_ref) {
return false;
}
// If the card is discarded, then it should be before the draw index, and we
// can just change its state.
if (this->entries[index].state == CardState::DISCARDED) {
// If the card is discarded, then it should be before the draw index, and we
// can just change its state.
this->entries[index].state = CardState::IN_HAND;
return true;
// If the card is still drawable, we need to move it so it's just in front of
// the draw index, then immediately draw it
} else if (this->entries[index].state == CardState::DRAWABLE) {
// If the card is still drawable, we need to move it so it's just in front
// of the draw index, then immediately draw it. Ep3 NTE does not handle this
// case, but we do even when playing NTE.
ssize_t ref_index;
for (ref_index = this->card_refs.size(); ref_index >= 0; ref_index--) {
if (this->card_refs[ref_index] == card_ref) {
@@ -182,7 +183,7 @@ void DeckState::restart() {
this->shuffle();
}
void DeckState::do_mulligan() {
void DeckState::do_mulligan(bool is_nte) {
for (size_t z = 0; z < this->entries.size(); z++) {
if (this->entries[z].state == CardState::DISCARDED) {
this->entries[z].state = CardState::DRAWABLE;
@@ -190,7 +191,7 @@ void DeckState::do_mulligan() {
}
this->draw_index = 1;
if (this->shuffle_enabled) {
if (is_nte || this->shuffle_enabled) {
// Get the next 5 cards from the deck, and put the previous 5 cards after
// them (so they will be shuffled back in).
for (uint8_t z = 0; z < 5; z++) {
@@ -204,8 +205,8 @@ void DeckState::do_mulligan() {
size_t max = this->num_drawable_cards() - 5;
uint8_t base_index = this->draw_index + 5;
for (size_t z = 0; z < this->card_refs.size(); z++) {
uint8_t index1 = this->random_crypt->next() % max;
uint8_t index2 = this->random_crypt->next() % max;
uint8_t index1 = random_from_optional_crypt(this->opt_rand_crypt) % max;
uint8_t index2 = random_from_optional_crypt(this->opt_rand_crypt) % max;
uint16_t temp_ref = this->card_refs[base_index + index1];
this->card_refs[base_index + index1] = this->card_refs[base_index + index2];
this->card_refs[base_index + index2] = temp_ref;
@@ -264,8 +265,8 @@ void DeckState::shuffle() {
// instead swap each item with another random item (possibly itself) that
// doesn't appear earlier than it in the array, but this is not what Sega
// did.
uint8_t index1 = this->draw_index + this->random_crypt->next() % max;
uint8_t index2 = this->draw_index + this->random_crypt->next() % max;
uint8_t index1 = this->draw_index + random_from_optional_crypt(this->opt_rand_crypt) % max;
uint8_t index2 = this->draw_index + random_from_optional_crypt(this->opt_rand_crypt) % max;
uint16_t temp_ref = this->card_refs[index1];
this->card_refs[index1] = this->card_refs[index2];
this->card_refs[index2] = temp_ref;
+18 -16
View File
@@ -11,27 +11,29 @@
namespace Episode3 {
struct NameEntry {
parray<char, 0x10> name;
uint8_t client_id;
uint8_t present;
uint8_t is_cpu_player;
uint8_t unused;
/* 00 */ pstring<TextEncoding::MARKED, 0x10> name;
/* 10 */ uint8_t client_id;
/* 11 */ uint8_t present;
/* 12 */ uint8_t is_cpu_player;
/* 13 */ uint8_t unused;
/* 14 */
NameEntry();
void clear();
} __attribute__((packed));
struct DeckEntry {
pstring<TextEncoding::SJIS, 0x10> name;
le_uint32_t team_id;
parray<le_uint16_t, 31> card_ids;
/* 00 */ pstring<TextEncoding::MARKED, 0x10> name;
/* 10 */ le_uint32_t team_id;
/* 14 */ parray<le_uint16_t, 31> card_ids;
// If the following flag is not set to 3, then the God Whim assist effect can
// use cards that are hidden from the player during deck building. The client
// always sets this to 3, and it's not clear why this even exists.
uint8_t god_whim_flag;
uint8_t unused1;
le_uint16_t player_level;
parray<uint8_t, 2> unused2;
/* 52 */ uint8_t god_whim_flag;
/* 53 */ uint8_t unused1;
/* 54 */ le_uint16_t player_level;
/* 56 */ parray<uint8_t, 2> unused2;
/* 58 */
DeckEntry();
void clear();
@@ -55,13 +57,13 @@ public:
DeckState(
uint8_t client_id,
const parray<CardIDT, 0x1F>& card_ids,
std::shared_ptr<PSOLFGEncryption> random_crypt)
std::shared_ptr<PSOLFGEncryption> opt_rand_crypt)
: client_id(client_id),
draw_index(1),
card_ref_base(this->client_id << 8),
shuffle_enabled(true),
loop_enabled(true),
random_crypt(random_crypt) {
opt_rand_crypt(opt_rand_crypt) {
for (size_t z = 0; z < card_ids.size(); z++) {
auto& e = this->entries[z];
e.card_id = card_ids[z];
@@ -92,7 +94,7 @@ public:
void restart();
void shuffle();
void do_mulligan();
void do_mulligan(bool is_nte);
void print(FILE* stream, std::shared_ptr<const CardIndex> card_index = nullptr) const;
@@ -110,7 +112,7 @@ private:
parray<CardEntry, 31> entries;
parray<uint16_t, 31> card_refs;
std::shared_ptr<PSOLFGEncryption> random_crypt;
std::shared_ptr<PSOLFGEncryption> opt_rand_crypt;
};
} // namespace Episode3
+33 -2
View File
@@ -43,7 +43,7 @@ void MapAndRulesState::clear() {
this->num_team0_players = 0;
this->unused2 = 0;
this->start_facing_directions = 0;
this->unused3 = 0;
this->unknown_a3 = 0;
this->map_number = 0;
this->unused4 = 0;
this->rules.clear();
@@ -68,6 +68,37 @@ void MapAndRulesState::clear_occupied_bit_for_tile(uint8_t x, uint8_t y) {
this->map.tiles[y][x] &= 0xEF;
}
MapAndRulesStateTrial::MapAndRulesStateTrial(const MapAndRulesState& state)
: map(state.map),
num_players(state.num_players),
unused1(state.unused1),
environment_number(state.environment_number),
num_players_per_team(state.num_players_per_team),
num_team0_players(state.num_team0_players),
unused2(state.unused2),
unused5(state.start_facing_directions),
unknown_a3(state.unknown_a3),
map_number(state.map_number),
unused4(state.unused4),
rules(state.rules) {}
MapAndRulesStateTrial::operator MapAndRulesState() const {
MapAndRulesState ret;
ret.map = this->map;
ret.num_players = this->num_players;
ret.unused1 = this->unused1;
ret.environment_number = this->environment_number;
ret.num_players_per_team = this->num_players_per_team;
ret.num_team0_players = this->num_team0_players;
ret.unused2 = this->unused2;
ret.start_facing_directions = this->unused5;
ret.unknown_a3 = this->unknown_a3;
ret.map_number = this->map_number;
ret.unused4 = this->unused4;
ret.rules = this->rules;
return ret;
}
OverlayState::OverlayState() {
this->clear();
}
@@ -78,7 +109,7 @@ void OverlayState::clear() {
}
this->unused1.clear(0);
this->unused2.clear(0);
this->unused3.clear(0);
this->trap_card_ids_nte.clear(0);
}
} // namespace Episode3
+39 -17
View File
@@ -10,10 +10,11 @@
namespace Episode3 {
struct MapState {
le_uint16_t width;
le_uint16_t height;
parray<parray<uint8_t, 0x10>, 0x10> tiles;
parray<parray<uint8_t, 6>, 2> start_tile_definitions;
/* 0000 */ le_uint16_t width = 0;
/* 0002 */ le_uint16_t height = 0;
/* 0004 */ parray<parray<uint8_t, 0x10>, 0x10> tiles;
/* 0104 */ parray<parray<uint8_t, 6>, 2> start_tile_definitions;
/* 0110 */
MapState();
void clear();
@@ -22,18 +23,19 @@ struct MapState {
} __attribute__((packed));
struct MapAndRulesState {
MapState map;
uint8_t num_players;
uint8_t unused1;
uint8_t environment_number;
uint8_t num_players_per_team;
uint8_t num_team0_players;
uint8_t unused2;
le_uint16_t start_facing_directions;
uint32_t unused3;
le_uint32_t map_number;
uint32_t unused4;
Rules rules;
/* 0000 */ MapState map;
/* 0110 */ uint8_t num_players = 0;
/* 0111 */ uint8_t unused1 = 0;
/* 0112 */ uint8_t environment_number = 0;
/* 0113 */ uint8_t num_players_per_team = 0;
/* 0114 */ uint8_t num_team0_players = 0;
/* 0115 */ uint8_t unused2 = 0;
/* 0116 */ le_uint16_t start_facing_directions = 0;
/* 0118 */ be_uint32_t unknown_a3 = 0;
/* 011C */ le_uint32_t map_number = 0;
/* 0120 */ be_uint32_t unused4 = 0;
/* 0124 */ Rules rules;
/* 0138 */
MapAndRulesState();
void clear();
@@ -45,11 +47,31 @@ struct MapAndRulesState {
void clear_occupied_bit_for_tile(uint8_t x, uint8_t y);
} __attribute__((packed));
struct MapAndRulesStateTrial {
/* 0000 */ MapState map;
/* 0110 */ uint8_t num_players = 0;
/* 0111 */ uint8_t unused1 = 0;
/* 0112 */ uint8_t environment_number = 0;
/* 0113 */ uint8_t num_players_per_team = 0;
/* 0114 */ uint8_t num_team0_players = 0;
/* 0115 */ uint8_t unused2 = 0;
/* 0116 */ le_uint16_t unused5 = 0;
/* 0118 */ be_uint32_t unknown_a3 = 0;
/* 011C */ le_uint32_t map_number = 0;
/* 0120 */ be_uint32_t unused4 = 0;
/* 0124 */ RulesTrial rules;
/* 0130 */
MapAndRulesStateTrial() = default;
MapAndRulesStateTrial(const MapAndRulesState& state);
operator MapAndRulesState() const;
} __attribute__((packed));
struct OverlayState {
parray<parray<uint8_t, 0x10>, 0x10> tiles;
parray<le_uint32_t, 5> unused1;
parray<le_uint32_t, 0x10> unused2;
parray<le_uint16_t, 0x10> unused3;
parray<le_uint16_t, 0x10> trap_card_ids_nte; // Unused on non-NTE
OverlayState();
void clear();
File diff suppressed because it is too large Load Diff
+20 -22
View File
@@ -20,6 +20,7 @@ enum AssistFlag : uint32_t {
// be bits used only by the client which are not documented here.
// clang-format off
NONE = 0x0000,
READY_TO_END_PHASE = 0x0001,
DICE_WERE_EXCHANGED = 0x0002,
HAS_WON_BATTLE = 0x0004,
@@ -52,14 +53,14 @@ public:
uint16_t card_ref_for_hand_index(size_t hand_index) const;
int16_t compute_attack_or_defense_atk_costs(const ActionState& pa) const;
void compute_total_set_cards_cost();
size_t count_set_cards_for_env_stats_nte() const;
size_t count_set_cards() const;
size_t count_set_refs() const;
void discard_all_assist_cards_from_hand();
void discard_all_attack_action_cards_from_hand();
void discard_all_item_and_creature_cards_from_hand();
void discard_and_redraw_hand();
bool discard_card_or_add_to_draw_pile(
uint16_t card_ref, bool add_to_draw_pile);
bool discard_card_or_add_to_draw_pile(uint16_t card_ref, bool add_to_draw_pile);
void discard_random_hand_card();
bool discard_ref_from_hand(uint16_t card_ref);
void discard_set_assist_card();
@@ -76,8 +77,7 @@ public:
const Location& loc,
uint8_t target_team_id) const;
uint8_t get_atk_points() const;
void get_short_status_for_card_index_in_hand(
size_t hand_index, CardShortStatus* stat) const;
void get_short_status_for_card_index_in_hand(size_t hand_index, CardShortStatus* stat) const;
std::shared_ptr<DeckState> get_deck();
uint8_t get_def_points() const;
uint8_t get_dice_result(size_t which) const;
@@ -96,8 +96,8 @@ public:
bool is_mulligan_allowed() const;
bool is_team_turn() const;
void log_discard(uint16_t card_ref, uint16_t reason);
bool move_card_to_location_by_card_index(
size_t card_index, const Location& new_loc);
uint16_t pop_from_discard_log(uint16_t reason);
bool move_card_to_location_by_card_index(size_t card_index, const Location& new_loc);
void move_null_hand_refs_to_end();
void on_cards_destroyed();
void replace_all_set_assists_with_random_assists();
@@ -115,42 +115,40 @@ public:
uint8_t assist_target_client_id,
bool skip_error_checks_and_atk_sub);
void set_initial_location();
void set_map_occupied_bit_for_card_on_warp_tile(
std::shared_ptr<const Card> card);
void set_map_occupied_bit_for_card_on_warp_tile(std::shared_ptr<const Card> card);
void set_map_occupied_bits_for_sc_and_creatures();
void subtract_def_points(uint8_t cost);
bool subtract_or_check_atk_or_def_points_for_action(
const ActionState& pa, bool deduct_points);
bool subtract_or_check_atk_or_def_points_for_action(const ActionState& pa, bool deduct_points);
void subtract_atk_points(uint8_t cost);
G_UpdateHand_GC_Ep3_6xB4x02 prepare_6xB4x02() const;
void update_hand_and_equip_state_and_send_6xB4x02_if_needed(
bool always_send = false);
G_UpdateHand_Ep3_6xB4x02 prepare_6xB4x02() const;
void update_hand_and_equip_state_and_send_6xB4x02_if_needed(bool always_send = false);
void set_random_assist_card_from_hand_for_free();
G_UpdateShortStatuses_GC_Ep3_6xB4x04 prepare_6xB4x04() const;
G_UpdateShortStatuses_Ep3_6xB4x04 prepare_6xB4x04() const;
void send_6xB4x04_if_needed(bool always_send = false);
std::vector<uint16_t> get_card_refs_within_range_from_all_players(
const parray<uint8_t, 9 * 9>& range,
const Location& loc,
CardType type) const;
void unknown_80239460();
void unknown_802394C4();
void unknown_80239528();
void draw_phase_before();
void action_phase_before();
void move_phase_before();
void handle_before_turn_assist_effects();
int16_t get_assist_turns_remaining();
bool set_action_cards_for_action_state(const ActionState& pa);
void unknown_8023C174();
void handle_homesick_assist_effect(std::shared_ptr<Card> card);
void dice_phase_before();
void handle_homesick_assist_effect_from_bomb(std::shared_ptr<Card> card);
void apply_main_die_assist_effects(uint8_t* die_value) const;
void roll_main_dice();
void roll_main_dice_or_apply_after_effects();
void unknown_8023C110();
void compute_team_dice_boost_after_draw_phase();
void compute_team_dice_bonus_after_draw_phase();
void send_6xB4x0A_for_set_card(size_t set_index);
private:
std::weak_ptr<Server> w_server;
public:
std::shared_ptr<Card> sc_card;
std::shared_ptr<Card> set_cards[8];
bcarray<std::shared_ptr<Card>, 8> set_cards;
uint8_t client_id;
uint16_t num_mulligans_allowed;
CardType sc_card_type;
+183 -88
View File
@@ -6,22 +6,6 @@ using namespace std;
namespace Episode3 {
template <size_t Count>
std::string string_for_refs(const parray<le_uint16_t, Count>& card_refs) {
string ret = "[";
for (size_t z = 0; z < Count; z++) {
if (card_refs[z] != 0xFFFF) {
ret += string_printf("%zu:@$%04X ", z, card_refs[z].load());
}
}
if (!ret.empty()) {
ret.back() = ']'; // Replace the ' ' from the last added item
} else {
ret.push_back(']');
}
return ret;
}
Condition::Condition() {
this->clear();
}
@@ -77,20 +61,22 @@ void Condition::clear_FF() {
this->unknown_a8 = 0xFF;
}
std::string Condition::str() const {
std::string Condition::str(shared_ptr<const Server> s) const {
auto card_ref_str = s->debug_str_for_card_ref(this->card_ref);
auto giver_ref_str = s->debug_str_for_card_ref(this->condition_giver_card_ref);
return string_printf(
"Condition[type=%s, turns=%hhu, a_arg=%hhd, dice=%hhu, flags=%02hhX, "
"def_eff_index=%hhu, ref=@%04hX, value=%hd, giver_ref=@%04hX "
"def_eff_index=%hhu, ref=%s, value=%hd, giver_ref=%s "
"percent=%hhu value8=%hd order=%hu a8=%hu]",
name_for_condition_type(this->type),
name_for_enum(this->type),
this->remaining_turns,
this->a_arg_value,
this->dice_roll_value,
this->flags,
this->card_definition_effect_index,
this->card_ref.load(),
card_ref_str.c_str(),
this->value.load(),
this->condition_giver_card_ref.load(),
giver_ref_str.c_str(),
this->random_percent,
this->value8,
this->order,
@@ -114,13 +100,15 @@ void EffectResult::clear() {
this->dice_roll_value = 0;
}
std::string EffectResult::str() const {
std::string EffectResult::str(shared_ptr<const Server> s) const {
string attacker_ref_str = s->debug_str_for_card_ref(this->attacker_card_ref);
string target_ref_str = s->debug_str_for_card_ref(this->target_card_ref);
return string_printf(
"EffectResult[att_ref=@%04hX, target_ref=@%04hX, value=%hhd, "
"EffectResult[att_ref=%s, target_ref=%s, value=%hhd, "
"cur_hp=%hhd, ap=%hhd, tp=%hhd, flags=%02hhX, op=%hhd, "
"cond_index=%hhu, dice=%hhu]",
this->attacker_card_ref.load(),
this->target_card_ref.load(),
attacker_ref_str.c_str(),
target_ref_str.c_str(),
this->value,
this->current_hp,
this->ap,
@@ -148,12 +136,13 @@ bool CardShortStatus::operator!=(const CardShortStatus& other) const {
return !this->operator==(other);
}
std::string CardShortStatus::str() const {
std::string CardShortStatus::str(shared_ptr<const Server> s) const {
string loc_s = this->loc.str();
string ref_str = s->debug_str_for_card_ref(this->card_ref);
return string_printf(
"CardShortStatus[ref=@%04hX, cur_hp=%hd, flags=%08" PRIX32 ", loc=%s, "
"CardShortStatus[ref=%s, cur_hp=%hd, flags=%08" PRIX32 ", loc=%s, "
"u1=%04hX, max_hp=%hhd, u2=%hhu]",
this->card_ref.load(),
ref_str.c_str(),
this->current_hp.load(),
this->card_flags.load(),
loc_s.c_str(),
@@ -195,23 +184,27 @@ void ActionState::clear() {
this->original_attacker_card_ref = 0xFFFF;
this->target_card_refs.clear(0xFFFF);
this->action_card_refs.clear(0xFFFF);
this->unused2 = 0xFFFF;
}
std::string ActionState::str() const {
string target_refs_s = string_for_refs(this->target_card_refs);
string action_refs_s = string_for_refs(this->action_card_refs);
std::string ActionState::str(shared_ptr<const Server> s) const {
string attacker_ref_s = s->debug_str_for_card_ref(this->attacker_card_ref);
string defense_ref_s = s->debug_str_for_card_ref(this->defense_card_ref);
string original_attacker_ref_s = s->debug_str_for_card_ref(this->original_attacker_card_ref);
string target_refs_s = s->debug_str_for_card_refs(this->target_card_refs);
string action_refs_s = s->debug_str_for_card_refs(this->action_card_refs);
return string_printf(
"ActionState[client=%hu, u=%hhu, facing=%s, attacker_ref=@%04hX, "
"def_ref=@%04hX, target_refs=%s, action_refs=%s, "
"orig_attacker_ref=@%04hX]",
"ActionState[client=%hu, u=%hhu, facing=%s, attacker_ref=%s, "
"def_ref=%s, target_refs=%s, action_refs=%s, "
"orig_attacker_ref=%s]",
this->client_id.load(),
this->unused,
name_for_direction(this->facing_direction),
this->attacker_card_ref.load(),
this->defense_card_ref.load(),
name_for_enum(this->facing_direction),
attacker_ref_s.c_str(),
defense_ref_s.c_str(),
target_refs_s.c_str(),
action_refs_s.c_str(),
this->original_attacker_card_ref.load());
original_attacker_ref_s.c_str());
}
ActionChain::ActionChain() {
@@ -234,8 +227,8 @@ bool ActionChain::operator==(const ActionChain& other) const {
(this->damage_multiplier == other.damage_multiplier) &&
(this->attack_number == other.attack_number) &&
(this->tp_effect_bonus == other.tp_effect_bonus) &&
(this->unused1 == other.unused1) &&
(this->unused2 == other.unused2) &&
(this->physical_attack_bonus_nte == other.physical_attack_bonus_nte) &&
(this->tech_attack_bonus_nte == other.tech_attack_bonus_nte) &&
(this->card_ap == other.card_ap) &&
(this->card_tp == other.card_tp) &&
(this->flags == other.flags) &&
@@ -245,34 +238,35 @@ bool ActionChain::operator!=(const ActionChain& other) const {
return !this->operator==(other);
}
std::string ActionChain::str() const {
string attack_action_card_refs_s = string_for_refs(this->attack_action_card_refs);
string target_card_refs_s = string_for_refs(this->target_card_refs);
std::string ActionChain::str(shared_ptr<const Server> s) const {
string acting_card_ref_s = s->debug_str_for_card_ref(this->acting_card_ref);
string unknown_card_ref_a3_s = s->debug_str_for_card_ref(this->unknown_card_ref_a3);
string attack_action_card_refs_s = s->debug_str_for_card_refs(this->attack_action_card_refs);
string target_card_refs_s = s->debug_str_for_card_refs(this->target_card_refs);
return string_printf(
"ActionChain[eff_ap=%hhd, eff_tp=%hhd, ap_bonus=%hhd, damage=%hhd, "
"acting_ref=@%04hX, unknown_ref_a3=@%04hX, "
"attack_action_refs=%s, attack_action_ref_count=%hhu, "
"medium=%s, target_ref_count=%hhu, subphase=%s, "
"strikes=%hhu, damage_mult=%hhd, attack_num=%hhu, "
"tp_bonus=%hhd, u1=%hhu, u2=%hhu, card_ap=%hhd, "
"acting_ref=%s, unknown_ref_a3=%s, attack_action_refs=%s, "
"attack_action_ref_count=%hhu, medium=%s, target_ref_count=%hhu, "
"subphase=%s, strikes=%hhu, damage_mult=%hhd, attack_num=%hhu, "
"tp_bonus=%hhd, phys_bonus_nte=%hhu, tech_bonus_nte=%hhu, card_ap=%hhd, "
"card_tp=%hhd, flags=%08" PRIX32 ", target_refs=%s]",
this->effective_ap,
this->effective_tp,
this->ap_effect_bonus,
this->damage,
this->acting_card_ref.load(),
this->unknown_card_ref_a3.load(),
acting_card_ref_s.c_str(),
unknown_card_ref_a3_s.c_str(),
attack_action_card_refs_s.c_str(),
this->attack_action_card_ref_count,
name_for_attack_medium(this->attack_medium),
name_for_enum(this->attack_medium),
this->target_card_ref_count,
name_for_action_subphase(this->action_subphase),
name_for_enum(this->action_subphase),
this->strike_count,
this->damage_multiplier,
this->attack_number,
this->tp_effect_bonus,
this->unused1,
this->unused2,
this->physical_attack_bonus_nte,
this->tech_attack_bonus_nte,
this->card_ap,
this->card_tp,
this->flags.load(),
@@ -294,8 +288,8 @@ void ActionChain::clear() {
this->damage_multiplier = 1;
this->attack_number = 0xFF;
this->tp_effect_bonus = 0;
this->unused1 = 0;
this->unused2 = 0;
this->physical_attack_bonus_nte = 0;
this->tech_attack_bonus_nte = 0;
this->card_ap = 0;
this->card_tp = 0;
this->flags = 0;
@@ -319,8 +313,8 @@ void ActionChain::clear_FF() {
this->damage_multiplier = -1;
this->attack_number = 0xFF;
this->tp_effect_bonus = -1;
this->unused1 = 0xFF;
this->unused2 = 0xFF;
this->physical_attack_bonus_nte = 0xFF;
this->tech_attack_bonus_nte = 0xFF;
this->card_ap = -1;
this->card_tp = -1;
this->flags = 0xFFFFFFFF;
@@ -338,17 +332,17 @@ bool ActionChainWithConds::operator!=(const ActionChainWithConds& other) const {
return !this->operator==(other);
}
std::string ActionChainWithConds::str() const {
std::string ActionChainWithConds::str(shared_ptr<const Server> s) const {
string ret = "ActionChainWithConds[chain=";
ret += this->chain.str();
ret += this->chain.str(s);
ret += ", conds=[";
for (size_t z = 0; z < this->conditions.size(); z++) {
if (this->conditions[z].type != ConditionType::NONE) {
if (ret.back() != '=') {
if (ret.back() != '[') {
ret += ", ";
}
ret += string_printf("%zu:", z);
ret += this->conditions[z].str();
ret += this->conditions[z].str(s);
}
}
ret += "]]";
@@ -393,8 +387,8 @@ void ActionChainWithConds::reset() {
this->chain.effective_tp = 0;
this->chain.ap_effect_bonus = 0;
this->chain.tp_effect_bonus = 0;
this->chain.unused1 = 0;
this->chain.unused2 = 0;
this->chain.physical_attack_bonus_nte = 0;
this->chain.tech_attack_bonus_nte = 0;
this->chain.damage = 0;
this->chain.strike_count = 1;
this->chain.damage_multiplier = 1;
@@ -439,7 +433,7 @@ void ActionChainWithConds::compute_attack_medium(shared_ptr<Server> server) {
if (!ce) {
continue;
}
if (card_class_is_tech_like(ce->def.card_class())) {
if (card_class_is_tech_like(ce->def.card_class(), server->options.is_nte())) {
this->chain.attack_medium = AttackMedium::TECH;
}
}
@@ -481,6 +475,85 @@ bool ActionChainWithConds::can_apply_attack() const {
return this->check_flag(4) ? false : (this->chain.target_card_ref_count != 0);
}
uint8_t ActionChainWithConds::get_adjusted_move_ability_nte(uint8_t ability) const {
for (size_t z = 0; z < this->conditions.size(); z++) {
const auto& cond = this->conditions[z];
switch (cond.type) {
case ConditionType::IMMOBILE:
case ConditionType::FREEZE:
ability = 0;
break;
case ConditionType::SET_MV_COST_TO_0:
ability = 99;
break;
case ConditionType::ADD_1_TO_MV_COST:
ability--;
break;
case ConditionType::SCALE_MV_COST:
if (cond.value == 0) {
ability = 99;
} else {
ability /= cond.value;
}
break;
default:
break;
}
}
return ability;
}
ActionChainWithCondsTrial::ActionChainWithCondsTrial(const ActionChainWithConds& src)
: effective_ap(src.chain.effective_ap),
effective_tp(src.chain.effective_tp),
ap_effect_bonus(src.chain.ap_effect_bonus),
damage(src.chain.damage),
acting_card_ref(src.chain.acting_card_ref),
unknown_card_ref_a3(src.chain.unknown_card_ref_a3),
attack_action_card_refs(src.chain.attack_action_card_refs),
attack_action_card_ref_count(src.chain.attack_action_card_ref_count),
attack_medium(src.chain.attack_medium),
target_card_ref_count(src.chain.target_card_ref_count),
action_subphase(src.chain.action_subphase),
strike_count(src.chain.strike_count),
damage_multiplier(src.chain.damage_multiplier),
attack_number(src.chain.attack_number),
tp_effect_bonus(src.chain.tp_effect_bonus),
physical_attack_bonus_nte(src.chain.physical_attack_bonus_nte),
tech_attack_bonus_nte(src.chain.tech_attack_bonus_nte),
card_ap(src.chain.card_ap),
card_tp(src.chain.card_tp),
flags(src.chain.flags),
conditions(src.conditions),
target_card_refs(src.chain.target_card_refs) {}
ActionChainWithCondsTrial::operator ActionChainWithConds() const {
ActionChainWithConds ret;
ret.chain.effective_ap = this->effective_ap;
ret.chain.effective_tp = this->effective_tp;
ret.chain.ap_effect_bonus = this->ap_effect_bonus;
ret.chain.damage = this->damage;
ret.chain.acting_card_ref = this->acting_card_ref;
ret.chain.unknown_card_ref_a3 = this->unknown_card_ref_a3;
ret.chain.attack_action_card_refs = this->attack_action_card_refs;
ret.chain.attack_action_card_ref_count = this->attack_action_card_ref_count;
ret.chain.attack_medium = this->attack_medium;
ret.chain.target_card_ref_count = this->target_card_ref_count;
ret.chain.action_subphase = this->action_subphase;
ret.chain.strike_count = this->strike_count;
ret.chain.damage_multiplier = this->damage_multiplier;
ret.chain.attack_number = this->attack_number;
ret.chain.tp_effect_bonus = this->tp_effect_bonus;
ret.chain.physical_attack_bonus_nte = this->physical_attack_bonus_nte;
ret.chain.tech_attack_bonus_nte = this->tech_attack_bonus_nte;
ret.chain.card_ap = this->card_ap;
ret.chain.card_tp = this->card_tp;
ret.chain.flags = this->flags;
ret.chain.target_card_refs = this->target_card_refs;
ret.conditions = this->conditions;
return ret;
}
ActionMetadata::ActionMetadata() {
this->clear();
}
@@ -502,19 +575,20 @@ bool ActionMetadata::operator!=(const ActionMetadata& other) const {
return !this->operator==(other);
}
std::string ActionMetadata::str() const {
string target_card_refs_s = string_for_refs(this->target_card_refs);
string defense_card_refs_s = string_for_refs(this->defense_card_refs);
string original_attacker_card_refs_s = string_for_refs(this->original_attacker_card_refs);
std::string ActionMetadata::str(shared_ptr<const Server> s) const {
string card_ref_s = s->debug_str_for_card_ref(this->card_ref);
string target_card_refs_s = s->debug_str_for_card_refs(this->target_card_refs);
string defense_card_refs_s = s->debug_str_for_card_refs(this->defense_card_refs);
string original_attacker_card_refs_s = s->debug_str_for_card_refs(this->original_attacker_card_refs);
return string_printf(
"ActionMetadata[ref=@%04hX, target_ref_count=%hhu, def_ref_count=%hhu, "
"ActionMetadata[ref=%s, target_ref_count=%hhu, def_ref_count=%hhu, "
"subphase=%s, def_power=%hhd, def_bonus=%hhd, "
"att_bonus=%hhd, flags=%08" PRIX32 ", target_refs=%s, "
"defense_refs=%s, original_attacker_refs=%s]",
this->card_ref.load(),
card_ref_s.c_str(),
this->target_card_ref_count,
this->defense_card_ref_count,
name_for_action_subphase(this->action_subphase),
name_for_enum(this->action_subphase),
this->defense_power,
this->defense_bonus,
this->attack_bonus,
@@ -531,6 +605,8 @@ void ActionMetadata::clear() {
this->action_subphase = ActionSubphase::INVALID_FF;
this->defense_power = 0;
this->defense_bonus = 0;
// TODO: Ep3 NTE doesn't set attack_bonus to zero here. Is the field just
// unused in NTE?
this->attack_bonus = 0;
this->flags = 0;
this->target_card_refs.clear(0xFFFF);
@@ -598,20 +674,22 @@ HandAndEquipState::HandAndEquipState() {
this->clear();
}
std::string HandAndEquipState::str() const {
string hand_card_refs_s = string_for_refs(this->hand_card_refs);
string set_card_refs_s = string_for_refs(this->set_card_refs);
string hand_card_refs2_s = string_for_refs(this->hand_card_refs2);
string set_card_refs2_s = string_for_refs(this->set_card_refs2);
std::string HandAndEquipState::str(shared_ptr<const Server> s) const {
string assist_card_ref_s = s->debug_str_for_card_ref(this->assist_card_ref);
string assist_card_ref2_s = s->debug_str_for_card_ref(this->assist_card_ref2);
string assist_card_id_s = s->debug_str_for_card_id(this->assist_card_id);
string sc_card_ref_s = s->debug_str_for_card_ref(this->sc_card_ref);
string hand_card_refs_s = s->debug_str_for_card_refs(this->hand_card_refs);
string set_card_refs_s = s->debug_str_for_card_refs(this->set_card_refs);
string hand_card_refs2_s = s->debug_str_for_card_refs(this->hand_card_refs2);
string set_card_refs2_s = s->debug_str_for_card_refs(this->set_card_refs2);
return string_printf(
"HandAndEquipState[dice=[%hhu, %hhu], atk=%hhu, def=%hhu, atk2=%hhu, "
"a1=%hhu, total_set_cost=%hhu, is_cpu=%hhu, "
"assist_flags=%08" PRIX32 ", hand_refs=%s, "
"assist_ref=@%04hX, set_refs=%s, sc_ref=@%04hX, "
"hand_refs2=%s, set_refs2=%s, assist_ref2=@%04hX, "
"assist_set_num=%hu, assist_card_id=#%04hX, "
"assist_turns=%hhu, assit_dely=%hhu, atk_bonus=%hhu, "
"def_bonus=%hhu, u2=[%hhu, %hhu]]",
"a1=%hhu, total_set_cost=%hhu, is_cpu=%hhu, assist_flags=%08" PRIX32 ", "
"hand_refs=%s, assist_ref=%s, set_refs=%s, sc_ref=%s, hand_refs2=%s, "
"set_refs2=%s, assist_ref2=%s, assist_set_num=%hu, assist_card_id=%s, "
"assist_turns=%hhu, assist_delay=%hhu, atk_bonus=%hhu, def_bonus=%hhu, "
"u2=[%hhu, %hhu]]",
this->dice_results[0],
this->dice_results[1],
this->atk_points,
@@ -622,14 +700,14 @@ std::string HandAndEquipState::str() const {
this->is_cpu_player,
this->assist_flags.load(),
hand_card_refs_s.c_str(),
this->assist_card_ref.load(),
assist_card_ref_s.c_str(),
set_card_refs_s.c_str(),
this->sc_card_ref.load(),
sc_card_ref_s.c_str(),
hand_card_refs2_s.c_str(),
set_card_refs2_s.c_str(),
this->assist_card_ref2.load(),
assist_card_ref2_s.c_str(),
this->assist_card_set_number.load(),
this->assist_card_id.load(),
assist_card_id_s.c_str(),
this->assist_remaining_turns,
this->assist_delay_turns,
this->atk_bonuses,
@@ -759,6 +837,23 @@ const char* PlayerBattleStats::name_for_rank(uint8_t rank) {
return RANK_NAMES[rank];
}
PlayerBattleStatsTrial::PlayerBattleStatsTrial(const PlayerBattleStats& data)
: damage_given(data.damage_given.load()),
damage_taken(data.damage_taken.load()),
num_opponent_cards_destroyed(data.num_opponent_cards_destroyed.load()),
num_owned_cards_destroyed(data.num_owned_cards_destroyed.load()),
total_move_distance(data.total_move_distance.load()) {}
PlayerBattleStatsTrial::operator PlayerBattleStats() const {
PlayerBattleStats ret;
ret.damage_given = this->damage_given.load();
ret.damage_taken = this->damage_taken.load();
ret.num_opponent_cards_destroyed = this->num_opponent_cards_destroyed.load();
ret.num_owned_cards_destroyed = this->num_owned_cards_destroyed.load();
ret.total_move_distance = this->total_move_distance.load();
return ret;
}
static bool is_card_within_range(
const parray<uint8_t, 9 * 9>& range,
const Location& anchor_loc,
+183 -124
View File
@@ -13,19 +13,20 @@ class Server;
class Card;
struct Condition {
ConditionType type;
uint8_t remaining_turns;
int8_t a_arg_value;
uint8_t dice_roll_value;
uint8_t flags;
uint8_t card_definition_effect_index;
le_uint16_t card_ref;
le_int16_t value;
le_uint16_t condition_giver_card_ref;
uint8_t random_percent;
int8_t value8;
uint8_t order;
uint8_t unknown_a8;
/* 00 */ ConditionType type;
/* 01 */ uint8_t remaining_turns;
/* 02 */ int8_t a_arg_value;
/* 03 */ uint8_t dice_roll_value;
/* 04 */ uint8_t flags;
/* 05 */ uint8_t card_definition_effect_index;
/* 06 */ le_uint16_t card_ref;
/* 08 */ le_int16_t value;
/* 0A */ le_uint16_t condition_giver_card_ref;
/* 0C */ uint8_t random_percent;
/* 0D */ int8_t value8;
/* 0E */ uint8_t order;
/* 0F */ uint8_t unknown_a8;
/* 10 */
Condition();
bool operator==(const Condition& other) const;
@@ -34,38 +35,40 @@ struct Condition {
void clear();
void clear_FF();
std::string str() const;
std::string str(std::shared_ptr<const Server> s) const;
} __attribute__((packed));
struct EffectResult {
le_uint16_t attacker_card_ref;
le_uint16_t target_card_ref;
int8_t value;
int8_t current_hp;
int8_t ap;
int8_t tp;
uint8_t flags;
int8_t operation; // May be a negative condition number
uint8_t condition_index;
uint8_t dice_roll_value;
/* 00 */ le_uint16_t attacker_card_ref;
/* 02 */ le_uint16_t target_card_ref;
/* 04 */ int8_t value;
/* 05 */ int8_t current_hp;
/* 06 */ int8_t ap;
/* 07 */ int8_t tp;
/* 08 */ uint8_t flags;
/* 09 */ int8_t operation; // May be a negative condition number
/* 0A */ uint8_t condition_index;
/* 0B */ uint8_t dice_roll_value;
/* 0C */
EffectResult();
bool operator==(const EffectResult& other) const;
bool operator!=(const EffectResult& other) const;
std::string str() const;
void clear();
std::string str(std::shared_ptr<const Server> s) const;
} __attribute__((packed));
struct CardShortStatus {
le_uint16_t card_ref;
le_uint16_t current_hp;
le_uint32_t card_flags;
Location loc;
le_uint16_t unused1;
int8_t max_hp;
uint8_t unused2;
/* 00 */ le_uint16_t card_ref;
/* 02 */ le_uint16_t current_hp;
/* 04 */ le_uint32_t card_flags;
/* 08 */ Location loc;
/* 0C */ le_uint16_t unused1;
/* 0E */ int8_t max_hp;
/* 0F */ uint8_t unused2;
/* 10 */
CardShortStatus();
bool operator==(const CardShortStatus& other) const;
@@ -74,18 +77,20 @@ struct CardShortStatus {
void clear();
void clear_FF();
std::string str() const;
std::string str(std::shared_ptr<const Server> s) const;
} __attribute__((packed));
struct ActionState {
le_uint16_t client_id;
uint8_t unused;
Direction facing_direction;
le_uint16_t attacker_card_ref;
le_uint16_t defense_card_ref;
parray<le_uint16_t, 4 * 9> target_card_refs;
parray<le_uint16_t, 9> action_card_refs;
le_uint16_t original_attacker_card_ref;
/* 00 */ le_uint16_t client_id;
/* 02 */ uint8_t unused;
/* 03 */ Direction facing_direction;
/* 04 */ le_uint16_t attacker_card_ref;
/* 06 */ le_uint16_t defense_card_ref;
/* 08 */ parray<le_uint16_t, 4 * 9> target_card_refs;
/* 50 */ parray<le_uint16_t, 8> action_card_refs;
/* 60 */ le_uint16_t unused2;
/* 62 */ le_uint16_t original_attacker_card_ref;
/* 64 */
ActionState();
bool operator==(const ActionState& other) const;
@@ -93,31 +98,34 @@ struct ActionState {
void clear();
std::string str() const;
std::string str(std::shared_ptr<const Server> s) const;
} __attribute__((packed));
struct ActionChain {
int8_t effective_ap;
int8_t effective_tp;
int8_t ap_effect_bonus;
int8_t damage;
le_uint16_t acting_card_ref;
le_uint16_t unknown_card_ref_a3;
parray<le_uint16_t, 8> attack_action_card_refs;
uint8_t attack_action_card_ref_count;
AttackMedium attack_medium;
uint8_t target_card_ref_count;
ActionSubphase action_subphase;
uint8_t strike_count;
int8_t damage_multiplier;
uint8_t attack_number;
int8_t tp_effect_bonus;
uint8_t unused1;
uint8_t unused2;
int8_t card_ap;
int8_t card_tp;
le_uint32_t flags;
parray<le_uint16_t, 4 * 9> target_card_refs;
// Note: Episode 3 Trial Edition has a different format for this structure.
// See ActionChainWithCondsTrial for details.
/* 00 */ int8_t effective_ap;
/* 01 */ int8_t effective_tp;
/* 02 */ int8_t ap_effect_bonus;
/* 03 */ int8_t damage;
/* 04 */ le_uint16_t acting_card_ref;
/* 06 */ le_uint16_t unknown_card_ref_a3;
/* 08 */ parray<le_uint16_t, 8> attack_action_card_refs;
/* 18 */ uint8_t attack_action_card_ref_count;
/* 19 */ AttackMedium attack_medium;
/* 1A */ uint8_t target_card_ref_count;
/* 1B */ ActionSubphase action_subphase;
/* 1C */ uint8_t strike_count;
/* 1D */ int8_t damage_multiplier;
/* 1E */ uint8_t attack_number;
/* 1F */ int8_t tp_effect_bonus;
/* 20 */ int8_t physical_attack_bonus_nte;
/* 21 */ int8_t tech_attack_bonus_nte;
/* 22 */ int8_t card_ap;
/* 23 */ int8_t card_tp;
/* 24 */ le_uint32_t flags;
/* 28 */ parray<le_uint16_t, 4 * 9> target_card_refs;
/* 70 */
ActionChain();
bool operator==(const ActionChain& other) const;
@@ -126,12 +134,13 @@ struct ActionChain {
void clear();
void clear_FF();
std::string str() const;
std::string str(std::shared_ptr<const Server> s) const;
} __attribute__((packed));
struct ActionChainWithConds {
ActionChain chain;
parray<Condition, 9> conditions;
/* 0000 */ ActionChain chain;
/* 0070 */ parray<Condition, 9> conditions;
/* 0100 */
ActionChainWithConds();
bool operator==(const ActionChainWithConds& other) const;
@@ -161,28 +170,61 @@ struct ActionChainWithConds {
void set_action_subphase_from_card(std::shared_ptr<const Card> card);
bool can_apply_attack() const;
std::string str() const;
uint8_t get_adjusted_move_ability_nte(uint8_t ability) const;
std::string str(std::shared_ptr<const Server> s) const;
} __attribute__((packed));
struct ActionChainWithCondsTrial {
/* 0000 */ int8_t effective_ap;
/* 0001 */ int8_t effective_tp;
/* 0002 */ int8_t ap_effect_bonus;
/* 0003 */ int8_t damage;
/* 0004 */ le_uint16_t acting_card_ref;
/* 0006 */ le_uint16_t unknown_card_ref_a3;
/* 0008 */ parray<le_uint16_t, 8> attack_action_card_refs;
/* 0018 */ uint8_t attack_action_card_ref_count;
/* 0019 */ AttackMedium attack_medium;
/* 001A */ uint8_t target_card_ref_count;
/* 001B */ ActionSubphase action_subphase;
/* 001C */ uint8_t strike_count;
/* 001D */ int8_t damage_multiplier;
/* 001E */ uint8_t attack_number;
/* 001F */ int8_t tp_effect_bonus;
/* 0020 */ int8_t physical_attack_bonus_nte;
/* 0021 */ int8_t tech_attack_bonus_nte;
/* 0022 */ int8_t card_ap;
/* 0023 */ int8_t card_tp;
/* 0024 */ le_uint32_t flags;
// The only difference between this structure and ActionChainWithConds is that
// these two fields are in the opposite order.
/* 0028 */ parray<Condition, 9> conditions;
/* 00B8 */ parray<le_uint16_t, 4 * 9> target_card_refs;
/* 0100 */
ActionChainWithCondsTrial() = default;
ActionChainWithCondsTrial(const ActionChainWithConds& src);
operator ActionChainWithConds() const;
} __attribute__((packed));
struct ActionMetadata {
le_uint16_t card_ref;
uint8_t target_card_ref_count;
uint8_t defense_card_ref_count;
ActionSubphase action_subphase;
int8_t defense_power;
int8_t defense_bonus;
int8_t attack_bonus;
le_uint32_t flags;
parray<le_uint16_t, 4 * 9> target_card_refs;
parray<le_uint16_t, 8> defense_card_refs;
parray<le_uint16_t, 8> original_attacker_card_refs;
/* 00 */ le_uint16_t card_ref;
/* 02 */ uint8_t target_card_ref_count;
/* 03 */ uint8_t defense_card_ref_count;
/* 04 */ ActionSubphase action_subphase;
/* 05 */ int8_t defense_power;
/* 06 */ int8_t defense_bonus;
/* 07 */ int8_t attack_bonus;
/* 08 */ le_uint32_t flags;
/* 0C */ parray<le_uint16_t, 4 * 9> target_card_refs;
/* 54 */ parray<le_uint16_t, 8> defense_card_refs;
/* 64 */ parray<le_uint16_t, 8> original_attacker_card_refs;
/* 74 */
ActionMetadata();
bool operator==(const ActionMetadata& other) const;
bool operator!=(const ActionMetadata& other) const;
std::string str() const;
void clear();
void clear_FF();
@@ -197,31 +239,34 @@ struct ActionMetadata {
uint16_t defense_card_ref,
std::shared_ptr<Card> card,
uint16_t original_attacker_card_ref);
std::string str(std::shared_ptr<const Server> s) const;
} __attribute__((packed));
struct HandAndEquipState {
parray<uint8_t, 2> dice_results;
uint8_t atk_points;
uint8_t def_points;
uint8_t atk_points2; // TODO: rename this to something more appropriate
uint8_t unknown_a1;
uint8_t total_set_cards_cost;
uint8_t is_cpu_player;
le_uint32_t assist_flags;
parray<le_uint16_t, 6> hand_card_refs;
le_uint16_t assist_card_ref;
parray<le_uint16_t, 8> set_card_refs;
le_uint16_t sc_card_ref;
parray<le_uint16_t, 6> hand_card_refs2;
parray<le_uint16_t, 8> set_card_refs2;
le_uint16_t assist_card_ref2;
le_uint16_t assist_card_set_number;
le_uint16_t assist_card_id;
uint8_t assist_remaining_turns;
uint8_t assist_delay_turns;
uint8_t atk_bonuses;
uint8_t def_bonuses;
parray<uint8_t, 2> unused2;
/* 00 */ parray<uint8_t, 2> dice_results;
/* 02 */ uint8_t atk_points;
/* 03 */ uint8_t def_points;
/* 04 */ uint8_t atk_points2; // TODO: rename this to something more appropriate
/* 05 */ uint8_t unknown_a1;
/* 06 */ uint8_t total_set_cards_cost;
/* 07 */ uint8_t is_cpu_player;
/* 08 */ le_uint32_t assist_flags;
/* 0C */ parray<le_uint16_t, 6> hand_card_refs;
/* 18 */ le_uint16_t assist_card_ref;
/* 1A */ parray<le_uint16_t, 8> set_card_refs;
/* 2A */ le_uint16_t sc_card_ref;
/* 2C */ parray<le_uint16_t, 6> hand_card_refs2;
/* 38 */ parray<le_uint16_t, 8> set_card_refs2;
/* 48 */ le_uint16_t assist_card_ref2;
/* 4A */ le_uint16_t assist_card_set_number;
/* 4C */ le_uint16_t assist_card_id;
/* 4E */ uint8_t assist_remaining_turns;
/* 4F */ uint8_t assist_delay_turns;
/* 50 */ uint8_t atk_bonuses;
/* 51 */ uint8_t def_bonuses;
/* 52 */ parray<uint8_t, 2> unused2;
/* 54 */
HandAndEquipState();
bool operator==(const HandAndEquipState& other) const;
@@ -230,30 +275,31 @@ struct HandAndEquipState {
void clear();
void clear_FF();
std::string str() const;
std::string str(std::shared_ptr<const Server> s) const;
} __attribute__((packed));
struct PlayerBattleStats {
le_uint16_t damage_given;
le_uint16_t damage_taken;
le_uint16_t num_opponent_cards_destroyed;
le_uint16_t num_owned_cards_destroyed;
le_uint16_t total_move_distance;
le_uint16_t num_cards_set;
le_uint16_t num_item_or_creature_cards_set;
le_uint16_t num_attack_actions_set;
le_uint16_t num_tech_cards_set;
le_uint16_t num_assist_cards_set;
le_uint16_t defense_actions_set_on_self;
le_uint16_t defense_actions_set_on_ally;
le_uint16_t num_cards_drawn;
le_uint16_t max_attack_damage;
le_uint16_t max_attack_combo_size;
le_uint16_t num_attacks_given;
le_uint16_t num_attacks_taken;
le_uint16_t sc_damage_taken;
le_uint16_t action_card_negated_damage;
le_uint16_t unused;
/* 00 */ le_uint16_t damage_given;
/* 02 */ le_uint16_t damage_taken;
/* 04 */ le_uint16_t num_opponent_cards_destroyed;
/* 06 */ le_uint16_t num_owned_cards_destroyed;
/* 08 */ le_uint16_t total_move_distance;
/* 0A */ le_uint16_t num_cards_set;
/* 0C */ le_uint16_t num_item_or_creature_cards_set;
/* 0E */ le_uint16_t num_attack_actions_set;
/* 10 */ le_uint16_t num_tech_cards_set;
/* 12 */ le_uint16_t num_assist_cards_set;
/* 14 */ le_uint16_t defense_actions_set_on_self;
/* 16 */ le_uint16_t defense_actions_set_on_ally;
/* 18 */ le_uint16_t num_cards_drawn;
/* 1A */ le_uint16_t max_attack_damage;
/* 1C */ le_uint16_t max_attack_combo_size;
/* 1E */ le_uint16_t num_attacks_given;
/* 20 */ le_uint16_t num_attacks_taken;
/* 22 */ le_uint16_t sc_damage_taken;
/* 24 */ le_uint16_t action_card_negated_damage;
/* 26 */ le_uint16_t unused;
/* 28 */
PlayerBattleStats();
void clear();
@@ -266,6 +312,19 @@ struct PlayerBattleStats {
static const char* name_for_rank(uint8_t rank);
} __attribute__((packed));
struct PlayerBattleStatsTrial {
/* 00 */ le_uint32_t damage_given = 0;
/* 04 */ le_uint32_t damage_taken = 0;
/* 08 */ le_uint32_t num_opponent_cards_destroyed = 0;
/* 0C */ le_uint32_t num_owned_cards_destroyed = 0;
/* 10 */ le_uint32_t total_move_distance = 0;
/* 14 */
PlayerBattleStatsTrial() = default;
PlayerBattleStatsTrial(const PlayerBattleStats& data);
operator PlayerBattleStats() const;
} __attribute__((packed));
std::vector<uint16_t> get_card_refs_within_range(
const parray<uint8_t, 9 * 9>& range,
const Location& loc,
+270 -155
View File
@@ -1,5 +1,7 @@
#include "RulerServer.hh"
#include <optional>
#include "Server.hh"
using namespace std;
@@ -204,6 +206,8 @@ const ActionChainWithConds* RulerServer::action_chain_with_conds_for_card_ref(
uint16_t card_ref) const {
uint8_t client_id = client_id_for_card_ref(card_ref);
if (client_id != 0xFF) {
// There appears to be a bug in Trial Edition: the bound on this loop is
// 0x10, not 9.
for (size_t z = 0; z < 9; z++) {
const auto* chain = &this->set_card_action_chains[client_id]->at(z);
if (card_ref == chain->chain.acting_card_ref) {
@@ -235,19 +239,25 @@ bool RulerServer::card_has_pierce_or_rampage(
uint16_t action_card_ref,
uint8_t def_effect_index,
AttackMedium attack_medium) const {
auto short_statuses = (client_id != 0xFF) ? this->short_statuses[client_id] : nullptr;
auto short_statuses = (client_id < 4) ? this->short_statuses[client_id] : nullptr;
*out_has_rampage = false;
if (cond_type == ConditionType::NONE) {
return false;
bool ret;
bool is_nte = this->server()->options.is_nte();
if (is_nte) {
ret = true;
} else {
if (cond_type == ConditionType::NONE) {
return false;
}
ret = this->check_usability_or_apply_condition_for_card_refs(
action_card_ref,
attacker_card_ref,
// Original code omitted this null check and presumably could crash here
short_statuses ? short_statuses->at(0).card_ref.load() : 0xFFFF,
def_effect_index,
attack_medium);
}
bool ret = this->check_usability_or_apply_condition_for_card_refs(
action_card_ref,
attacker_card_ref,
// Original code omitted this null check and presumably could crash here
short_statuses ? short_statuses->at(0).card_ref.load() : 0xFFFF,
def_effect_index,
attack_medium);
switch (cond_type) {
case ConditionType::RAMPAGE:
@@ -280,7 +290,10 @@ bool RulerServer::card_has_pierce_or_rampage(
if (short_statuses) {
const auto& sc_status = short_statuses->at(0);
auto ce = this->definition_for_card_ref(sc_status.card_ref);
if (ce && (this->get_card_ref_max_hp(sc_status.card_ref) <= sc_status.current_hp * 2)) {
// This appears to be an NTE bug: Major Pierce doesn't work on Arkz SCs.
if (ce &&
(!is_nte || (ce->def.type == CardType::HUNTERS_SC)) &&
(this->get_card_ref_max_hp(sc_status.card_ref) <= sc_status.current_hp * 2)) {
return ret;
}
}
@@ -290,8 +303,7 @@ bool RulerServer::card_has_pierce_or_rampage(
}
}
bool RulerServer::attack_action_has_rampage_and_not_pierce(
const ActionState& pa, uint16_t card_ref) const {
bool RulerServer::attack_action_has_rampage_and_not_pierce(const ActionState& pa, uint16_t card_ref) const {
uint16_t orig_card_ref;
uint16_t effective_range_card_id;
TargetMode effective_target_mode;
@@ -365,15 +377,15 @@ bool RulerServer::attack_action_has_rampage_and_not_pierce(
return false;
}
bool RulerServer::attack_action_has_pierce_and_not_rampage(
const ActionState& pa, uint8_t client_id) {
if ((client_id_for_card_ref(pa.attacker_card_ref) == 0xFF) || (client_id == 0xFF)) {
bool RulerServer::attack_action_has_pierce_and_not_rampage(const ActionState& pa, uint8_t client_id) const {
if ((client_id_for_card_ref(pa.attacker_card_ref) == 0xFF) || (client_id >= 4)) {
return false;
}
bool is_nte = this->server()->options.is_nte();
auto attack_medium = this->get_attack_medium(pa);
auto stat = this->short_statuses[client_id];
if (!stat || !this->card_exists_by_status(stat->at(0)) || (stat->at(0).card_ref == 0xFFFF)) {
if (!stat || (!is_nte && !this->card_exists_by_status(stat->at(0))) || (stat->at(0).card_ref == 0xFFFF)) {
return false;
}
@@ -392,6 +404,33 @@ bool RulerServer::attack_action_has_pierce_and_not_rampage(
last_action_card_index = z;
}
auto check_chain = [&]() -> optional<bool> {
const auto* chain = this->action_chain_with_conds_for_card_ref(pa.attacker_card_ref);
if (chain) {
for (ssize_t cond_index = 8; cond_index >= 0; cond_index--) {
bool has_rampage = false;
if (this->card_has_pierce_or_rampage(
client_id, chain->conditions[cond_index].type, &has_rampage,
pa.attacker_card_ref, chain->conditions[cond_index].card_ref,
chain->conditions[cond_index].card_definition_effect_index,
attack_medium)) {
return true;
}
if (has_rampage) {
return false;
}
}
}
return nullopt;
};
if (is_nte) {
auto res = check_chain();
if (res.has_value()) {
return res.value();
}
}
for (; last_action_card_index >= 0; last_action_card_index--) {
auto ce = this->definition_for_card_ref(
pa.action_card_refs[last_action_card_index]);
@@ -418,20 +457,10 @@ bool RulerServer::attack_action_has_pierce_and_not_rampage(
}
}
const auto* chain = this->action_chain_with_conds_for_card_ref(pa.attacker_card_ref);
if (chain) {
for (ssize_t cond_index = 8; cond_index >= 0; cond_index--) {
bool has_rampage = false;
if (this->card_has_pierce_or_rampage(
client_id, chain->conditions[cond_index].type, &has_rampage,
pa.attacker_card_ref, chain->conditions[cond_index].card_ref,
chain->conditions[cond_index].card_definition_effect_index,
attack_medium)) {
return true;
}
if (has_rampage) {
return false;
}
if (!is_nte) {
auto res = check_chain();
if (res.has_value()) {
return res.value();
}
}
@@ -634,9 +663,11 @@ bool RulerServer::card_ref_has_free_maneuver(uint16_t card_ref) const {
}
bool RulerServer::card_ref_is_aerial(uint16_t card_ref) const {
const auto* stat = this->short_status_for_card_ref(card_ref);
if (!stat || !this->card_exists_by_status(*stat)) {
return false;
if (!this->server()->options.is_nte()) {
const auto* stat = this->short_status_for_card_ref(card_ref);
if (!stat || !this->card_exists_by_status(*stat)) {
return false;
}
}
uint8_t client_id = client_id_for_card_ref(card_ref);
@@ -791,10 +822,13 @@ bool RulerServer::check_pierce_and_rampage(
uint16_t action_card_ref,
uint8_t def_effect_index,
AttackMedium attack_medium) const {
bool is_nte = this->server()->options.is_nte();
// Note: NTE doesn't set this to zero; it apparently expects the caller to.
*out_has_pierce = false;
const auto* card_short_status = this->short_status_for_card_ref(card_ref);
if (cond_type == ConditionType::NONE) {
if (!is_nte && (cond_type == ConditionType::NONE)) {
return false;
}
@@ -816,8 +850,9 @@ bool RulerServer::check_pierce_and_rampage(
client_short_statuses = nullptr;
}
bool apply_check_result = this->check_usability_or_apply_condition_for_card_refs(
action_card_ref, attacker_card_ref, card_ref, def_effect_index, attack_medium);
bool apply_check_result = (is_nte ||
this->check_usability_or_apply_condition_for_card_refs(
action_card_ref, attacker_card_ref, card_ref, def_effect_index, attack_medium));
switch (cond_type) {
case ConditionType::PIERCE:
@@ -903,7 +938,9 @@ bool RulerServer::check_usability_or_condition_apply(
uint8_t def_effect_index,
bool is_item_usability_check,
AttackMedium attack_medium) const {
auto log = this->server()->log_stack(string_printf("check_usability_or_condition_apply(%02hhX, #%04hX, %02hhX, #%04hX, #%04hX, %02hhX, %s, %s): ", client_id1, card_id1, client_id2, card_id2, card_id3, def_effect_index, is_item_usability_check ? "true" : "false", name_for_attack_medium(attack_medium)));
auto s = this->server();
bool is_nte = s->options.is_nte();
auto log = s->log_stack(string_printf("check_usability_or_condition_apply(%02hhX, #%04hX, %02hhX, #%04hX, #%04hX, %02hhX, %s, %s): ", client_id1, card_id1, client_id2, card_id2, card_id3, def_effect_index, is_item_usability_check ? "true" : "false", name_for_enum(attack_medium)));
if (static_cast<uint8_t>(attack_medium) & 0x80) {
attack_medium = AttackMedium::UNKNOWN;
@@ -916,7 +953,7 @@ bool RulerServer::check_usability_or_condition_apply(
log.debug("ce1 missing");
return false;
}
if ((ce1->def.type == CardType::ITEM) && this->card_id_is_boss_sc(card_id2)) {
if (!is_nte && (ce1->def.type == CardType::ITEM) && this->card_id_is_boss_sc(card_id2)) {
log.debug("ce1 is item and card_id2 is boss sc");
return false;
}
@@ -931,7 +968,7 @@ bool RulerServer::check_usability_or_condition_apply(
}
criterion_code = ce1->def.effects[def_effect_index].apply_criterion;
}
log.debug("criterion_code=%s", name_for_criterion_code(criterion_code));
log.debug("criterion_code=%s", name_for_enum(criterion_code));
// For item usability checks, prevent criteria that depend on player
// positioning/team setup
@@ -952,8 +989,8 @@ bool RulerServer::check_usability_or_condition_apply(
// creature card is usable, the two client IDs should be the same or the
// second should not be given, so we'd return true if the criterion passes. If
// neither of these cases apply, we should return false as a failsafe even if
// the criterion passes.
bool ret = (!(def_effect_index & 0x80) || (client_id1 == client_id2)) || (client_id2 == 0xFF);
// the criterion passes. NTE did not have such a check.
bool ret = is_nte || (!(def_effect_index & 0x80) || (client_id1 == client_id2)) || (client_id2 == 0xFF);
switch (criterion_code) {
case CriterionCode::NONE:
return ret;
@@ -1361,6 +1398,7 @@ uint16_t RulerServer::compute_attack_or_defense_costs(
cost_bias++;
}
bool is_nte = this->server()->options.is_nte();
if (pa.action_card_refs[0] == 0xFFFF) {
total_cost = cost_bias + 1;
} else {
@@ -1369,26 +1407,29 @@ uint16_t RulerServer::compute_attack_or_defense_costs(
tech_cost_bias = -1;
}
auto s = this->server();
for (size_t z = 0; pa.action_card_refs[z] != 0xFFFF; z++) {
auto ce = this->definition_for_card_ref(pa.action_card_refs[z]);
if (has_mighty_knuckle || !ce || (ce->def.type != CardType::ACTION)) {
return 99;
}
total_cost += (ce->def.self_cost + cost_bias);
if (card_class_is_tech_like(ce->def.card_class())) {
if (card_class_is_tech_like(ce->def.card_class(), is_nte)) {
total_cost += tech_cost_bias;
}
total_ally_cost += ce->def.ally_cost;
if (this->card_has_mighty_knuckle(pa.action_card_refs[z])) {
has_mighty_knuckle = true;
}
size_t num_assists = this->assist_server->compute_num_assist_effects_for_client(pa.client_id);
for (size_t w = 0; w < num_assists; w++) {
auto assist_effect = this->assist_server->get_active_assist_by_index(w);
if (assist_effect == AssistEffect::INFLATION) {
assist_cost_bias++;
} else if (assist_effect == AssistEffect::DEFLATION) {
assist_cost_bias--;
if (!is_nte) {
size_t num_assists = this->assist_server->compute_num_assist_effects_for_client(pa.client_id);
for (size_t w = 0; w < num_assists; w++) {
auto assist_effect = this->assist_server->get_active_assist_by_index(w);
if (assist_effect == AssistEffect::INFLATION) {
assist_cost_bias++;
} else if (assist_effect == AssistEffect::DEFLATION) {
assist_cost_bias--;
}
}
}
}
@@ -1397,8 +1438,11 @@ uint16_t RulerServer::compute_attack_or_defense_costs(
size_t num_assists = this->assist_server->compute_num_assist_effects_for_client(pa.client_id);
for (size_t w = 0; w < num_assists; w++) {
auto assist_effect = this->assist_server->get_active_assist_by_index(w);
if ((assist_effect == AssistEffect::BATTLE_ROYALE) &&
(pa.action_card_refs[0] == 0xFFFF)) {
if (is_nte && (assist_effect == AssistEffect::INFLATION)) {
assist_cost_bias++;
} else if (is_nte && (assist_effect == AssistEffect::DEFLATION)) {
assist_cost_bias--;
} else if ((assist_effect == AssistEffect::BATTLE_ROYALE) && (pa.action_card_refs[0] == 0xFFFF)) {
total_cost = 0;
final_cost = 0;
}
@@ -1406,7 +1450,9 @@ uint16_t RulerServer::compute_attack_or_defense_costs(
if (has_mighty_knuckle) {
if (!allow_mighty_knuckle) {
final_cost = 0;
if (!is_nte) {
final_cost = 0;
}
} else {
final_cost = max<int16_t>(final_cost, this->hand_and_equip_states[pa.client_id]->atk_points);
}
@@ -1424,9 +1470,9 @@ bool RulerServer::compute_effective_range_and_target_mode_for_attack(
TargetMode* out_effective_target_mode,
uint16_t* out_orig_card_ref) const {
size_t z;
for (z = 0; (z < 9) && (pa.action_card_refs[z] != 0xFFFF); z++) {
for (z = 0; (z < 8) && (pa.action_card_refs[z] != 0xFFFF); z++) {
}
if (z >= 9) {
if (z >= 8) {
return false;
}
uint16_t card_ref = (z == 0) ? pa.attacker_card_ref : pa.action_card_refs[z - 1];
@@ -1449,9 +1495,11 @@ bool RulerServer::compute_effective_range_and_target_mode_for_attack(
auto target_mode = ce->def.target_mode;
if (this->card_ref_or_sc_has_fixed_range(pa.attacker_card_ref)) {
card_id = this->card_id_for_card_ref(pa.attacker_card_ref);
auto sc_ce = this->definition_for_card_id(card_id);
if (sc_ce && (static_cast<uint8_t>(target_mode) < 6)) {
target_mode = sc_ce->def.target_mode;
if (!this->server()->options.is_nte()) {
auto sc_ce = this->definition_for_card_id(card_id);
if (sc_ce && (static_cast<uint8_t>(target_mode) < 6)) {
target_mode = sc_ce->def.target_mode;
}
}
}
@@ -1474,8 +1522,7 @@ bool RulerServer::compute_effective_range_and_target_mode_for_attack(
return true;
}
size_t RulerServer::count_rampage_targets_for_attack(
const ActionState& pa, uint8_t client_id) const {
size_t RulerServer::count_rampage_targets_for_attack(const ActionState& pa, uint8_t client_id) const {
if (client_id == 0xFF) {
return 0;
}
@@ -1583,8 +1630,7 @@ bool RulerServer::defense_card_can_apply_to_attack(
return true;
}
bool RulerServer::defense_card_matches_any_attack_card_top_color(
const ActionState& pa) const {
bool RulerServer::defense_card_matches_any_attack_card_top_color(const ActionState& pa) const {
auto ce = this->definition_for_card_ref(pa.action_card_refs[0]);
if (!ce) {
throw runtime_error("defense card definition is missing");
@@ -1632,7 +1678,8 @@ int32_t RulerServer::error_code_for_client_setting_card(
return -0x76;
}
if (!this->is_card_ref_in_hand(card_ref)) {
bool is_nte = this->server()->options.is_nte();
if (!is_nte && !this->is_card_ref_in_hand(card_ref)) {
return -0x5E;
}
@@ -1672,8 +1719,8 @@ int32_t RulerServer::error_code_for_client_setting_card(
}
// Check for assists that can only be set on yourself
auto eff = assist_effect_number_for_card_id(ce->def.card_id);
if (((eff == AssistEffect::LEGACY) || (eff == AssistEffect::EXCHANGE)) &&
auto eff = assist_effect_number_for_card_id(ce->def.card_id, is_nte);
if (((eff == AssistEffect::LEGACY) || (!is_nte && (eff == AssistEffect::EXCHANGE))) &&
(assist_target_client_id != 0xFF) &&
(assist_target_client_id != client_id_for_card_ref(card_ref))) {
return -0x75;
@@ -1712,8 +1759,8 @@ int32_t RulerServer::error_code_for_client_setting_card(
if ((ce->def.type == CardType::ITEM) || (ce->def.type == CardType::CREATURE)) {
int16_t existing_fcs_cost = 0;
bool limit_summoning_by_count = this->find_condition_on_card_ref(
short_statuses->at(0).card_ref, ConditionType::FC_LIMIT_BY_COUNT);
bool limit_summoning_by_count = !is_nte &&
this->find_condition_on_card_ref(short_statuses->at(0).card_ref, ConditionType::FC_LIMIT_BY_COUNT);
for (size_t z = 7; z < 15; z++) {
const auto& this_status = short_statuses->at(z);
if ((this_status.card_ref != 0xFFFF) && this->card_exists_by_status(this_status)) {
@@ -1752,71 +1799,91 @@ int32_t RulerServer::error_code_for_client_setting_card(
return 0;
}
Location summon_area_loc;
uint8_t summon_area_size;
if (!this->get_creature_summon_area(
client_id, &summon_area_loc, &summon_area_size)) {
if (team_id != 1) {
if ((loc->x > 0) && (loc->x < this->map_and_rules->map.width - 1)) {
if ((loc->y < this->map_and_rules->map.height - summon_cost - 1) &&
(loc->y > 0)) {
return 0;
if (is_nte) {
// It seems NTE assumes that teams always start on the same ends of the
// map; non-NTE removes this restriction.
if (team_id == 1) {
if (((loc->x < 1) ||
(loc->x >= this->map_and_rules->map.width - 1) ||
(loc->y < summon_cost + 1) ||
(loc->y >= this->map_and_rules->map.height - 1)) &&
(loc->y != this->map_and_rules->map.height - 2)) {
return -0x7E;
}
} else if (((loc->x < 1) ||
(loc->x >= this->map_and_rules->map.width - 1) ||
(loc->y < 1) ||
(loc->y >= this->map_and_rules->map.height - summon_cost - 1)) &&
(loc->y != 1)) {
return -0x7E;
}
} else {
Location summon_area_loc;
uint8_t summon_area_size;
if (!this->get_creature_summon_area(client_id, &summon_area_loc, &summon_area_size)) {
if (team_id != 1) {
if ((loc->x > 0) && (loc->x < this->map_and_rules->map.width - 1)) {
if ((loc->y < this->map_and_rules->map.height - summon_cost - 1) &&
(loc->y > 0)) {
return 0;
}
if (loc->y == 1) {
return 0;
}
}
if (loc->y == 1) {
return 0;
} else {
if ((loc->x > 0) &&
(loc->x < this->map_and_rules->map.width - 1)) {
if ((summon_cost + 1 <= loc->y) && (loc->y < this->map_and_rules->map.height - 1)) {
return 0;
}
if (loc->y == this->map_and_rules->map.height - 2) {
return 0;
}
}
}
return -0x7E;
}
int32_t x_offset, y_offset;
this->offsets_for_direction(summon_area_loc, &x_offset, &y_offset);
if (x_offset == 0) {
if ((loc->x < 1) && (loc->x >= this->map_and_rules->map.width - 1)) {
return -0x7E;
}
} else {
if ((loc->x > 0) &&
(loc->x < this->map_and_rules->map.width - 1)) {
if ((summon_cost + 1 <= loc->y) && (loc->y < this->map_and_rules->map.height - 1)) {
return 0;
int16_t diff = max<int16_t>(summon_area_size - summon_cost, 0);
if (x_offset > 0) {
if (loc->x < summon_area_loc.x) {
return -0x7E;
}
if (loc->y == this->map_and_rules->map.height - 2) {
return 0;
if (loc->x > summon_area_loc.x + diff) {
return -0x7E;
}
} else if (x_offset < 0) {
if ((loc->x > summon_area_loc.x) || (loc->x < summon_area_loc.x - diff)) {
return -0x7E;
}
}
}
return -0x7E;
}
int32_t x_offset, y_offset;
this->offsets_for_direction(summon_area_loc, &x_offset, &y_offset);
if (x_offset == 0) {
if ((loc->x < 1) && (loc->x >= this->map_and_rules->map.width - 1)) {
return -0x7E;
}
} else {
int16_t diff = max<int16_t>(summon_area_size - summon_cost, 0);
if (x_offset > 0) {
if (loc->x < summon_area_loc.x) {
if (y_offset == 0) {
if ((loc->y < 1) && (loc->y >= this->map_and_rules->map.height - 1)) {
return -0x7E;
}
if (loc->x > summon_area_loc.x + diff) {
return -0x7E;
}
} else if (x_offset < 0) {
if ((loc->x > summon_area_loc.x) || (loc->x < summon_area_loc.x - diff)) {
return -0x7E;
}
}
}
if (y_offset == 0) {
if ((loc->y < 1) && (loc->y >= this->map_and_rules->map.height - 1)) {
return -0x7E;
}
} else {
int16_t diff = max<int16_t>(summon_area_size - summon_cost, 0);
if (y_offset > 0) {
if (loc->y < summon_area_loc.y) {
return -0x7E;
}
if (loc->y > summon_area_loc.y + diff) {
return -0x7E;
}
} else if (y_offset < 0) {
if ((loc->y > summon_area_loc.y) || (loc->y < summon_area_loc.y - diff)) {
return -0x7E;
} else {
int16_t diff = max<int16_t>(summon_area_size - summon_cost, 0);
if (y_offset > 0) {
if (loc->y < summon_area_loc.y) {
return -0x7E;
}
if (loc->y > summon_area_loc.y + diff) {
return -0x7E;
}
} else if (y_offset < 0) {
if ((loc->y > summon_area_loc.y) || (loc->y < summon_area_loc.y - diff)) {
return -0x7E;
}
}
}
}
@@ -2020,7 +2087,7 @@ uint8_t RulerServer::get_card_ref_max_hp(uint16_t card_ref) const {
return 0;
} else if (((ce->def.type == CardType::HUNTERS_SC) || (ce->def.type == CardType::ARKZ_SC)) &&
(this->map_and_rules->rules.char_hp > 0) &&
!this->card_ref_is_boss_sc(card_ref)) {
(this->server()->options.is_nte() || !this->card_ref_is_boss_sc(card_ref))) {
return this->map_and_rules->rules.char_hp;
} else {
return ce->def.hp.stat;
@@ -2169,7 +2236,7 @@ bool RulerServer::is_attack_valid(const ActionState& pa) {
return false;
}
if (attacker_card_status->card_flags & 2) {
if (!this->server()->options.is_nte() && (attacker_card_status->card_flags & 2)) {
this->error_code3 = -0x60;
return false;
}
@@ -2206,7 +2273,7 @@ bool RulerServer::is_attack_valid(const ActionState& pa) {
size_t conditional_card_count = 0;
size_t z;
for (z = 0; z < 9; z++) {
for (z = 0; z < 8; z++) {
uint16_t right_card_ref = pa.action_card_refs[z];
if (right_card_ref == 0xFFFF) {
break;
@@ -2285,7 +2352,9 @@ bool RulerServer::is_attack_or_defense_valid(const ActionState& pa) {
return false;
}
int16_t cost = this->compute_attack_or_defense_costs(pa, false, nullptr);
// NTE apparently does not check the action's cost here
bool is_nte = this->server()->options.is_nte();
int16_t cost = is_nte ? 0 : this->compute_attack_or_defense_costs(pa, false, nullptr);
switch (this->get_pending_action_type(pa)) {
case ActionType::ATTACK:
@@ -2381,8 +2450,9 @@ bool RulerServer::is_defense_valid(const ActionState& pa) {
}
}
if (this->find_condition_on_card_ref(pa.target_card_refs[0], ConditionType::HOLD) ||
this->find_condition_on_card_ref(pa.target_card_refs[0], ConditionType::CANNOT_DEFEND)) {
if (!this->server()->options.is_nte() &&
(this->find_condition_on_card_ref(pa.target_card_refs[0], ConditionType::HOLD) ||
this->find_condition_on_card_ref(pa.target_card_refs[0], ConditionType::CANNOT_DEFEND))) {
this->error_code3 = -0x63;
return false;
}
@@ -2411,30 +2481,53 @@ size_t RulerServer::max_move_distance_for_card_ref(uint32_t card_ref) const {
return 0;
}
ssize_t ret = ce->def.mv.stat;
Condition cond;
if (this->find_condition_on_card_ref(card_ref, ConditionType::MV_BONUS, &cond, nullptr, true)) {
ret += cond.value;
}
if (this->find_condition_on_card_ref(card_ref, ConditionType::SET_MV, &cond, nullptr, true)) {
ret = cond.value;
}
ret = max<ssize_t>(0, ret);
size_t num_assists = this->assist_server->compute_num_assist_effects_for_client(client_id);
bool has_stamina_effect = false;
for (size_t z = 0; z < num_assists; z++) {
auto eff = this->assist_server->get_active_assist_by_index(z);
if (eff == AssistEffect::SNAIL_PACE) {
return 1;
if (this->server()->options.is_nte()) {
if (ce->def.type == CardType::ITEM) {
return ce->def.mv.stat;
}
if (eff == AssistEffect::STAMINA) {
has_stamina_effect = true;
}
}
return (has_stamina_effect) ? 9 : min<ssize_t>(9, ret);
Condition cond;
if (this->find_condition_on_card_ref(card_ref, ConditionType::SET_MV, &cond)) {
return cond.value;
}
size_t num_assists = this->assist_server->compute_num_assist_effects_for_client(client_id);
bool has_stamina_effect = false;
for (size_t z = 0; z < num_assists; z = z + 1) {
auto assist = this->assist_server->get_active_assist_by_index(z);
if (assist == AssistEffect::SNAIL_PACE) {
return 1;
} else if (assist == AssistEffect::STAMINA) {
has_stamina_effect = true;
}
}
return has_stamina_effect ? 99 : ce->def.mv.stat;
} else {
ssize_t ret = ce->def.mv.stat;
Condition cond;
if (this->find_condition_on_card_ref(card_ref, ConditionType::MV_BONUS, &cond, nullptr, true)) {
ret += cond.value;
}
if (this->find_condition_on_card_ref(card_ref, ConditionType::SET_MV, &cond, nullptr, true)) {
ret = cond.value;
}
ret = max<ssize_t>(0, ret);
size_t num_assists = this->assist_server->compute_num_assist_effects_for_client(client_id);
bool has_stamina_effect = false;
for (size_t z = 0; z < num_assists; z++) {
auto eff = this->assist_server->get_active_assist_by_index(z);
if (eff == AssistEffect::SNAIL_PACE) {
return 1;
}
if (eff == AssistEffect::STAMINA) {
has_stamina_effect = true;
}
}
return has_stamina_effect ? 9 : min<ssize_t>(9, ret);
}
}
RulerServer::MovePath::MovePath()
@@ -2518,13 +2611,14 @@ void RulerServer::replace_D1_D2_rank_cards_with_Attack(
}
AttackMedium RulerServer::get_attack_medium(const ActionState& pa) const {
bool is_nte = this->server()->options.is_nte();
for (size_t z = 0; z < 8; z++) {
uint16_t card_ref = pa.action_card_refs[z];
if (card_ref == 0xFFFF) {
return AttackMedium::PHYSICAL;
}
auto ce = this->definition_for_card_ref(card_ref);
if (ce && card_class_is_tech_like(ce->def.card_class())) {
if (ce && card_class_is_tech_like(ce->def.card_class(), is_nte)) {
return AttackMedium::TECH;
}
}
@@ -2545,9 +2639,11 @@ int32_t RulerServer::set_cost_for_card(uint8_t client_id, uint16_t card_ref) con
return -0x7D;
}
bool is_nte = this->server()->options.is_nte();
auto short_statuses = this->short_statuses[client_id];
int32_t ret = ce->def.self_cost;
if (short_statuses &&
if (!is_nte &&
short_statuses &&
this->card_exists_by_status(short_statuses->at(0)) &&
this->find_condition_on_card_ref(short_statuses->at(0).card_ref, ConditionType::UNKNOWN_69)) {
ret = 0;
@@ -2580,9 +2676,8 @@ int32_t RulerServer::set_cost_for_card(uint8_t client_id, uint16_t card_ref) con
for (size_t z = 0; z < num_assists; z++) {
auto eff = this->assist_server->get_active_assist_by_index(z);
if (eff == AssistEffect::LAND_PRICE) {
// Note: Original code had an extra addend (ret < 0 && (ret & 1) != 0),
// but ret cannot be negatve here, so we omit it.
ret += ret >> 1;
// In NTE, Land Price is apparently 2x rather than 1.5x
ret = is_nte ? (ret << 1) : (ret + (ret >> 1));
} else if (eff == AssistEffect::DEFLATION) {
ret = max<int32_t>(0, ret - 1);
} else if (eff == AssistEffect::INFLATION) {
@@ -2667,4 +2762,24 @@ int32_t RulerServer::verify_deck(
return 0;
}
size_t RulerServer::count_targets_with_rampage_and_not_pierce_nte(const ActionState& as) const {
size_t ret = 0;
for (size_t z = 0; (z < as.target_card_refs.size()) && (as.target_card_refs[z] != 0xFFFF); z++) {
if (this->attack_action_has_rampage_and_not_pierce(as, as.target_card_refs[z])) {
ret++;
}
}
return ret;
}
size_t RulerServer::count_targets_with_pierce_and_not_rampage_nte(const ActionState& as) const {
size_t ret = 0;
for (size_t z = 0; (z < as.target_card_refs.size()) && (as.target_card_refs[z] != 0xFFFF); z++) {
if (this->attack_action_has_pierce_and_not_rampage(as, client_id_for_card_ref(as.target_card_refs[z]))) {
ret++;
}
}
return ret;
}
} // namespace Episode3
+22 -35
View File
@@ -49,12 +49,9 @@ public:
std::shared_ptr<Server> server();
std::shared_ptr<const Server> server() const;
ActionChainWithConds* action_chain_with_conds_for_card_ref(
uint16_t card_ref);
const ActionChainWithConds* action_chain_with_conds_for_card_ref(
uint16_t card_ref) const;
bool any_attack_action_card_is_support_tech_or_support_pb(
const ActionState& pa) const;
ActionChainWithConds* action_chain_with_conds_for_card_ref(uint16_t card_ref);
const ActionChainWithConds* action_chain_with_conds_for_card_ref(uint16_t card_ref) const;
bool any_attack_action_card_is_support_tech_or_support_pb(const ActionState& pa) const;
bool card_has_pierce_or_rampage(
uint8_t client_id,
ConditionType cond_type,
@@ -63,27 +60,23 @@ public:
uint16_t action_card_ref,
uint8_t def_effect_index,
AttackMedium attack_medium) const;
bool attack_action_has_rampage_and_not_pierce(
const ActionState& pa, uint16_t card_ref) const;
bool attack_action_has_pierce_and_not_rampage(
const ActionState& pa, uint8_t client_id);
bool attack_action_has_rampage_and_not_pierce(const ActionState& pa, uint16_t card_ref) const;
bool attack_action_has_pierce_and_not_rampage(const ActionState& pa, uint8_t client_id) const;
size_t count_targets_with_rampage_and_not_pierce_nte(const ActionState& as) const;
size_t count_targets_with_pierce_and_not_rampage_nte(const ActionState& as) const;
bool card_exists_by_status(const CardShortStatus& stat) const;
bool card_has_mighty_knuckle(uint32_t card_ref) const;
uint16_t card_id_for_card_ref(uint16_t card_ref) const;
static bool card_id_is_boss_sc(uint16_t card_id);
static bool card_id_is_support_tech_or_support_pb(uint16_t card_id);
bool card_ref_can_attack(uint16_t card_ref);
bool card_ref_can_move(
uint8_t client_id, uint16_t card_ref, bool ignore_atk_points) const;
bool card_ref_has_class_usability_condition(
uint16_t card_ref) const;
bool card_ref_can_move(uint8_t client_id, uint16_t card_ref, bool ignore_atk_points) const;
bool card_ref_has_class_usability_condition(uint16_t card_ref) const;
bool card_ref_has_free_maneuver(uint16_t card_ref) const;
bool card_ref_is_aerial(uint16_t card_ref) const;
bool card_ref_is_aerial_or_has_free_maneuver(
uint16_t card_ref) const;
bool card_ref_is_aerial_or_has_free_maneuver(uint16_t card_ref) const;
bool card_ref_is_boss_sc(uint32_t card_ref) const;
bool card_ref_or_any_set_card_has_condition_46(
uint16_t card_ref) const;
bool card_ref_or_any_set_card_has_condition_46(uint16_t card_ref) const;
bool card_ref_or_sc_has_fixed_range(uint16_t card_ref) const;
bool check_move_path_and_get_cost(
uint8_t client_id,
@@ -123,14 +116,12 @@ public:
uint16_t* out_effective_card_id,
TargetMode* out_effective_target_mode,
uint16_t* out_orig_card_ref) const;
size_t count_rampage_targets_for_attack(
const ActionState& pa, uint8_t client_id) const;
size_t count_rampage_targets_for_attack(const ActionState& pa, uint8_t client_id) const;
bool defense_card_can_apply_to_attack(
uint16_t defense_card_ref,
uint16_t attacker_card_ref,
uint16_t attacker_sc_card_ref) const;
bool defense_card_matches_any_attack_card_top_color(
const ActionState& pa) const;
bool defense_card_matches_any_attack_card_top_color(const ActionState& pa) const;
std::shared_ptr<const CardIndex::CardEntry> definition_for_card_ref(uint16_t card_ref) const;
int32_t error_code_for_client_setting_card(
uint8_t client_id,
@@ -157,17 +148,14 @@ public:
size_t num_occupied_tiles,
size_t num_vacant_tiles) const;
uint16_t get_ally_sc_card_ref(uint16_t card_ref) const;
std::shared_ptr<const CardIndex::CardEntry> definition_for_card_id(
uint32_t card_id) const;
std::shared_ptr<const CardIndex::CardEntry> definition_for_card_id(uint32_t card_id) const;
uint32_t get_card_id_with_effective_range(
uint16_t card_ref, uint16_t card_id_override, TargetMode* out_target_mode) const;
uint8_t get_card_ref_max_hp(uint16_t card_ref) const;
bool get_creature_summon_area(
uint8_t client_id, Location* out_loc, uint8_t* out_region_size) const;
std::shared_ptr<HandAndEquipState> get_hand_and_equip_state_for_client_id(
uint8_t client_id);
std::shared_ptr<const HandAndEquipState> get_hand_and_equip_state_for_client_id(
uint8_t client_id) const;
std::shared_ptr<HandAndEquipState> get_hand_and_equip_state_for_client_id(uint8_t client_id);
std::shared_ptr<const HandAndEquipState> get_hand_and_equip_state_for_client_id(uint8_t client_id) const;
bool get_move_path_length_and_cost(
uint32_t client_id,
uint32_t card_ref,
@@ -188,8 +176,7 @@ public:
std::shared_ptr<StateFlags> state_flags,
std::shared_ptr<AssistServer> assist_server);
size_t max_move_distance_for_card_ref(uint32_t card_ref) const;
static void offsets_for_direction(
const Location& loc, int32_t* out_x_offset, int32_t* out_y_offset);
static void offsets_for_direction(const Location& loc, int32_t* out_x_offset, int32_t* out_y_offset);
void register_player(
uint8_t client_id,
std::shared_ptr<HandAndEquipState> hes,
@@ -211,11 +198,11 @@ private:
std::weak_ptr<Server> w_server;
public:
std::shared_ptr<HandAndEquipState> hand_and_equip_states[4];
std::shared_ptr<parray<CardShortStatus, 0x10>> short_statuses[4];
std::shared_ptr<DeckEntry> deck_entries[4];
std::shared_ptr<parray<ActionChainWithConds, 9>> set_card_action_chains[4];
std::shared_ptr<parray<ActionMetadata, 9>> set_card_action_metadatas[4];
bcarray<std::shared_ptr<HandAndEquipState>, 4> hand_and_equip_states;
bcarray<std::shared_ptr<parray<CardShortStatus, 0x10>>, 4> short_statuses;
bcarray<std::shared_ptr<DeckEntry>, 4> deck_entries;
bcarray<std::shared_ptr<parray<ActionChainWithConds, 9>>, 4> set_card_action_chains;
bcarray<std::shared_ptr<parray<ActionMetadata, 9>>, 4> set_card_action_metadatas;
std::shared_ptr<MapAndRulesState> map_and_rules;
std::shared_ptr<StateFlags> state_flags;
std::shared_ptr<AssistServer> assist_server;
+881 -531
View File
File diff suppressed because it is too large Load Diff
+64 -26
View File
@@ -71,9 +71,13 @@ public:
std::shared_ptr<const CardIndex> card_index;
std::shared_ptr<const MapIndex> map_index;
uint32_t behavior_flags;
std::shared_ptr<PSOLFGEncryption> random_crypt;
std::shared_ptr<PSOLFGEncryption> opt_rand_crypt;
std::shared_ptr<const Tournament> tournament;
std::array<std::vector<uint16_t>, 5> trap_card_ids;
inline bool is_nte() const {
return (this->behavior_flags & BehaviorFlag::IS_TRIAL_EDITION);
}
};
Server(std::shared_ptr<Lobby> lobby, Options&& options);
~Server() noexcept(false);
@@ -95,26 +99,54 @@ public:
StackLogger log_stack(const std::string& prefix) const;
const StackLogger& log() const;
std::string debug_str_for_card_ref(uint16_t card_ref) const;
std::string debug_str_for_card_id(uint16_t card_id) const;
template <typename U16T>
std::string debug_str_for_card_refs(const U16T* refs, size_t count) const {
std::string ret = "[";
for (size_t z = 0; z < count; z++) {
if (refs[z] != 0xFFFF) {
std::string ref_str = this->debug_str_for_card_ref(refs[z]);
ret += string_printf("%zu:%s ", z, ref_str.c_str());
}
}
if (ret.size() > 1) {
ret.back() = ']'; // Replace the ' ' from the last added item
} else {
ret.push_back(']');
}
return ret;
}
template <typename U16T>
std::string debug_str_for_card_refs(const std::vector<U16T>& refs) const {
return this->debug_str_for_card_refs(refs.data(), refs.size());
}
template <typename U16T, size_t Count>
std::string debug_str_for_card_refs(const parray<U16T, Count>& refs) const {
return this->debug_str_for_card_refs(refs.data(), refs.size());
}
int8_t get_winner_team_id() const;
template <typename T>
void send(const T& cmd) const {
void send(const T& cmd, uint8_t command = 0xC9, bool enable_masking = true) const {
if (cmd.header.size != sizeof(cmd) / 4) {
throw std::logic_error("outbound command size field is incorrect");
}
if (cmd.header.subsubcommand == 0x06) {
if (!this->options.is_nte() && (cmd.header.subsubcommand == 0x06)) {
this->num_6xB4x06_commands_sent++;
this->prev_num_6xB4x06_commands_sent = this->num_6xB4x06_commands_sent;
if (this->num_6xB4x06_commands_sent > 0x100) {
return;
}
}
this->send(&cmd, cmd.header.size * 4);
this->send(&cmd, cmd.header.size * 4, command, enable_masking);
}
void send(const void* data, size_t size) const;
void send(const void* data, size_t size, uint8_t command = 0xC9, bool enable_masking = true) const;
void send_commands_for_joining_spectator(Channel& ch) const;
void force_battle_result(uint8_t surrendered_client_id, bool set_winner);
void force_replace_assist_card(uint8_t client_id, uint16_t card_id);
void force_destroy_field_character(uint8_t client_id, size_t set_index);
__attribute__((format(printf, 2, 3))) void send_debug_message_printf(const char* fmt, ...) const;
@@ -142,7 +174,7 @@ public:
bool check_presence_entry(uint8_t client_id) const;
void clear_player_flags_after_dice_phase();
void compute_all_map_occupied_bits();
void compute_team_dice_boost(uint8_t team_id);
void compute_team_dice_bonus(uint8_t team_id);
void copy_player_states_to_prev_states();
std::shared_ptr<const CardIndex::CardEntry> definition_for_card_id(uint16_t card_id) const;
void destroy_cards_with_zero_hp();
@@ -173,14 +205,14 @@ public:
void send_set_card_updates_and_6xB4x04_if_needed();
void set_battle_ended();
void set_battle_started();
void set_client_id_ready_to_advance_phase(uint8_t client_id);
bool player_can_receive_dice_boost(uint8_t client_id) const;
void set_client_id_ready_to_advance_phase(uint8_t client_id, BattlePhase battle_phase);
void set_phase_after();
void move_phase_before();
void set_player_deck_valid(uint8_t client_id);
void setup_and_start_battle();
G_SetStateFlags_GC_Ep3_6xB4x03 prepare_6xB4x03() const;
void update_battle_state_flags_and_send_6xB4x03_if_needed(
bool always_send = false);
G_SetStateFlags_Ep3_6xB4x03 prepare_6xB4x03() const;
void update_battle_state_flags_and_send_6xB4x03_if_needed(bool always_send = false);
bool update_registration_phase();
void on_server_data_input(std::shared_ptr<Client> sender_c, const std::string& data);
void handle_CAx0B_mulligan_hand(std::shared_ptr<Client> sender_c, const std::string& data);
@@ -191,6 +223,8 @@ public:
void handle_CAx10_move_fc_to_location(std::shared_ptr<Client> sender_c, const std::string& data);
void handle_CAx11_enqueue_attack_or_defense(std::shared_ptr<Client> sender_c, const std::string& data);
void handle_CAx12_end_attack_list(std::shared_ptr<Client> sender_c, const std::string& data);
template <typename CmdT>
void handle_CAx13_update_map_during_setup_t(std::shared_ptr<Client> sender_c, const std::string& data);
void handle_CAx13_update_map_during_setup(std::shared_ptr<Client> sender_c, const std::string& data);
void handle_CAx14_update_deck_during_setup(std::shared_ptr<Client> sender_c, const std::string& data);
void handle_CAx15_unused_hard_reset_server_state(std::shared_ptr<Client> sender_c, const std::string& data);
@@ -208,12 +242,11 @@ public:
void handle_CAx49_card_counts(std::shared_ptr<Client> sender_c, const std::string& data);
void compute_losing_team_id_and_add_winner_flags(uint32_t flags);
uint32_t get_team_exp(uint8_t team_id) const;
uint32_t send_6xB4x06_if_card_ref_invalid(
uint16_t card_ref, int16_t negative_value);
uint32_t send_6xB4x06_if_card_ref_invalid(uint16_t card_ref, int16_t negative_value);
void unknown_8023EEF4();
void execute_bomb_assist_effect();
void replace_targets_due_to_destruction_or_conditions(
ActionState* as);
void replace_targets_due_to_destruction_nte(ActionState* as);
void replace_targets_due_to_destruction_or_conditions(ActionState* as);
bool any_target_exists_for_attack(const ActionState& as);
uint8_t get_current_team_turn2() const;
void unknown_8023EE48();
@@ -224,12 +257,11 @@ public:
void send_6xB4x02_for_all_players_if_needed(bool always_send = false);
void send_6xB4x50_trap_tile_locations() const;
G_UpdateDecks_GC_Ep3_6xB4x07 prepare_6xB4x07_decks_update() const;
G_SetPlayerNames_GC_Ep3_6xB4x1C prepare_6xB4x1C_names_update() const;
static std::string prepare_6xB6x41_map_definition(
std::shared_ptr<const MapIndex::Map> map, uint8_t language, bool is_trial);
G_UpdateDecks_Ep3_6xB4x07 prepare_6xB4x07_decks_update() const;
G_SetPlayerNames_Ep3_6xB4x1C prepare_6xB4x1C_names_update() const;
static std::string prepare_6xB6x41_map_definition(std::shared_ptr<const MapIndex::Map> map, uint8_t language, bool is_nte);
void send_6xB6x41_to_all_clients() const;
G_SetTrapTileLocations_GC_Ep3_6xB4x50 prepare_6xB4x50_trap_tile_locations() const;
G_SetTrapTileLocations_Ep3_6xB4x50 prepare_6xB4x50_trap_tile_locations() const;
std::vector<std::shared_ptr<Card>> const_cast_set_cards_v(
const std::vector<std::shared_ptr<const Card>>& cards);
@@ -241,10 +273,14 @@ private:
public:
// These fields are not part of the original implementation
std::weak_ptr<Lobby> lobby;
bool has_lobby;
Options options;
std::shared_ptr<const MapIndex::Map> last_chosen_map;
bool tournament_match_result_sent;
uint8_t override_environment_number;
uint8_t def_dice_value_range_override;
uint8_t atk_dice_value_range_2v1_override;
uint8_t def_dice_value_range_2v1_override;
mutable std::deque<StackLogger*> logger_stack;
// These fields were originally contained in the TCardServerBase object
@@ -256,7 +292,7 @@ public:
void clear();
} __attribute__((packed));
std::shared_ptr<MapAndRulesState> map_and_rules;
std::shared_ptr<DeckEntry> deck_entries[4];
bcarray<std::shared_ptr<DeckEntry>, 4> deck_entries;
parray<PresenceEntry, 4> presence_entries;
uint8_t num_clients_present;
parray<NameEntry, 4> name_entries;
@@ -275,7 +311,7 @@ public:
RegistrationPhase registration_phase;
ActionSubphase action_subphase;
uint8_t current_team_turn2;
ActionState pending_attacks[0x20];
bcarray<ActionState, 0x20> pending_attacks;
uint32_t num_pending_attacks;
parray<uint8_t, 4> client_done_enqueuing_attacks;
parray<uint8_t, 4> player_ready_to_end_phase;
@@ -288,11 +324,11 @@ public:
uint32_t should_copy_prev_states_to_current_states;
std::shared_ptr<CardSpecial> card_special;
std::shared_ptr<StateFlags> state_flags;
std::shared_ptr<PlayerState> player_states[4];
std::array<std::shared_ptr<PlayerState>, 4> player_states;
parray<uint32_t, 4> clients_done_in_mulligan_phase;
uint32_t num_pending_attacks_with_cards;
std::shared_ptr<Card> attack_cards[0x20];
ActionState pending_attacks_with_cards[0x20];
bcarray<std::shared_ptr<Card>, 0x20> attack_cards;
bcarray<ActionState, 0x20> pending_attacks_with_cards;
uint32_t unknown_a14;
uint32_t unknown_a15;
parray<uint32_t, 4> defense_list_ended_for_client;
@@ -301,14 +337,16 @@ public:
std::shared_ptr<RulerServer> ruler_server;
parray<parray<parray<uint8_t, 2>, 2>, 5> warp_positions; // Array indexes are (type, end, x/y)
parray<int16_t, 2> team_exp;
parray<int16_t, 2> team_dice_boost;
parray<int16_t, 2> team_dice_bonus;
parray<uint32_t, 2> team_client_count;
parray<uint32_t, 2> team_num_ally_fcs_destroyed;
parray<uint32_t, 2> team_num_cards_destroyed;
parray<uint8_t, 5> num_trap_tiles_of_type;
parray<uint8_t, 5> chosen_trap_tile_index_of_type;
parray<parray<parray<uint8_t, 2>, 8>, 5> trap_tile_locs;
ActionState pb_action_states[4];
parray<parray<uint8_t, 2>, 0x10> trap_tile_locs_nte;
size_t num_trap_tiles_nte;
bcarray<ActionState, 4> pb_action_states;
parray<uint8_t, 4> has_done_pb;
parray<parray<uint8_t, 4>, 4> has_done_pb_with_client;
mutable uint32_t num_6xB4x06_commands_sent;
+1 -1
View File
@@ -842,7 +842,7 @@ void TournamentIndex::save() const {
for (const auto& it : this->name_to_tournament) {
json.emplace(it.second->get_name(), it.second->json());
}
save_file(this->state_filename, json.serialize(JSON::SerializeOption::FORMAT | JSON::SerializeOption::HEX_INTEGERS));
save_file(this->state_filename, json.serialize(JSON::SerializeOption::FORMAT | JSON::SerializeOption::HEX_INTEGERS | JSON::SerializeOption::ESCAPE_CONTROLS_ONLY));
}
shared_ptr<Tournament> TournamentIndex::create_tournament(
+43
View File
@@ -0,0 +1,43 @@
#include "EventUtils.hh"
#include <event2/event.h>
#include <deque>
#include <functional>
#include <memory>
#include <stdexcept>
static void dispatch_forward_to_event_thread(evutil_socket_t, short, void* ctx) {
auto* fn = reinterpret_cast<std::function<void()>*>(ctx);
(*fn)();
delete fn;
}
void forward_to_event_thread(std::shared_ptr<struct event_base> base, std::function<void()>&& fn) {
struct timeval tv = {0, 0};
std::function<void()>* new_fn = new std::function<void()>(std::move(fn));
event_base_once(base.get(), -1, EV_TIMEOUT, dispatch_forward_to_event_thread, new_fn, &tv);
}
template <>
void call_on_event_thread<void>(std::shared_ptr<struct event_base> base, std::function<void()>&& compute) {
bool succeeded = false;
std::string exc_what;
std::mutex ret_lock;
std::condition_variable ret_cv;
std::unique_lock<std::mutex> g(ret_lock);
forward_to_event_thread(base, [&]() -> void {
std::lock_guard<std::mutex> g(ret_lock);
try {
compute();
succeeded = true;
} catch (const std::exception& e) {
exc_what = e.what();
}
ret_cv.notify_one();
});
ret_cv.wait(g);
if (!succeeded) {
throw std::runtime_error(exc_what);
}
}
+38
View File
@@ -0,0 +1,38 @@
#pragma once
#include <event2/event.h>
#include <condition_variable>
#include <functional>
#include <memory>
#include <mutex>
#include <optional>
#include <stdexcept>
void forward_to_event_thread(std::shared_ptr<struct event_base> base, std::function<void()>&& fn);
template <typename T>
T call_on_event_thread(std::shared_ptr<struct event_base> base, std::function<T()>&& compute) {
std::optional<T> ret;
std::string exc_what;
std::mutex ret_lock;
std::condition_variable ret_cv;
std::unique_lock<std::mutex> g(ret_lock);
forward_to_event_thread(base, [&]() -> void {
std::lock_guard<std::mutex> g(ret_lock);
try {
ret = compute();
} catch (const std::exception& e) {
exc_what = e.what();
}
ret_cv.notify_one();
});
ret_cv.wait(g);
if (!ret.has_value()) {
throw std::runtime_error(exc_what);
}
return ret.value();
}
template <>
void call_on_event_thread<void>(std::shared_ptr<struct event_base> base, std::function<void()>&& compute);
+15
View File
@@ -74,3 +74,18 @@ FileContentsCache::GetResult FileContentsCache::get(const char* name,
std::function<std::string(const std::string&)> generate) {
return this->get(string(name), generate);
}
shared_ptr<const string> ThreadSafeFileCache::get(
const string& name, std::function<shared_ptr<const string>(const std::string&)> generate) {
try {
shared_lock g(this->lock);
return this->name_to_file.at(name);
} catch (const out_of_range&) {
unique_lock g(this->lock);
auto it = this->name_to_file.find(name);
if (it == this->name_to_file.end()) {
it = this->name_to_file.emplace(name, generate(name)).first;
}
return it->second;
}
}
+20
View File
@@ -2,6 +2,8 @@
#include <functional>
#include <memory>
#include <mutex>
#include <shared_mutex>
#include <string>
#include <unordered_map>
@@ -102,3 +104,21 @@ private:
std::unordered_map<std::string, std::shared_ptr<File>> name_to_file;
uint64_t ttl_usecs;
};
class ThreadSafeFileCache {
public:
explicit ThreadSafeFileCache() = default;
ThreadSafeFileCache(const ThreadSafeFileCache&) = delete;
ThreadSafeFileCache(ThreadSafeFileCache&&) = delete;
ThreadSafeFileCache& operator=(const ThreadSafeFileCache&) = delete;
ThreadSafeFileCache& operator=(ThreadSafeFileCache&&) = delete;
~ThreadSafeFileCache() = default;
// Warning: generate() is called while the lock is held for writing, so it
// will block other threads.
std::shared_ptr<const std::string> get(const std::string& name, std::function<std::shared_ptr<const std::string>(const std::string&)> generate);
private:
std::shared_mutex lock;
std::unordered_map<std::string, std::shared_ptr<const std::string>> name_to_file;
};
+131 -36
View File
@@ -10,6 +10,7 @@
#ifdef HAVE_RESOURCE_FILE
#include <resource_file/Emulators/PPC32Emulator.hh>
#include <resource_file/Emulators/X86Emulator.hh>
#endif
#include "CommandFormats.hh"
@@ -129,26 +130,84 @@ shared_ptr<CompiledFunctionCode> compile_function_code(
#else
auto ret = make_shared<CompiledFunctionCode>();
ret->arch = arch;
ret->name = name;
ret->short_name = name;
ret->index = 0;
ret->hide_from_patches_menu = false;
unordered_set<string> get_include_stack;
function<string(const string&)> get_include = [&](const string& name) -> string {
const char* arch_name_token;
switch (arch) {
case CompiledFunctionCode::Architecture::POWERPC:
arch_name_token = "ppc";
break;
case CompiledFunctionCode::Architecture::X86:
arch_name_token = "x86";
break;
case CompiledFunctionCode::Architecture::SH4:
arch_name_token = "sh4";
break;
default:
throw runtime_error("unknown architecture");
}
string asm_filename = string_printf("%s/%s.%s.inc.s", directory.c_str(), name.c_str(), arch_name_token);
if (isfile(asm_filename)) {
if (!get_include_stack.emplace(name).second) {
throw runtime_error("mutual recursion between includes: " + name);
}
EmulatorBase::AssembleResult ret;
switch (arch) {
case CompiledFunctionCode::Architecture::POWERPC:
ret = PPC32Emulator::assemble(load_file(asm_filename), get_include);
break;
case CompiledFunctionCode::Architecture::X86:
ret = X86Emulator::assemble(load_file(asm_filename), get_include);
break;
case CompiledFunctionCode::Architecture::SH4:
throw runtime_error("cannot compuile SH-4 assembly");
default:
throw runtime_error("unknown architecture");
}
get_include_stack.erase(name);
return ret.code;
}
string bin_filename = directory + "/" + name + ".inc.bin";
if (isfile(bin_filename)) {
return load_file(bin_filename);
}
throw runtime_error("data not found for include: " + name + " (from " + asm_filename + " or " + bin_filename + ")");
};
EmulatorBase::AssembleResult assembled;
if (arch == CompiledFunctionCode::Architecture::POWERPC) {
auto assembled = PPC32Emulator::assemble(text, {directory});
ret->code = std::move(assembled.code);
ret->label_offsets = std::move(assembled.label_offsets);
assembled = PPC32Emulator::assemble(text, get_include);
} else if (arch == CompiledFunctionCode::Architecture::X86) {
throw runtime_error("x86 assembler is not implemented");
assembled = X86Emulator::assemble(text, get_include);
}
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);
}
}
set<uint32_t> reloc_indexes;
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;
}
}
@@ -179,32 +238,57 @@ FunctionCodeIndex::FunctionCodeIndex(const string& directory) {
}
uint32_t next_menu_item_id = 0;
for (const auto& filename : list_directory(directory)) {
if (!ends_with(filename, ".s") || ends_with(filename, ".inc.s")) {
continue;
}
bool is_patch = ends_with(filename, ".patch.s");
string name = filename.substr(0, filename.size() - (is_patch ? 8 : 2));
// Check for specific_version token
uint32_t specific_version = 0;
string patch_name = name;
if (is_patch &&
(filename.size() >= 13) &&
(filename[filename.size() - 13] == '.') &&
isdigit(filename[filename.size() - 12]) &&
(filename[filename.size() - 11] == 'O' || filename[filename.size() - 11] == 'S') &&
(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);
}
for (const auto& filename : list_directory_sorted(directory)) {
try {
if (!ends_with(filename, ".s")) {
continue;
}
string name = filename.substr(0, filename.size() - 2);
if (ends_with(name, ".inc")) {
continue;
}
bool is_patch = ends_with(name, ".patch");
if (is_patch) {
name.resize(name.size() - 6);
}
// Figure out the version or specific_version
CompiledFunctionCode::Architecture arch = CompiledFunctionCode::Architecture::UNKNOWN;
uint32_t specific_version = 0;
string short_name = name;
if (ends_with(name, ".ppc")) {
arch = CompiledFunctionCode::Architecture::POWERPC;
name.resize(name.size() - 4);
short_name = name;
} else if (ends_with(name, ".x86")) {
arch = CompiledFunctionCode::Architecture::X86;
name.resize(name.size() - 4);
short_name = name;
} else if (ends_with(name, ".sh4")) {
arch = CompiledFunctionCode::Architecture::SH4;
name.resize(name.size() - 4);
short_name = name;
} else if (is_patch && (name.size() >= 5) && (name[name.size() - 5] == '.')) {
specific_version = (name[name.size() - 4] << 24) | (name[name.size() - 3] << 16) | (name[name.size() - 2] << 8) | name[name.size() - 1];
if (specific_version_is_gc(specific_version)) {
arch = CompiledFunctionCode::Architecture::POWERPC;
} else if (specific_version_is_xb(specific_version) || specific_version_is_bb(specific_version)) {
arch = CompiledFunctionCode::Architecture::X86;
} else {
throw runtime_error("unable to determine architecture from specific_version");
}
short_name = name.substr(0, name.size() - 5);
}
if (arch == CompiledFunctionCode::Architecture::UNKNOWN) {
throw runtime_error("unable to determine architecture");
}
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(arch, directory, name, text);
if (code->index != 0) {
if (!this->index_to_function.emplace(code->index, code).second) {
throw runtime_error(string_printf(
@@ -212,14 +296,15 @@ FunctionCodeIndex::FunctionCodeIndex(const string& directory) {
}
}
code->specific_version = specific_version;
code->patch_name = patch_name;
code->source_path = path;
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) : "";
@@ -228,7 +313,7 @@ FunctionCodeIndex::FunctionCodeIndex(const string& directory) {
index_prefix.c_str(), patch_prefix.c_str(), name.c_str(), name_for_architecture(code->arch));
} catch (const exception& e) {
function_compiler_log.warning("Failed to compile function %s: %s", name.c_str(), e.what());
function_compiler_log.warning("Failed to compile function %s: %s", filename.c_str(), e.what());
}
}
}
@@ -241,7 +326,11 @@ shared_ptr<const Menu> FunctionCodeIndex::patch_menu(uint32_t specific_version)
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;
@@ -256,6 +345,12 @@ bool FunctionCodeIndex::patch_menu_empty(uint32_t specific_version) const {
return true;
}
std::shared_ptr<const CompiledFunctionCode> FunctionCodeIndex::get_patch(
const std::string& name, uint32_t specific_version) const {
return this->name_and_specific_version_to_patch_function.at(
string_printf("%s-%08" PRIX32, name.c_str(), specific_version));
}
DOLFileIndex::DOLFileIndex(const string& directory) {
if (!function_compiler_available()) {
function_compiler_log.info("Function compiler is not available");
+10 -5
View File
@@ -18,7 +18,8 @@ void set_function_compiler_available(bool is_available);
struct CompiledFunctionCode {
enum class Architecture {
POWERPC = 0, // GC
UNKNOWN = 0,
POWERPC, // GC
X86, // PC, XB, BB
SH4, // Dreamcast
};
@@ -27,9 +28,11 @@ 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 source_path; // Path to source file from newserv root
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,13 +63,15 @@ 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;
std::shared_ptr<const Menu> patch_menu(uint32_t specific_version) const;
bool patch_menu_empty(uint32_t specific_version) const;
std::shared_ptr<const CompiledFunctionCode> get_patch(const std::string& name, uint32_t specific_version) const;
};
struct DOLFileIndex {
+16 -16
View File
@@ -37,23 +37,23 @@ constexpr uint32_t encode_argb8888(uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
return (a << 24) | (r << 16) | (g << 8) | b;
}
constexpr uint16_t encode_xrgb8888_to_xrgb1555(uint32_t xrgb8888) {
constexpr uint16_t encode_argb8888_to_argb1555(uint32_t argb8888) {
// In: aaaaaaaarrrrrrrrggggggggbbbbbbbb
// Out: arrrrrgggggbbbbb
return ((argb8888 >> 9) & 0x7C00) | ((argb8888 >> 6) & 0x03E0) | ((argb8888 >> 3) & 0x001F) | ((argb8888 >> 16) & 0x8000);
}
constexpr uint16_t encode_rgba8888_to_argb1555(uint32_t rgba8888) {
// In: rrrrrrrrggggggggbbbbbbbbaaaaaaaa
// Out: -rrrrrgggggbbbbb
return ((xrgb8888 >> 9) & 0x7C00) | ((xrgb8888 >> 6) & 0x03E0) | ((xrgb8888 >> 3) & 0x001F);
// Out: arrrrrgggggbbbbb
return ((rgba8888 >> 17) & 0x7C00) | ((rgba8888 >> 14) & 0x03E0) | ((rgba8888 >> 11) & 0x001F) | ((rgba8888 << 8) & 0x8000);
}
constexpr uint16_t encode_rgbx8888_to_xrgb1555(uint32_t rgbx8888) {
// In: rrrrrrrrggggggggbbbbbbbbxxxxxxxx
// Out: -rrrrrgggggbbbbb
return ((rgbx8888 >> 17) & 0x7C00) | ((rgbx8888 >> 14) & 0x03E0) | ((rgbx8888 >> 11) & 0x001F);
}
constexpr uint32_t decode_xrgb1555_to_rgba8888(uint16_t xrgb1555) {
// In: -rrrrrgggggbbbbb
// Out: rrrrrrrrggggggggbbbbbbbbaaaaaaaa (a is always FF)
return ((xrgb1555 << 17) & 0xF8000000) | ((xrgb1555 << 12) & 0x07000000) |
((xrgb1555 << 14) & 0x00F80000) | ((xrgb1555 << 9) & 0x00070000) |
((xrgb1555 << 11) & 0x0000F800) | ((xrgb1555 << 6) & 0x00000700) |
0x000000FF;
constexpr uint32_t decode_argb1555_to_rgba8888(uint16_t argb1555) {
// In: arrrrrgggggbbbbb
// Out: rrrrrrrrggggggggbbbbbbbbaaaaaaaa
return ((argb1555 << 17) & 0xF8000000) | ((argb1555 << 12) & 0x07000000) |
((argb1555 << 14) & 0x00F80000) | ((argb1555 << 9) & 0x00070000) |
((argb1555 << 11) & 0x0000F800) | ((argb1555 << 6) & 0x00000700) |
((argb1555 & 0x8000) ? 0x000000FF : 0x00000000);
}
+992
View File
@@ -0,0 +1,992 @@
#include "HTTPServer.hh"
#include <event2/buffer.h>
#include <event2/event.h>
#include <event2/http.h>
#include <inttypes.h>
#include <stdlib.h>
#include <phosg/Network.hh>
#include <string>
#include <vector>
#include "EventUtils.hh"
#include "Loggers.hh"
#include "ProxyServer.hh"
#include "Server.hh"
using namespace std;
const unordered_map<int, const char*> HTTPServer::explanation_for_response_code({
{100, "Continue"},
{101, "Switching Protocols"},
{102, "Processing"},
{200, "OK"},
{201, "Created"},
{202, "Accepted"},
{203, "Non-Authoritative Information"},
{204, "No Content"},
{205, "Reset Content"},
{206, "Partial Content"},
{207, "Multi-Status"},
{208, "Already Reported"},
{226, "IM Used"},
{300, "Multiple Choices"},
{301, "Moved Permanently"},
{302, "Found"},
{303, "See Other"},
{304, "Not Modified"},
{305, "Use Proxy"},
{307, "Temporary Redirect"},
{308, "Permanent Redirect"},
{400, "Bad Request"},
{401, "Unathorized"},
{402, "Payment Required"},
{403, "Forbidden"},
{404, "Not Found"},
{405, "Method Not Allowed"},
{406, "Not Acceptable"},
{407, "Proxy Authentication Required"},
{408, "Request Timeout"},
{409, "Conflict"},
{410, "Gone"},
{411, "Length Required"},
{412, "Precondition Failed"},
{413, "Request Entity Too Large"},
{414, "Request-URI Too Long"},
{415, "Unsupported Media Type"},
{416, "Requested Range Not Satisfiable"},
{417, "Expectation Failed"},
{418, "I\'m a Teapot"},
{420, "Enhance Your Calm"},
{422, "Unprocessable Entity"},
{423, "Locked"},
{424, "Failed Dependency"},
{426, "Upgrade Required"},
{428, "Precondition Required"},
{429, "Too Many Requests"},
{431, "Request Header Fields Too Large"},
{444, "No Response"},
{449, "Retry With"},
{451, "Unavailable For Legal Reasons"},
{500, "Internal Server Error"},
{501, "Not Implemented"},
{502, "Bad Gateway"},
{503, "Service Unavailable"},
{504, "Gateway Timeout"},
{505, "HTTP Version Not Supported"},
{506, "Variant Also Negotiates"},
{507, "Insufficient Storage"},
{508, "Loop Detected"},
{509, "Bandwidth Limit Exceeded"},
{510, "Not Extended"},
{511, "Network Authentication Required"},
{598, "Network Read Timeout Error"},
{599, "Network Connect Timeout Error"},
});
HTTPServer::http_error::http_error(int code, const string& what)
: runtime_error(what),
code(code) {}
void HTTPServer::send_response(struct evhttp_request* req, int code, const char* content_type, struct evbuffer* b) {
struct evkeyvalq* headers = evhttp_request_get_output_headers(req);
evhttp_add_header(headers, "Content-Type", content_type);
evhttp_add_header(headers, "Server", "newserv");
evhttp_send_reply(req, code, explanation_for_response_code.at(code), b);
}
void HTTPServer::send_response(struct evhttp_request* req, int code, const char* content_type, const char* fmt, ...) {
unique_ptr<struct evbuffer, void (*)(struct evbuffer*)> out_buffer(evbuffer_new(), evbuffer_free);
va_list va;
va_start(va, fmt);
evbuffer_add_vprintf(out_buffer.get(), fmt, va);
va_end(va);
HTTPServer::send_response(req, code, content_type, out_buffer.get());
}
unordered_multimap<string, string> HTTPServer::parse_url_params(const string& query) {
unordered_multimap<string, string> params;
if (query.empty()) {
return params;
}
for (auto it : split(query, '&')) {
size_t first_equals = it.find('=');
if (first_equals != string::npos) {
string value(it, first_equals + 1);
size_t write_offset = 0, read_offset = 0;
for (; read_offset < value.size(); write_offset++) {
if ((value[read_offset] == '%') && (read_offset < value.size() - 2)) {
value[write_offset] =
static_cast<char>(value_for_hex_char(value[read_offset + 1]) << 4) |
static_cast<char>(value_for_hex_char(value[read_offset + 2]));
read_offset += 3;
} else if (value[write_offset] == '+') {
value[write_offset] = ' ';
read_offset++;
} else {
value[write_offset] = value[read_offset];
read_offset++;
}
}
value.resize(write_offset);
params.emplace(piecewise_construct, forward_as_tuple(it, 0, first_equals),
forward_as_tuple(value));
} else {
params.emplace(it, "");
}
}
return params;
}
unordered_map<string, string> HTTPServer::parse_url_params_unique(const string& query) {
unordered_map<string, string> ret;
for (const auto& it : HTTPServer::parse_url_params(query)) {
ret.emplace(it.first, std::move(it.second));
}
return ret;
}
const string& HTTPServer::get_url_param(
const unordered_multimap<string, string>& params, const string& key, const string* _default) {
auto range = params.equal_range(key);
if (range.first == range.second) {
if (!_default) {
throw out_of_range("URL parameter " + key + " not present");
}
return *_default;
}
return range.first->second;
}
HTTPServer::HTTPServer(shared_ptr<ServerState> state)
: state(state),
base(event_base_new(), event_base_free),
http(evhttp_new(this->base.get()), evhttp_free),
th(&HTTPServer::thread_fn, this) {
evhttp_set_gencb(this->http.get(), this->dispatch_handle_request, this);
}
void HTTPServer::listen(const string& socket_path) {
int fd = ::listen(socket_path, 0, SOMAXCONN);
server_log.info("Listening on Unix socket %s on fd %d (HTTP)", socket_path.c_str(), fd);
this->add_socket(fd);
}
void HTTPServer::listen(const string& addr, int port) {
if (port == 0) {
this->listen(addr);
} else {
int fd = ::listen(addr, port, SOMAXCONN);
string netloc_str = render_netloc(addr, port);
server_log.info("Listening on TCP interface %s on fd %d (HTTP)", netloc_str.c_str(), fd);
this->add_socket(fd);
}
}
void HTTPServer::listen(int port) {
this->listen("", port);
}
void HTTPServer::add_socket(int fd) {
evhttp_accept_socket(this->http.get(), fd);
}
void HTTPServer::schedule_stop() {
event_base_loopexit(this->base.get(), nullptr);
}
void HTTPServer::wait_for_stop() {
this->th.join();
}
void HTTPServer::dispatch_handle_request(struct evhttp_request* req, void* ctx) {
reinterpret_cast<HTTPServer*>(ctx)->handle_request(req);
}
JSON HTTPServer::generate_quest_json_st(shared_ptr<const Quest> q) {
if (!q) {
return nullptr;
}
auto battle_rules_json = q->battle_rules ? q->battle_rules->json() : nullptr;
auto challenge_template_index_json = (q->challenge_template_index >= 0)
? q->challenge_template_index
: JSON(nullptr);
return JSON::dict({
{"Number", q->quest_number},
{"Episode", name_for_episode(q->episode)},
{"Joinable", q->joinable},
{"Name", q->name},
{"BattleRules", std::move(battle_rules_json)},
{"ChallengeTemplateIndex", std::move(challenge_template_index_json)},
});
}
JSON HTTPServer::generate_client_config_json_st(const Client::Config& config) {
const char* drop_notifications_mode = "unknown";
switch (config.get_drop_notification_mode()) {
case Client::ItemDropNotificationMode::NOTHING:
drop_notifications_mode = "off";
break;
case Client::ItemDropNotificationMode::RARES_ONLY:
drop_notifications_mode = "rare";
break;
case Client::ItemDropNotificationMode::ALL_ITEMS:
drop_notifications_mode = "on";
break;
case Client::ItemDropNotificationMode::ALL_ITEMS_INCLUDING_MESETA:
drop_notifications_mode = "every";
break;
}
auto ret = JSON::dict({
{"SpecificVersion", config.specific_version},
{"SwitchAssistEnabled", (config.check_flag(Client::Flag::SWITCH_ASSIST_ENABLED) ? true : false)},
{"InfiniteHPEnabled", (config.check_flag(Client::Flag::INFINITE_HP_ENABLED) ? true : false)},
{"InfiniteTPEnabled", (config.check_flag(Client::Flag::INFINITE_TP_ENABLED) ? true : false)},
{"DropNotificationMode", drop_notifications_mode},
{"DebugEnabled", (config.check_flag(Client::Flag::DEBUG_ENABLED) ? true : false)},
{"ProxySaveFilesEnabled", (config.check_flag(Client::Flag::PROXY_SAVE_FILES) ? true : false)},
{"ProxyChatCommandsEnabled", (config.check_flag(Client::Flag::PROXY_CHAT_COMMANDS_ENABLED) ? true : false)},
{"ProxyPlayerNotificationsEnabled", (config.check_flag(Client::Flag::PROXY_PLAYER_NOTIFICATIONS_ENABLED) ? true : false)},
{"ProxySuppressClientPings", (config.check_flag(Client::Flag::PROXY_SUPPRESS_CLIENT_PINGS) ? true : false)},
{"ProxyEp3InfiniteMesetaEnabled", (config.check_flag(Client::Flag::PROXY_EP3_INFINITE_MESETA_ENABLED) ? true : false)},
{"ProxyEp3InfiniteTimeEnabled", (config.check_flag(Client::Flag::PROXY_EP3_INFINITE_TIME_ENABLED) ? true : false)},
{"ProxyBlockFunctionCalls", (config.check_flag(Client::Flag::PROXY_BLOCK_FUNCTION_CALLS) ? true : false)},
{"ProxyEp3UnmaskWhispers", (config.check_flag(Client::Flag::PROXY_EP3_UNMASK_WHISPERS) ? true : false)},
});
ret.emplace("OverrideRandomSeed", config.check_flag(Client::Flag::USE_OVERRIDE_RANDOM_SEED) ? config.override_random_seed : JSON(nullptr));
ret.emplace("OverrideSectionID", (config.override_section_id != 0xFF) ? config.override_section_id : JSON(nullptr));
ret.emplace("OverrideLobbyEvent", (config.override_lobby_event != 0xFF) ? config.override_lobby_event : JSON(nullptr));
ret.emplace("OverrideLobbyNumber", (config.override_lobby_number != 0x80) ? config.override_lobby_number : JSON(nullptr));
return ret;
}
JSON HTTPServer::generate_license_json_st(shared_ptr<const License> l) {
auto ret = JSON::dict({
{"SerialNumber", l->serial_number},
{"Flags", l->flags},
{"Ep3CurrentMeseta", l->ep3_current_meseta},
{"Ep3TotalMesetaEarned", l->ep3_total_meseta_earned},
{"BBTeamID", l->bb_team_id},
});
ret.emplace("BanEndTime", l->ban_end_time ? l->ban_end_time : JSON(nullptr));
ret.emplace("XBGamertag", !l->xb_gamertag.empty() ? l->xb_gamertag : JSON(nullptr));
ret.emplace("XBUserID", l->xb_user_id ? l->xb_user_id : JSON(nullptr));
ret.emplace("BBUsername", !l->bb_username.empty() ? l->bb_username : JSON(nullptr));
return ret;
};
JSON HTTPServer::generate_game_client_json_st(shared_ptr<const Client> c, shared_ptr<const ItemNameIndex> item_name_index) {
auto ret = JSON::dict({
{"ID", c->id},
{"RemoteAddress", render_sockaddr_storage(c->channel.remote_addr)},
{"Version", name_for_enum(c->version())},
{"SubVersion", c->sub_version},
{"Config", HTTPServer::generate_client_config_json_st(c->config)},
{"Language", name_for_language_code(c->language())},
{"LocationX", c->x},
{"LocationZ", c->z},
{"LocationFloor", c->floor},
{"CanChat", c->can_chat},
});
ret.emplace("license", c->license ? HTTPServer::generate_license_json_st(c->license) : JSON(nullptr));
auto l = c->lobby.lock();
if (l) {
ret.emplace("LobbyID", l->lobby_id);
ret.emplace("LobbyClientID", c->lobby_client_id);
}
if (c->version() == Version::BB_V4) {
ret.emplace("BBCharacterIndex", c->bb_character_index);
}
auto p = c->character(false, false);
if (p) {
if (!is_ep3(c->version())) {
ret.emplace("InventoryItems", p->inventory.num_items);
if (c->version() != Version::DC_NTE) {
ret.emplace("InventoryLanguage", p->inventory.language);
ret.emplace("NumHPMaterialsUsed", p->get_material_usage(PSOBBCharacterFile::MaterialType::HP));
ret.emplace("NumTPMaterialsUsed", p->get_material_usage(PSOBBCharacterFile::MaterialType::TP));
if (!is_v1_or_v2(c->version())) {
ret.emplace("NumPowerMaterialsUsed", p->get_material_usage(PSOBBCharacterFile::MaterialType::POWER));
ret.emplace("NumDefMaterialsUsed", p->get_material_usage(PSOBBCharacterFile::MaterialType::DEF));
ret.emplace("NumMindMaterialsUsed", p->get_material_usage(PSOBBCharacterFile::MaterialType::MIND));
ret.emplace("NumEvadeMaterialsUsed", p->get_material_usage(PSOBBCharacterFile::MaterialType::EVADE));
ret.emplace("NumLuckMaterialsUsed", p->get_material_usage(PSOBBCharacterFile::MaterialType::LUCK));
}
}
JSON items_json = JSON::list();
for (size_t z = 0; z < p->inventory.num_items; z++) {
const auto& item = p->inventory.items[z];
auto item_dict = JSON::dict({
{"Flags", item.flags.load()},
{"Data", item.data.hex()},
{"ItemID", item.data.id.load()},
});
if (item_name_index) {
item_dict.emplace("Description", item_name_index->describe_item(item.data, false));
}
items_json.emplace_back(std::move(item_dict));
}
ret.emplace("ATP", p->disp.stats.char_stats.atp.load());
ret.emplace("MST", p->disp.stats.char_stats.mst.load());
ret.emplace("EVP", p->disp.stats.char_stats.evp.load());
ret.emplace("HP", p->disp.stats.char_stats.hp.load());
ret.emplace("DFP", p->disp.stats.char_stats.dfp.load());
ret.emplace("ATA", p->disp.stats.char_stats.ata.load());
ret.emplace("LCK", p->disp.stats.char_stats.lck.load());
ret.emplace("EXP", p->disp.stats.experience.load());
ret.emplace("Meseta", p->disp.stats.meseta.load());
auto tech_levels_json = JSON::dict();
for (size_t z = 0; z < 0x13; z++) {
auto level = p->get_technique_level(z);
tech_levels_json.emplace(name_for_technique(z), (level != 0xFF) ? level : JSON(nullptr));
}
ret.emplace("TechniqueLevels", std::move(tech_levels_json));
}
ret.emplace("Height", p->disp.stats.height.load());
ret.emplace("Level", p->disp.stats.level.load());
ret.emplace("NameColor", p->disp.visual.name_color.load());
ret.emplace("ExtraModel", (p->disp.visual.validation_flags & 2) ? p->disp.visual.extra_model : JSON(nullptr));
ret.emplace("SectionID", name_for_section_id(p->disp.visual.section_id));
ret.emplace("CharClass", name_for_char_class(p->disp.visual.section_id));
ret.emplace("Costume", p->disp.visual.costume.load());
ret.emplace("Skin", p->disp.visual.skin.load());
ret.emplace("Face", p->disp.visual.face.load());
ret.emplace("Head", p->disp.visual.head.load());
ret.emplace("Hair", p->disp.visual.hair.load());
ret.emplace("HairR", p->disp.visual.hair_r.load());
ret.emplace("HairG", p->disp.visual.hair_g.load());
ret.emplace("HairB", p->disp.visual.hair_b.load());
ret.emplace("ProportionX", p->disp.visual.proportion_x.load());
ret.emplace("ProportionY", p->disp.visual.proportion_y.load());
ret.emplace("Name", p->disp.name.decode(c->language()));
ret.emplace("PlayTimeSeconds", p->play_time_seconds.load());
ret.emplace("AutoReply", p->auto_reply.decode(c->language()));
ret.emplace("InfoBoard", p->info_board.decode(c->language()));
auto battle_place_counts = JSON::list({
p->battle_records.place_counts[0].load(),
p->battle_records.place_counts[1].load(),
p->battle_records.place_counts[2].load(),
p->battle_records.place_counts[3].load(),
});
ret.emplace("BattlePlaceCounts", std::move(battle_place_counts));
ret.emplace("BattleDisconnectCount", p->battle_records.disconnect_count.load());
if (!is_ep3(c->version())) {
auto json_for_challenge_times = []<size_t Count>(const parray<ChallengeTime<false>, Count>& times) -> JSON {
auto times_json = JSON::list();
for (size_t z = 0; z < times.size(); z++) {
times_json.emplace_back(times[z].load());
}
return times_json;
};
ret.emplace("ChallengeTitleColorXRGB1555", p->challenge_records.title_color.load());
ret.emplace("ChallengeTimesEp1Online", json_for_challenge_times(p->challenge_records.times_ep1_online));
ret.emplace("ChallengeTimesEp2Online", json_for_challenge_times(p->challenge_records.times_ep2_online));
ret.emplace("ChallengeTimesEp1Offline", json_for_challenge_times(p->challenge_records.times_ep1_offline));
ret.emplace("ChallengeGraveIsEp2", p->challenge_records.grave_is_ep2 ? true : false);
ret.emplace("ChallengeGraveStageNum", p->challenge_records.grave_stage_num);
ret.emplace("ChallengeGraveFloor", p->challenge_records.grave_floor);
ret.emplace("ChallengeGraveDeaths", p->challenge_records.grave_deaths.load());
{
uint16_t year = 2000 + ((p->challenge_records.grave_time >> 28) & 0x0F);
uint8_t month = (p->challenge_records.grave_time >> 24) & 0x0F;
uint8_t day = (p->challenge_records.grave_time >> 16) & 0xFF;
uint8_t hour = (p->challenge_records.grave_time >> 8) & 0xFF;
uint8_t minute = p->challenge_records.grave_time & 0xFF;
ret.emplace("ChallengeGraveTime", string_printf("%04hu-%02hhu-%02hhu %02hhu:%02hhu:00", year, month, day, hour, minute));
}
string grave_enemy_types;
if (p->challenge_records.grave_defeated_by_enemy_rt_index) {
for (EnemyType type : enemy_types_for_rare_table_index(p->challenge_records.grave_is_ep2 ? Episode::EP2 : Episode::EP1, p->challenge_records.grave_defeated_by_enemy_rt_index)) {
if (!grave_enemy_types.empty()) {
grave_enemy_types += "/";
}
grave_enemy_types += name_for_enum(type);
}
}
ret.emplace("ChallengeGraveDefeatedByEnemy", std::move(grave_enemy_types));
ret.emplace("ChallengeGraveX", p->challenge_records.grave_x.load());
ret.emplace("ChallengeGraveY", p->challenge_records.grave_y.load());
ret.emplace("ChallengeGraveZ", p->challenge_records.grave_z.load());
ret.emplace("ChallengeGraveTeam", p->challenge_records.grave_team.decode());
ret.emplace("ChallengeGraveMessage", p->challenge_records.grave_message.decode());
ret.emplace("ChallengeAwardStateEp1OnlineFlags", p->challenge_records.ep1_online_award_state.rank_award_flags.load());
ret.emplace("ChallengeAwardStateEp1OnlineMaxRank", p->challenge_records.ep1_online_award_state.maximum_rank.load());
ret.emplace("ChallengeAwardStateEp2OnlineFlags", p->challenge_records.ep2_online_award_state.rank_award_flags.load());
ret.emplace("ChallengeAwardStateEp2OnlineMaxRank", p->challenge_records.ep2_online_award_state.maximum_rank.load());
ret.emplace("ChallengeAwardStateEp1OfflineFlags", p->challenge_records.ep1_offline_award_state.rank_award_flags.load());
ret.emplace("ChallengeAwardStateEp1OfflineMaxRank", p->challenge_records.ep1_offline_award_state.maximum_rank.load());
ret.emplace("ChallengeRankTitle", p->challenge_records.rank_title.decode());
}
}
return ret;
}
JSON HTTPServer::generate_proxy_client_json_st(shared_ptr<const ProxyServer::LinkedSession> ses) {
struct LobbyPlayer {
uint32_t guild_card_number = 0;
uint64_t xb_user_id = 0;
std::string name;
uint8_t language = 0;
uint8_t section_id = 0;
uint8_t char_class = 0;
};
std::vector<LobbyPlayer> lobby_players;
auto lobby_players_json = JSON::list();
for (size_t z = 0; z < ses->lobby_players.size(); z++) {
const auto& p = ses->lobby_players[z];
if (p.guild_card_number) {
lobby_players_json.emplace_back(JSON::dict({
{"GuildCardNumber", p.guild_card_number},
{"Name", p.name},
{"Language", name_for_language_code(p.language)},
{"SectionID", name_for_section_id(p.section_id)},
{"CharClass", name_for_char_class(p.char_class)},
}));
lobby_players_json.back().emplace("XBUserID", p.xb_user_id ? p.xb_user_id : JSON(nullptr));
} else {
lobby_players_json.emplace_back(nullptr);
}
}
auto ret = JSON::dict({
{"ID", ses->id},
{"RemoteClientAddress", render_sockaddr_storage(ses->client_channel.remote_addr)},
{"RemoteServerAddress", render_sockaddr_storage(ses->server_channel.remote_addr)},
{"LocalPort", ses->local_port},
{"NextDestination", render_sockaddr_storage(ses->next_destination)},
{"Version", name_for_enum(ses->version())},
{"SubVersion", ses->sub_version},
{"Name", ses->character_name},
{"DCHardwareID", ses->hardware_id},
{"RemoteGuildCardNumber", ses->remote_guild_card_number},
{"RemoteClientConfigData", format_data_string(&ses->remote_client_config_data[0], ses->remote_client_config_data.size())},
{"Config", HTTPServer::generate_client_config_json_st(ses->config)},
{"Language", name_for_language_code(ses->language())},
{"LobbyClientID", ses->lobby_client_id},
{"LeaderClientID", ses->leader_client_id},
{"LocationX", ses->x},
{"LocationZ", ses->z},
{"LocationFloor", ses->floor},
{"IsInGame", ses->is_in_game},
{"IsInQuest", ses->is_in_quest},
{"LobbyEvent", ses->lobby_event},
{"LobbyDifficulty", name_for_difficulty(ses->lobby_difficulty)},
{"LobbySectionID", name_for_section_id(ses->lobby_section_id)},
{"LobbyMode", name_for_mode(ses->lobby_mode)},
{"LobbyEpisode", name_for_episode(ses->lobby_episode)},
{"LobbyRandomSeed", ses->lobby_random_seed},
{"LobbyPlayers", std::move(lobby_players_json)},
});
switch (ses->drop_mode) {
case ProxyServer::LinkedSession::DropMode::DISABLED:
ret.emplace("DropMode", "none");
break;
case ProxyServer::LinkedSession::DropMode::PASSTHROUGH:
ret.emplace("DropMode", "default");
break;
case ProxyServer::LinkedSession::DropMode::INTERCEPT:
ret.emplace("DropMode", "proxy");
break;
}
ret.emplace("License", ses->license ? HTTPServer::generate_license_json_st(ses->license) : JSON(nullptr));
return ret;
}
JSON HTTPServer::generate_lobby_json_st(shared_ptr<const Lobby> l, shared_ptr<const ItemNameIndex> item_name_index) {
std::array<std::shared_ptr<Client>, 12> clients;
auto client_ids_json = JSON::list();
for (size_t z = 0; z < l->max_clients; z++) {
client_ids_json.emplace_back(l->clients[z] ? l->clients[z]->id : JSON(nullptr));
}
auto ret = JSON::dict({
{"ID", l->lobby_id},
{"AllowedVersions", l->allowed_versions},
{"Event", l->event},
{"LeaderClientID", l->leader_id},
{"MaxClients", l->max_clients},
{"IdleTimeoutUsecs", l->idle_timeout_usecs},
{"ClientIDs", std::move(client_ids_json)},
{"IsGame", l->is_game()},
{"IsPersistent", l->check_flag(Lobby::Flag::PERSISTENT)},
});
if (l->is_game()) {
ret.emplace("CheatsEnabled", l->check_flag(Lobby::Flag::CHEATS_ENABLED));
ret.emplace("MinLevel", l->min_level + 1);
ret.emplace("MaxLevel", l->max_level + 1);
ret.emplace("BaseVersion", l->base_version);
ret.emplace("Episode", name_for_episode(l->episode));
ret.emplace("HasPassword", !l->password.empty());
ret.emplace("Name", l->name);
ret.emplace("RandomSeed", l->random_seed);
if (l->episode != Episode::EP3) {
ret.emplace("QuestInProgress", l->check_flag(Lobby::Flag::QUEST_IN_PROGRESS));
ret.emplace("JoinableQuestInProgress", l->check_flag(Lobby::Flag::JOINABLE_QUEST_IN_PROGRESS));
auto variations_json = JSON::list();
for (size_t z = 0; z < l->variations.size(); z++) {
variations_json.emplace_back(l->variations[z].load());
}
ret.emplace("Variations", std::move(variations_json));
ret.emplace("SectionID", name_for_section_id(l->effective_section_id()));
ret.emplace("Mode", name_for_mode(l->mode));
ret.emplace("Difficulty", name_for_difficulty(l->difficulty));
ret.emplace("BaseEXPMultiplier", l->base_exp_multiplier);
ret.emplace("AllowedDropModes", l->allowed_drop_modes);
switch (l->drop_mode) {
case Lobby::DropMode::DISABLED:
ret.emplace("DropMode", "none");
break;
case Lobby::DropMode::CLIENT:
ret.emplace("DropMode", "client");
break;
case Lobby::DropMode::SERVER_SHARED:
ret.emplace("DropMode", "shared");
break;
case Lobby::DropMode::SERVER_PRIVATE:
ret.emplace("DropMode", "private");
break;
case Lobby::DropMode::SERVER_DUPLICATE:
ret.emplace("DropMode", "duplicate");
break;
}
if (l->mode == GameMode::CHALLENGE) {
ret.emplace("ChallengeEXPMultiplier", l->challenge_exp_multiplier);
if (l->challenge_params) {
ret.emplace("ChallengeStageNumber", l->challenge_params->stage_number);
ret.emplace("ChallengeRankColor", l->challenge_params->rank_color);
ret.emplace("ChallengeRankText", l->challenge_params->rank_text);
ret.emplace("ChallengeRank0ThresholdBitmask", l->challenge_params->rank_thresholds[0].bitmask);
ret.emplace("ChallengeRank0ThresholdSeconds", l->challenge_params->rank_thresholds[0].seconds);
ret.emplace("ChallengeRank1ThresholdBitmask", l->challenge_params->rank_thresholds[1].bitmask);
ret.emplace("ChallengeRank1ThresholdSeconds", l->challenge_params->rank_thresholds[1].seconds);
ret.emplace("ChallengeRank2ThresholdBitmask", l->challenge_params->rank_thresholds[2].bitmask);
ret.emplace("ChallengeRank2ThresholdSeconds", l->challenge_params->rank_thresholds[2].seconds);
}
}
auto floor_items_json = JSON::list();
for (size_t floor = 0; floor < l->floor_item_managers.size(); floor++) {
for (const auto& it : l->floor_item_managers[floor].items) {
const auto& item = it.second;
auto item_dict = JSON::dict({
{"LocationFloor", floor},
{"LocationX", item->x},
{"LocationZ", item->z},
{"DropNumber", item->drop_number},
{"VisibilityFlags", item->visibility_flags},
{"Data", item->data.hex()},
{"ItemID", item->data.id.load()},
});
if (item_name_index) {
item_dict.emplace("Description", item_name_index->describe_item(item->data, false));
}
floor_items_json.emplace_back(std::move(item_dict));
}
}
ret.emplace("FloorItems", std::move(floor_items_json));
ret.emplace("Quest", HTTPServer::generate_quest_json_st(l->quest));
} else {
ret.emplace("BattleInProgress", l->check_flag(Lobby::Flag::BATTLE_IN_PROGRESS));
ret.emplace("IsSpectatorTeam", l->check_flag(Lobby::Flag::IS_SPECTATOR_TEAM));
ret.emplace("SpectatorsForbidden", l->check_flag(Lobby::Flag::SPECTATORS_FORBIDDEN));
auto ep3s = l->ep3_server;
if (ep3s) {
auto players_json = JSON::list();
for (size_t z = 0; z < 4; z++) {
if (!ep3s->name_entries[z].present) {
players_json.emplace_back(nullptr);
} else {
auto lc = l->clients[z];
auto deck_entry = ep3s->deck_entries[z];
JSON deck_json = nullptr;
if (deck_entry) {
auto cards_json = JSON::list();
for (size_t w = 0; w < deck_entry->card_ids.size(); w++) {
try {
const auto& ce = ep3s->options.card_index->definition_for_id(deck_entry->card_ids[w]);
auto name = ce->def.en_name.decode();
if (name.empty()) {
name = ce->def.en_short_name.decode();
}
if (name.empty()) {
name = ce->def.jp_name.decode();
}
if (name.empty()) {
name = ce->def.jp_short_name.decode();
}
cards_json.emplace_back(name);
} catch (const out_of_range&) {
cards_json.emplace_back(deck_entry->card_ids[w].load());
}
}
deck_json = JSON::dict({
{"Name", deck_entry->name.decode(lc ? lc->language() : 1)},
{"TeamID", deck_entry->team_id.load()},
{"Cards", std::move(cards_json)},
{"GodWhimFlag", deck_entry->god_whim_flag},
{"PlayerLevel", deck_entry->player_level.load()},
});
}
auto player_json = JSON::dict({
{"PlayerName", ep3s->name_entries[z].name.decode(lc ? lc->language() : 1)},
{"ClientID", ep3s->name_entries[z].client_id},
{"IsCOM", !!ep3s->name_entries[z].is_cpu_player},
{"Deck", std::move(deck_json)},
});
players_json.emplace_back(std::move(player_json));
}
}
auto battle_state_json = JSON::dict({
{"BehaviorFlags", ep3s->options.behavior_flags},
{"RandomSeed", ep3s->options.opt_rand_crypt ? ep3s->options.opt_rand_crypt->seed() : JSON(nullptr)},
{"RandomOffset", ep3s->options.opt_rand_crypt ? ep3s->options.opt_rand_crypt->absolute_offset() : JSON(nullptr)},
{"Tournament", ep3s->options.tournament ? ep3s->options.tournament->json() : nullptr},
{"MapNumber", ep3s->last_chosen_map ? ep3s->last_chosen_map->map_number : JSON(nullptr)},
{"EnvironmentNumber", ep3s->map_and_rules ? ep3s->map_and_rules->environment_number : JSON(nullptr)},
{"Rules", ep3s->map_and_rules ? ep3s->map_and_rules->rules.json() : nullptr},
{"Players", std::move(players_json)},
{"IsBattleFinished", ep3s->battle_finished},
{"IsBattleInprogress", ep3s->battle_in_progress},
{"RoundNumber", ep3s->round_num},
{"FirstTeamTurn", ep3s->first_team_turn},
{"CurrentTeamTurn", ep3s->current_team_turn1},
{"BattlePhase", name_for_enum(ep3s->battle_phase)},
{"SetupPhase", ep3s->setup_phase},
{"RegistrationPhase", ep3s->registration_phase},
{"ActionSubphase", ep3s->action_subphase},
{"BattleStartTimeUsecs", ep3s->battle_start_usecs},
{"TeamEXP", JSON::list({ep3s->team_exp[0], ep3s->team_exp[1]})},
{"TeamDiceBonus", JSON::list({ep3s->team_dice_bonus[0], ep3s->team_dice_bonus[1]})},
});
// std::shared_ptr<StateFlags> state_flags;
// std::array<std::shared_ptr<PlayerState>, 4> player_states;
ret.emplace("Episode3BattleState", std::move(battle_state_json));
} else {
ret.emplace("Episode3BattleState", nullptr);
}
auto watched_lobby = l->watched_lobby.lock();
if (watched_lobby) {
ret.emplace("WatchedLobbyID", watched_lobby->lobby_id);
}
auto watcher_lobby_ids_json = JSON::list();
for (const auto& watcher_lobby : l->watcher_lobbies) {
watcher_lobby_ids_json.emplace_back(watcher_lobby->lobby_id);
}
ret.emplace("WatcherLobbyIDs", std::move(watcher_lobby_ids_json));
ret.emplace("IsReplayLobby", !!l->battle_player);
}
} else { // Not game
ret.emplace("IsPublic", l->check_flag(Lobby::Flag::PUBLIC));
ret.emplace("IsDefault", l->check_flag(Lobby::Flag::DEFAULT));
ret.emplace("IsOverflow", l->check_flag(Lobby::Flag::IS_OVERFLOW));
ret.emplace("Block", l->block);
}
return ret;
}
JSON HTTPServer::generate_game_server_clients_json() const {
return call_on_event_thread<JSON>(this->state->base, [&]() {
auto res = JSON::list();
for (const auto& it : this->state->channel_to_client) {
res.emplace_back(this->generate_game_client_json_st(it.second, this->state->item_name_index_opt(it.second->version())));
}
return res;
});
}
JSON HTTPServer::generate_proxy_server_clients_json() const {
return call_on_event_thread<JSON>(this->state->base, [&]() {
JSON res = JSON::list();
for (const auto& it : this->state->proxy_server->all_sessions()) {
res.emplace_back(this->generate_proxy_client_json_st(it.second));
}
return res;
});
}
JSON HTTPServer::generate_server_info_json() const {
return call_on_event_thread<JSON>(this->state->base, [&]() {
size_t game_count = 0;
size_t lobby_count = 0;
for (const auto& it : this->state->id_to_lobby) {
if (it.second->is_game()) {
game_count++;
} else {
lobby_count++;
}
}
uint64_t uptime_usecs = now() - this->state->creation_time;
return JSON::dict({
{"StartTimeUsecs", this->state->creation_time},
{"StartTime", format_time(this->state->creation_time)},
{"UptimeUsecs", uptime_usecs},
{"Uptime", format_duration(uptime_usecs)},
{"LobbyCount", lobby_count},
{"GameCount", game_count},
{"ClientCount", this->state->channel_to_client.size()},
{"ProxySessionCount", this->state->proxy_server->num_sessions()},
{"ServerName", this->state->name},
});
});
}
JSON HTTPServer::generate_lobbies_json() const {
return call_on_event_thread<JSON>(this->state->base, [&]() {
JSON res = JSON::list();
for (const auto& it : this->state->id_to_lobby) {
res.emplace_back(this->generate_lobby_json_st(it.second, this->state->item_name_index_opt(it.second->base_version)));
}
return res;
});
}
JSON HTTPServer::generate_summary_json() const {
auto ret = call_on_event_thread<JSON>(this->state->base, [&]() {
auto clients_json = JSON::list();
for (const auto& it : this->state->channel_to_client) {
auto c = it.second;
auto p = c->character(false, false);
auto l = c->lobby.lock();
clients_json.emplace_back(JSON::dict({
{"ID", c->id},
{"SerialNumber", c->license ? c->license->serial_number : JSON(nullptr)},
{"Name", p ? p->disp.name.decode(it.second->language()) : JSON(nullptr)},
{"Version", name_for_enum(it.second->version())},
{"Language", name_for_language_code(it.second->language())},
{"Level", p ? p->disp.stats.level + 1 : JSON(nullptr)},
{"Class", p ? name_for_char_class(p->disp.visual.char_class) : JSON(nullptr)},
{"SectionID", p ? name_for_section_id(p->disp.visual.section_id) : JSON(nullptr)},
{"LobbyID", l ? l->lobby_id : JSON(nullptr)},
}));
}
auto proxy_clients_json = JSON::list();
for (const auto& it : this->state->proxy_server->all_sessions()) {
proxy_clients_json.emplace_back(JSON::dict({
{"SerialNumber", it.second->license ? it.second->license->serial_number : JSON(nullptr)},
{"Name", it.second->character_name},
{"Version", name_for_enum(it.second->version())},
{"Language", name_for_language_code(it.second->language())},
}));
}
auto games_json = JSON::list();
for (const auto& it : this->state->id_to_lobby) {
auto l = it.second;
if (l->is_game()) {
auto game_json = JSON::dict({
{"ID", l->lobby_id},
{"Name", l->name},
{"BaseVersion", name_for_enum(l->base_version)},
{"Players", l->count_clients()},
{"CheatsEnabled", l->check_flag(Lobby::Flag::CHEATS_ENABLED)},
{"Episode", name_for_episode(l->episode)},
{"HasPassword", !l->password.empty()},
});
if (l->episode == Episode::EP3) {
auto ep3s = l->ep3_server;
game_json.emplace("BattleInProgress", l->check_flag(Lobby::Flag::BATTLE_IN_PROGRESS));
game_json.emplace("IsSpectatorTeam", l->check_flag(Lobby::Flag::IS_SPECTATOR_TEAM));
game_json.emplace("MapNumber", (ep3s && ep3s->last_chosen_map) ? ep3s->last_chosen_map->map_number : JSON(nullptr));
game_json.emplace("Rules", (ep3s && ep3s->map_and_rules) ? ep3s->map_and_rules->rules.json() : nullptr);
} else {
game_json.emplace("QuestInProgress", l->check_flag(Lobby::Flag::QUEST_IN_PROGRESS));
game_json.emplace("JoinableQuestInProgress", l->check_flag(Lobby::Flag::JOINABLE_QUEST_IN_PROGRESS));
game_json.emplace("SectionID", name_for_section_id(l->effective_section_id()));
game_json.emplace("Mode", name_for_mode(l->mode));
game_json.emplace("Difficulty", name_for_difficulty(l->difficulty));
game_json.emplace("Quest", this->generate_quest_json_st(l->quest));
}
games_json.emplace_back(std::move(game_json));
}
}
return JSON::dict({
{"Clients", std::move(clients_json)},
{"ProxyClients", std::move(proxy_clients_json)},
{"Games", std::move(games_json)},
});
});
ret.emplace("Server", this->generate_server_info_json());
return ret;
}
JSON HTTPServer::generate_all_json() const {
return JSON::dict({
{"Clients", this->generate_game_server_clients_json()},
{"ProxyClients", this->generate_proxy_server_clients_json()},
{"Lobbies", this->generate_lobbies_json()},
{"Server", this->generate_server_info_json()},
});
}
JSON HTTPServer::generate_ep3_cards_json(bool trial) const {
auto index = call_on_event_thread<shared_ptr<const Episode3::CardIndex>>(this->state->base, [&]() {
return trial ? this->state->ep3_card_index_trial : this->state->ep3_card_index;
});
return index->definitions_json();
}
JSON HTTPServer::generate_common_tables_json() const {
auto [set_v2, set_v3_v4] = call_on_event_thread<pair<shared_ptr<const CommonItemSet>, shared_ptr<const CommonItemSet>>>(this->state->base, [&]() {
return make_pair(this->state->common_item_set_v2, this->state->common_item_set_v3_v4);
});
return JSON::dict({
{"v1_v2", set_v2->json()},
{"v3_v4", set_v3_v4->json()},
});
}
JSON HTTPServer::generate_rare_tables_json() const {
auto sets = call_on_event_thread<unordered_map<string, shared_ptr<const RareItemSet>>>(this->state->base, [&]() {
return this->state->rare_item_sets;
});
JSON ret = JSON::list();
for (const auto& it : sets) {
ret.emplace_back(it.first);
}
return ret;
}
JSON HTTPServer::generate_rare_table_json(const std::string& table_name) const {
try {
auto colls = call_on_event_thread<pair<shared_ptr<const RareItemSet>, shared_ptr<const ItemNameIndex>>>(this->state->base, [&]() {
const auto& table = this->state->rare_item_sets.at(table_name);
shared_ptr<const ItemNameIndex> name_index;
if (ends_with(table_name, "-v1")) {
name_index = this->state->item_name_index_opt(Version::DC_V1);
} else if (ends_with(table_name, "-v2")) {
name_index = this->state->item_name_index_opt(Version::PC_V2);
} else if (ends_with(table_name, "-v3")) {
name_index = this->state->item_name_index_opt(Version::GC_V3);
} else if (ends_with(table_name, "-v4")) {
name_index = this->state->item_name_index_opt(Version::BB_V4);
}
return make_pair(table, name_index);
});
return colls.first->json(colls.second);
} catch (const out_of_range&) {
throw http_error(404, "table does not exist");
}
}
void HTTPServer::handle_request(struct evhttp_request* req) {
shared_ptr<const JSON> ret;
uint32_t serialize_options = 0;
uint64_t start_time = now();
string uri = evhttp_request_get_uri(req);
try {
std::unordered_multimap<std::string, std::string> query;
size_t query_pos = uri.find('?');
if (query_pos != string::npos) {
query = this->parse_url_params(uri.substr(query_pos + 1));
uri.resize(query_pos);
}
static const string default_format_option = "false";
if (this->get_url_param(query, "format", &default_format_option) == "true") {
serialize_options |= JSON::SerializeOption::FORMAT | JSON::SerializeOption::SORT_DICT_KEYS;
}
if (this->get_url_param(query, "hex", &default_format_option) == "true") {
serialize_options |= JSON::SerializeOption::HEX_INTEGERS;
}
if (uri == "/") {
auto endpoints_json = JSON::list({
"/y/data/ep3-cards",
"/y/data/ep3-cards-trial",
"/y/data/common-tables",
"/y/data/rare-tables",
"/y/data/rare-tables/<TABLE-NAME>",
"/y/data/config",
"/y/clients",
"/y/proxy-clients",
"/y/lobbies",
"/y/server",
"/y/summary",
"/y/all",
});
ret = make_shared<JSON>(JSON::dict({{"endpoints", std::move(endpoints_json)}}));
} else if (uri == "/y/data/ep3-cards") {
ret = make_shared<JSON>(this->generate_ep3_cards_json(false));
} else if (uri == "/y/data/ep3-cards-trial") {
ret = make_shared<JSON>(this->generate_ep3_cards_json(true));
} else if (uri == "/y/data/common-tables") {
ret = make_shared<JSON>(this->generate_common_tables_json());
} else if (uri == "/y/data/rare-tables") {
ret = make_shared<JSON>(this->generate_rare_tables_json());
} else if (!strncmp(uri.c_str(), "/y/data/rare-tables/", 20)) {
ret = make_shared<JSON>(this->generate_rare_table_json(uri.substr(20)));
} else if (uri == "/y/data/config") {
ret = call_on_event_thread<shared_ptr<const JSON>>(this->state->base, [this]() { return this->state->config_json; });
} else if (uri == "/y/clients") {
ret = make_shared<JSON>(this->generate_game_server_clients_json());
} else if (uri == "/y/proxy-clients") {
ret = make_shared<JSON>(this->generate_proxy_server_clients_json());
} else if (uri == "/y/lobbies") {
ret = make_shared<JSON>(this->generate_lobbies_json());
} else if (uri == "/y/server") {
ret = make_shared<JSON>(this->generate_server_info_json());
} else if (uri == "/y/summary") {
ret = make_shared<JSON>(this->generate_summary_json());
} else if (uri == "/y/all") {
ret = make_shared<JSON>(this->generate_all_json());
} else {
throw http_error(404, "unknown action");
}
} catch (const http_error& e) {
unique_ptr<struct evbuffer, void (*)(struct evbuffer*)> out_buffer(evbuffer_new(), evbuffer_free);
evbuffer_add_printf(out_buffer.get(), "%s", e.what());
this->send_response(req, e.code, "text/plain", out_buffer.get());
return;
} catch (const exception& e) {
unique_ptr<struct evbuffer, void (*)(struct evbuffer*)> out_buffer(evbuffer_new(), evbuffer_free);
evbuffer_add_printf(out_buffer.get(), "Error during request: %s", e.what());
this->send_response(req, 500, "text/plain", out_buffer.get());
server_log.warning("internal server error during http request: %s", e.what());
return;
}
uint64_t handler_end = now();
unique_ptr<struct evbuffer, void (*)(struct evbuffer*)> out_buffer(evbuffer_new(), evbuffer_free);
string* serialized = new string(ret->serialize(JSON::SerializeOption::ESCAPE_CONTROLS_ONLY | serialize_options));
size_t size = serialized->size();
uint64_t serialize_end = now();
auto cleanup = +[](const void*, size_t, void* s) -> void {
delete reinterpret_cast<string*>(s);
};
evbuffer_add_reference(out_buffer.get(), serialized->data(), serialized->size(), cleanup, serialized);
this->send_response(req, 200, "application/json", out_buffer.get());
string handler_time = format_duration(handler_end - start_time);
string serialize_time = format_duration(serialize_end - handler_end);
string size_str = format_size(size);
server_log.info("[HTTPServer] %s in [handler: %s, serialize: %s, size: %s]",
uri.c_str(), handler_time.c_str(), serialize_time.c_str(), size_str.c_str());
}
void HTTPServer::thread_fn() {
event_base_loop(this->base.get(), EVLOOP_NO_EXIT_ON_EMPTY);
}
+76
View File
@@ -0,0 +1,76 @@
#pragma once
#include <event2/buffer.h>
#include <event2/event.h>
#include <event2/http.h>
#include <stdlib.h>
#include <memory>
#include <string>
#include "ProxyServer.hh"
#include "ServerState.hh"
class HTTPServer {
public:
HTTPServer(std::shared_ptr<ServerState> state);
HTTPServer(const HTTPServer&) = delete;
HTTPServer(HTTPServer&&) = delete;
HTTPServer& operator=(const HTTPServer&) = delete;
HTTPServer& operator=(HTTPServer&&) = delete;
virtual ~HTTPServer() = default;
void listen(const std::string& socket_path);
void listen(const std::string& addr, int port);
void listen(int port);
void add_socket(int fd);
void schedule_stop();
void wait_for_stop();
protected:
class http_error : public std::runtime_error {
public:
http_error(int code, const std::string& what);
int code;
};
std::shared_ptr<ServerState> state;
std::shared_ptr<struct event_base> base;
std::shared_ptr<struct evhttp> http;
std::thread th;
void thread_fn();
static void dispatch_handle_request(struct evhttp_request* req, void* ctx);
void handle_request(struct evhttp_request* req);
static const std::unordered_map<int, const char*> explanation_for_response_code;
static void send_response(struct evhttp_request* req, int code, const char* content_type, struct evbuffer* b);
static void send_response(struct evhttp_request* req, int code, const char* content_type, const char* fmt, ...);
static std::unordered_multimap<std::string, std::string> parse_url_params(const std::string& query);
static std::unordered_map<std::string, std::string> parse_url_params_unique(const std::string& query);
static const std::string& get_url_param(
const std::unordered_multimap<std::string, std::string>& params,
const std::string& key,
const std::string* _default = nullptr);
static JSON generate_quest_json_st(std::shared_ptr<const Quest> q);
static JSON generate_client_config_json_st(const Client::Config& config);
static JSON generate_license_json_st(std::shared_ptr<const License> l);
static JSON generate_game_client_json_st(std::shared_ptr<const Client> c, std::shared_ptr<const ItemNameIndex> item_name_index);
static JSON generate_proxy_client_json_st(std::shared_ptr<const ProxyServer::LinkedSession> ses);
static JSON generate_lobby_json_st(std::shared_ptr<const Lobby> l, std::shared_ptr<const ItemNameIndex> item_name_index);
JSON generate_game_server_clients_json() const;
JSON generate_proxy_server_clients_json() const;
JSON generate_server_info_json() const;
JSON generate_lobbies_json() const;
JSON generate_summary_json() const;
JSON generate_all_json() const;
JSON generate_ep3_cards_json(bool trial) const;
JSON generate_common_tables_json() const;
JSON generate_rare_tables_json() const;
JSON generate_rare_table_json(const std::string& table_name) const;
};
+108 -50
View File
@@ -135,28 +135,28 @@ IPStackSimulator::~IPStackSimulator() {
}
}
void IPStackSimulator::listen(const string& name, const string& socket_path, FrameInfo::LinkType link_type) {
void IPStackSimulator::listen(const string& name, const string& socket_path, Protocol proto) {
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, link_type);
this->add_socket(name, fd, proto);
}
void IPStackSimulator::listen(const string& name, const string& addr, int port, FrameInfo::LinkType link_type) {
void IPStackSimulator::listen(const string& name, const string& addr, int port, Protocol proto) {
if (port == 0) {
this->listen(name, addr, link_type);
this->listen(name, addr, proto);
} 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, link_type);
this->add_socket(name, fd, proto);
}
}
void IPStackSimulator::listen(const string& name, int port, FrameInfo::LinkType link_type) {
this->listen(name, "", port, link_type);
void IPStackSimulator::listen(const string& name, int port, Protocol proto) {
this->listen(name, "", port, proto);
}
void IPStackSimulator::add_socket(const string& name, int fd, FrameInfo::LinkType link_type) {
void IPStackSimulator::add_socket(const string& name, int fd, Protocol proto) {
unique_listener l(
evconnlistener_new(
this->base.get(),
@@ -166,7 +166,7 @@ void IPStackSimulator::add_socket(const string& name, int fd, FrameInfo::LinkTyp
0,
fd),
evconnlistener_free);
this->listening_sockets.emplace(piecewise_construct, forward_as_tuple(fd), forward_as_tuple(name, link_type, std::move(l)));
this->listening_sockets.emplace(piecewise_construct, forward_as_tuple(fd), forward_as_tuple(name, proto, std::move(l)));
}
uint32_t IPStackSimulator::connect_address_for_remote_address(uint32_t remote_addr) {
@@ -180,14 +180,15 @@ uint32_t IPStackSimulator::connect_address_for_remote_address(uint32_t remote_ad
}
}
IPStackSimulator::IPClient::IPClient(shared_ptr<IPStackSimulator> sim, FrameInfo::LinkType link_type, struct bufferevent* bev)
IPStackSimulator::IPClient::IPClient(shared_ptr<IPStackSimulator> sim, Protocol protocol, struct bufferevent* bev)
: sim(sim),
bev(bev, bufferevent_free),
link_type(link_type),
protocol(protocol),
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) {
struct timeval tv = usecs_to_timeval(60 * 1000 * 1000);
uint64_t idle_timeout_usecs = sim->state->client_idle_timeout_usecs;
struct timeval tv = usecs_to_timeval(idle_timeout_usecs);
event_add(this->idle_timeout_event.get(), &tv);
}
@@ -255,7 +256,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);
auto c = make_shared<IPClient>(this->shared_from_this(), listening_socket->link_type, bev);
auto c = make_shared<IPClient>(this->shared_from_this(), listening_socket->protocol, bev);
this->bev_to_client.emplace(make_pair(bev, c));
bufferevent_setcb(bev, &IPStackSimulator::dispatch_on_client_input, nullptr,
@@ -294,27 +295,69 @@ void IPStackSimulator::on_client_input(struct bufferevent* bev) {
return;
}
struct timeval tv = usecs_to_timeval(60 * 1000 * 1000);
auto sim = c->sim.lock();
uint64_t idle_timeout_usecs = sim ? sim->state->client_idle_timeout_usecs : 60000000;
struct timeval tv = usecs_to_timeval(idle_timeout_usecs);
event_add(c->idle_timeout_event.get(), &tv);
while (evbuffer_get_length(buf) >= 2) {
uint16_t frame_size;
evbuffer_copyout(buf, &frame_size, 2);
if (evbuffer_get_length(buf) < static_cast<size_t>(frame_size + 2)) {
break; // No complete frame available; done for now
}
switch (c->protocol) {
case Protocol::ETHERNET_TAPSERVER:
case Protocol::HDLC_TAPSERVER:
while (evbuffer_get_length(buf) >= 2) {
uint16_t frame_size;
evbuffer_copyout(buf, &frame_size, 2);
if (evbuffer_get_length(buf) < static_cast<size_t>(frame_size + 2)) {
break; // No complete frame available; done for now
}
evbuffer_drain(buf, 2);
string frame(frame_size, '\0');
evbuffer_remove(buf, frame.data(), frame.size());
evbuffer_drain(buf, 2);
string frame(frame_size, '\0');
evbuffer_remove(buf, frame.data(), frame.size());
try {
this->on_client_frame(c, frame);
} catch (const exception& e) {
if (ip_stack_simulator_log.warning("Failed to process frame: %s", e.what())) {
print_data(stderr, frame);
try {
this->on_client_frame(c, frame);
} catch (const exception& e) {
if (ip_stack_simulator_log.warning("Failed to process frame: %s", e.what())) {
print_data(stderr, frame);
}
}
}
}
break;
case Protocol::HDLC_RAW:
while (evbuffer_get_length(buf) >= 2) {
struct evbuffer_ptr res = evbuffer_search(buf, "\x7E", 1, nullptr);
if (res.pos < 0) {
break;
}
size_t start_offset = res.pos;
if (evbuffer_ptr_set(buf, &res, 1, EVBUFFER_PTR_ADD)) {
ip_stack_simulator_log.warning("Cannot advance search for end of frame");
break;
}
struct evbuffer_ptr end_res = evbuffer_search(buf, "\x7E", 1, &res);
if (end_res.pos < 0) {
break;
}
size_t frame_size = end_res.pos + 1 - start_offset;
if (start_offset) {
evbuffer_drain(buf, start_offset);
}
string frame(frame_size, '\0');
evbuffer_remove(buf, frame.data(), frame.size());
try {
this->on_client_frame(c, frame);
} catch (const exception& e) {
if (ip_stack_simulator_log.warning("Failed to process frame: %s", e.what())) {
print_data(stderr, frame);
}
}
}
break;
}
}
@@ -340,8 +383,8 @@ void IPStackSimulator::send_layer3_frame(shared_ptr<IPClient> c, FrameInfo::Prot
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: {
switch (c->protocol) {
case Protocol::ETHERNET_TAPSERVER: {
EthernetHeader ether;
ether.dest_mac = c->mac_addr;
ether.src_mac = this->host_mac_address_bytes;
@@ -373,7 +416,8 @@ void IPStackSimulator::send_layer3_frame(shared_ptr<IPClient> c, FrameInfo::Prot
break;
}
case FrameInfo::LinkType::HDLC: {
case Protocol::HDLC_TAPSERVER:
case Protocol::HDLC_RAW: {
HDLCHeader hdlc;
hdlc.start_sentinel1 = 0x7E;
hdlc.address = 0xFF;
@@ -410,8 +454,10 @@ void IPStackSimulator::send_layer3_frame(shared_ptr<IPClient> c, FrameInfo::Prot
print_data(stderr, w.str());
}
le_uint16_t frame_size = escaped.size();
evbuffer_add(out_buf, &frame_size, 2);
if (c->protocol == Protocol::HDLC_TAPSERVER) {
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);
@@ -425,9 +471,13 @@ void IPStackSimulator::send_layer3_frame(shared_ptr<IPClient> c, FrameInfo::Prot
}
void IPStackSimulator::on_client_frame(shared_ptr<IPClient> c, const string& frame) {
FrameInfo::LinkType link_type = (c->protocol == Protocol::ETHERNET_TAPSERVER)
? FrameInfo::LinkType::ETHERNET
: FrameInfo::LinkType::HDLC;
const string* effective_data = &frame;
string hdlc_unescaped_data;
if (c->link_type == FrameInfo::LinkType::HDLC) {
if (link_type == FrameInfo::LinkType::HDLC) {
hdlc_unescaped_data = unescape_hdlc_frame(frame);
effective_data = &hdlc_unescaped_data;
}
@@ -436,7 +486,7 @@ void IPStackSimulator::on_client_frame(shared_ptr<IPClient> c, const string& fra
}
this->log_frame(*effective_data);
FrameInfo fi(c->link_type, *effective_data);
FrameInfo fi(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());
@@ -1116,6 +1166,7 @@ void IPStackSimulator::on_client_tcp_frame(
throw runtime_error("non-SYN frame does not correspond to any open TCP connection");
}
bool conn_valid = true;
bool acked_seq_changed = false;
if (fi.tcp->flags & TCPHeader::Flag::ACK) {
ip_stack_simulator_log.debug("Client sent ACK %08" PRIX32, fi.tcp->ack_num.load());
@@ -1139,6 +1190,7 @@ void IPStackSimulator::on_client_tcp_frame(
conn->acked_server_seq += ack_delta;
conn->resend_push_usecs = DEFAULT_RESEND_PUSH_USECS;
conn->next_push_max_frame_size = conn->max_frame_size;
acked_seq_changed = true;
ip_stack_simulator_log.debug("Removed %08" PRIX32 " bytes from pending buffer and advanced acked_server_seq to %08" PRIX32,
ack_delta, conn->acked_server_seq);
@@ -1248,9 +1300,9 @@ void IPStackSimulator::on_client_tcp_frame(
conn_str.c_str(), conn->acked_server_seq, conn->next_client_seq, conn->bytes_received);
}
if (conn_valid) {
if (conn_valid && acked_seq_changed) {
// Try to send some more data if the client is waiting on it
this->send_pending_push_frame(c, *conn);
this->send_pending_push_frame(c, *conn, true);
}
}
}
@@ -1304,19 +1356,28 @@ void IPStackSimulator::open_server_connection(shared_ptr<IPClient> c, IPClient::
}
}
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, bool always_send) {
size_t pending_bytes = evbuffer_get_length(conn.pending_data.get());
if (!pending_bytes) {
event_del(conn.resend_push_event.get());
return;
}
// If we're waiting to receive an ACK from the client, don't send another PSH
// until we get the ACK (unless this is a resend of a previous PSH due to a
// timeout)
if (!always_send && event_pending(conn.resend_push_event.get(), EV_TIMEOUT, nullptr)) {
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)) {
if (c->protocol == Protocol::HDLC_TAPSERVER) {
// 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;
bytes_to_send = min<size_t>(bytes_to_send, 200);
}
ip_stack_simulator_log.debug("Sending PSH frame with seq_num %08" PRIX32 ", 0x%zX/0x%zX data bytes",
@@ -1335,8 +1396,7 @@ void IPStackSimulator::send_pending_push_frame(shared_ptr<IPClient> c, IPClient:
if (conn.resend_push_usecs > 5000000) {
conn.resend_push_usecs = 5000000;
}
conn.next_push_max_frame_size = max<size_t>(
0x100, conn.next_push_max_frame_size - 0x100);
conn.next_push_max_frame_size = max<size_t>(0x100, conn.next_push_max_frame_size - 0x100);
}
void IPStackSimulator::send_tcp_frame(
@@ -1397,15 +1457,11 @@ void IPStackSimulator::dispatch_on_resend_push(evutil_socket_t, short, void* ctx
if (!sim) {
ip_stack_simulator_log.warning("Resend push event triggered for client on deleted simulator; ignoring");
} else {
sim->on_resend_push(c, *conn);
sim->send_pending_push_frame(c, *conn, true);
}
}
}
void IPStackSimulator::on_resend_push(shared_ptr<IPClient> c, IPClient::TCPConnection& conn) {
this->send_pending_push_frame(c, conn);
}
void IPStackSimulator::dispatch_on_server_input(struct bufferevent*, void* ctx) {
auto* conn = reinterpret_cast<IPClient::TCPConnection*>(ctx);
auto c = conn->client.lock();
@@ -1426,11 +1482,13 @@ void IPStackSimulator::on_server_input(shared_ptr<IPClient> c, IPClient::TCPConn
ip_stack_simulator_log.debug("Server input event: 0x%zX bytes to read",
evbuffer_get_length(buf));
struct timeval tv = usecs_to_timeval(60 * 1000 * 1000);
auto sim = c->sim.lock();
uint64_t idle_timeout_usecs = sim ? sim->state->client_idle_timeout_usecs : 60000000;
struct timeval tv = usecs_to_timeval(idle_timeout_usecs);
event_add(c->idle_timeout_event.get(), &tv);
evbuffer_add_buffer(conn.pending_data.get(), buf);
this->send_pending_push_frame(c, conn);
this->send_pending_push_frame(c, conn, false);
}
void IPStackSimulator::dispatch_on_server_error(

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