Compare commits

..

832 Commits

Author SHA1 Message Date
Martin Michelsen 5ea3d0ad4b add missing quest files 2024-07-10 20:41:18 -07:00
Martin Michelsen 90efde7aa9 handle rare shell i/o error 2024-07-10 19:48:51 -07:00
Martin Michelsen 55f1869125 add replace sound effects code 2024-07-08 01:08:43 -07:00
Martin Michelsen b4efd90fdc replace q050 and q052 with direct backports 2024-07-07 16:39:52 -07:00
Martin Michelsen 87dd554592 remove offset comments in reassembly mode 2024-07-07 15:19:18 -07:00
Martin Michelsen 58974ae1be use JP version as default sub_version 2024-07-06 12:57:30 -07:00
Martin Michelsen 21c8bab91c handle one 6x63 data race 2024-07-06 09:54:07 -07:00
Martin Michelsen c58b37be23 add GC-GJAM quest opcodes in handler-tables 2024-07-05 21:55:16 -07:00
Martin Michelsen d3d98c44b8 clear ep3 media when switching to proxy server 2024-07-04 16:25:21 -07:00
Martin Michelsen dc2e73d198 fix item notifications for mags on GC 2024-07-04 16:24:36 -07:00
Martin Michelsen 774f9649da fix binary operator bind order 2024-07-04 16:24:18 -07:00
Martin Michelsen 093287af75 fix condition icons in enemy HP bars patch 2024-06-29 22:25:32 -07:00
Martin Michelsen 0126189cbd fix 3OJ2 and 3OJ3 item loss patches 2024-06-29 12:22:27 -07:00
Martin Michelsen c250a2dbc4 update enemy HP bars patch 2024-06-28 20:57:16 -07:00
Martin Michelsen 2ff9df19c8 don't allow language fallback for q88500 2024-06-28 14:10:06 -07:00
Martin Michelsen 528593651b update TODO.md 2024-06-28 10:13:24 -07:00
Martin Michelsen 9f073d07cd don't use member initialization 2024-06-28 10:10:39 -07:00
Martin Michelsen 4bd6ef12a9 implement $savechar on Episode 3 2024-06-28 09:48:09 -07:00
Martin Michelsen 52644695a3 fix grind limit overdraft 2024-06-26 20:00:22 -07:00
Martin Michelsen 45e619718c fix patch menu on BB 2024-06-26 19:37:21 -07:00
nolrinale 43fd979763 Fixed Coren rewards item names causing parsing issues 2024-06-26 09:36:21 -07:00
Martin Michelsen 082bc49a4d add customization segregation test 2024-06-24 00:01:09 -07:00
Martin Michelsen 4adcaa7bee skip max grind check on v3 2024-06-24 00:00:48 -07:00
Martin Michelsen 630ae0beb4 fix stack limits on DC NTE 2024-06-23 22:38:46 -07:00
Martin Michelsen 246dfd9fe0 update notes on DC NTE quest commands 2024-06-23 22:38:46 -07:00
Martin Michelsen 6f056cb1bd update proxy options 2024-06-23 22:38:46 -07:00
Martin Michelsen 9322c023da fix missing sub_version check 2024-06-23 22:38:46 -07:00
Martin Michelsen fd4719f8ec clean up comments in q88500 2024-06-23 08:38:51 -07:00
Martin Michelsen 3a22a5c489 add Ep3 codepaths to B2 enabler 2024-06-23 00:24:01 -07:00
Martin Michelsen 862b3d27da add B2 patch support on PSO Plus 2024-06-22 21:42:30 -07:00
Martin Michelsen 998664d2fb add loading screen AR code 2024-06-22 17:22:02 -07:00
Martin Michelsen 0bf2d950ac fix offsets on DCv1 item loss patches 2024-06-22 15:23:38 -07:00
Martin Michelsen 3ae5e875a1 fix comments on some quest opcodes 2024-06-22 15:23:23 -07:00
Martin Michelsen a88795d8b9 fix edge case in quest episode detection 2024-06-22 15:22:52 -07:00
Martin Michelsen 9ca1b79409 add .include directives in quest assembler 2024-06-22 15:22:32 -07:00
Martin Michelsen ce8277b96a describe 6x51 command 2024-06-22 15:20:48 -07:00
Martin Michelsen 25731eb71f add comments about UDP subcommands 2024-06-22 15:20:39 -07:00
Martin Michelsen e55963b82b specify types on some quest handlers 2024-06-22 14:22:29 -07:00
Martin Michelsen b9d9b38351 add US v1.2 quest opcodes to handler-tables 2024-06-22 09:29:40 -07:00
Martin Michelsen 782babf3ae add quest opcode names in handler-tables 2024-06-22 09:07:37 -07:00
Martin Michelsen 9869fa03c2 only send notifs for client-generated items if the game drop mode is CLIENT 2024-06-21 11:02:59 -07:00
Martin Michelsen 0ae02b0191 add websocket endpoint for rare drop stream 2024-06-21 10:59:01 -07:00
Martin Michelsen c0ea976fdc fix typo in VersionDetectGC 2024-06-21 10:59:01 -07:00
nolrinale c4bf9e7d5b Adjusted Coren rewards to match Retail server ones 2024-06-20 20:24:05 -07:00
Martin Michelsen 2e5d95d612 fix data race in 6xCA command 2024-06-19 23:31:51 -07:00
nolrinale 75b2827da9 Corrected BB english client files 2024-06-18 19:37:37 -07:00
Martin Michelsen 5b72e59ebe fix mag flag reset during combo item apply 2024-06-18 09:56:29 -07:00
Matt Swift d2c16b5363 Add Ultimate Map Fix for DCv2 2024-06-18 09:53:08 -07:00
Martin Michelsen 977ed05526 don't let item parsing from config.json prevent server startup 2024-06-18 08:55:55 -07:00
Martin Michelsen e2c34dfb70 add option to enable switch assist by default 2024-06-17 22:02:31 -07:00
Martin Michelsen 4416579210 add 11/2000 item loss patch 2024-06-17 00:42:31 -07:00
Martin Michelsen 5f591ac189 add DCv1 item loss patches 2024-06-16 23:50:37 -07:00
Martin Michelsen aa9d2beffe convert all CRLF line endings to LF only 2024-06-16 21:03:00 -07:00
Martin Michelsen 24656d587b make $where show other players' floors 2024-06-16 11:03:44 -07:00
Martin Michelsen fbaf7d722d delete overlay before parsing character data in 98 command 2024-06-16 10:44:16 -07:00
Martin Michelsen bda5c40cc2 fix disassembly of invalid episode numbers in quest headers 2024-06-16 10:44:00 -07:00
Martin Michelsen eeac5ccf4d refine battle mode commands structures 2024-06-16 10:43:46 -07:00
Martin Michelsen bbff30071e fix battle mode level up on players close to level 200 2024-06-16 10:11:35 -07:00
Martin Michelsen a7a512682c fix unsealable item kill count check 2024-06-16 00:10:12 -07:00
Martin Michelsen f3f933aaca add lobby order option for client customization 2024-06-15 17:25:58 -07:00
Martin Michelsen 5433663866 fix Guild Card comment update on BB 2024-06-15 17:11:31 -07:00
Martin Michelsen 598120c661 implement BB EXP share 2024-06-15 16:45:09 -07:00
Martin Michelsen d4f885fad1 fix 6xE3 client ID field 2024-06-15 15:20:08 -07:00
Martin Michelsen 8ab1eabda7 remove TODO 2024-06-15 15:09:43 -07:00
Martin Michelsen d23775f069 use overlay for 07ED command 2024-06-15 10:18:19 -07:00
Martin Michelsen de45f49b78 add name color for IS_CLIENT_CUSTOMIZATION flag 2024-06-15 09:56:04 -07:00
Martin Michelsen 2608d5d601 fix episode 4 bonus value tables 2024-06-14 23:43:36 -07:00
Martin Michelsen 92df4ff1e2 add CommonItemSet introspection 2024-06-14 23:41:29 -07:00
Martin Michelsen 27ecab2993 fix register reassignment if name doesn't appear first in file 2024-06-13 23:38:20 -07:00
Martin Michelsen 3dc106b42e add comments in EventUtils 2024-06-10 20:20:51 -07:00
Martin Michelsen 768e8bbfe2 make label/register assignment order deterministic 2024-06-04 22:08:18 -07:00
Martin Michelsen 324f681c46 use concise existence checks in test scripts 2024-06-04 21:28:20 -07:00
Martin Michelsen d178d062a8 add named registers in quest assembler 2024-06-04 21:17:22 -07:00
Martin Michelsen 3ac421cf55 add note about GC target crashes 2024-06-03 21:00:42 -07:00
Martin Michelsen 0e9bd019af add comment about TItemDrop random states 2024-06-02 08:43:38 -07:00
Martin Michelsen 5ce4eb8cfc fix unary operator bind order in integral tree parser 2024-05-31 23:05:19 -07:00
Martin Michelsen 64082fa872 fix attribution on some patch ports 2024-05-28 22:52:10 -07:00
Martin Michelsen 063f67d3f6 add section on license 2024-05-28 22:12:40 -07:00
Martin Michelsen 5df98fb691 speed up quest loading 2024-05-28 22:12:17 -07:00
Martin Michelsen a686d81d4c fix gcc-specific compiler warnings 2024-05-28 22:12:17 -07:00
Martin Michelsen bc9fc25799 add number as well as name for when 2024-05-28 22:12:17 -07:00
Martin Michelsen 07d8e1df7b add enum for when 2024-05-28 22:12:17 -07:00
Martin Michelsen 7427fbd252 add room unlock sound in swsetall 2024-05-28 22:12:17 -07:00
Martin Michelsen 679f58937f move ep3 offline maps to not be available by default 2024-05-28 22:12:17 -07:00
Martin Michelsen af5770058b sync config files after major quest update 2024-05-28 22:12:17 -07:00
Matt Swift d2cb7a4cb8 Actually make Caelum C1 2v2 compatible 2024-05-28 22:12:17 -07:00
Matt Swift 62c778d877 Update Caelum C1 to be 2v2 compatible 2024-05-28 22:12:17 -07:00
Matt Swift 9dd6339fe8 Add custom content for Episode 3 2024-05-28 22:12:17 -07:00
Matt Swift 7b6b8151a7 Add custom content and backports for V1 to V3 2024-05-28 22:12:17 -07:00
Martin Michelsen e77ee397cd improve bank handling across version boundaries 2024-05-28 22:12:17 -07:00
Matt Swift 8775367043 Fix typo in GC targets for XB 2024-05-24 10:16:59 -07:00
Martin Michelsen ba752eb7dc update GC connection instructions in readme 2024-05-23 21:52:17 -07:00
Martin Michelsen 8421ab16d5 fix xbox rare alert patch 2024-05-22 22:13:47 -07:00
Martin Michelsen 340a36878b add $qfread command 2024-05-22 21:19:53 -07:00
Martin Michelsen 836704e987 track telepipe state in games 2024-05-21 20:29:32 -07:00
Martin Michelsen d0ff9bd048 update specific_version comments 2024-05-21 20:29:32 -07:00
Martin Michelsen 001c2c905f fix BB item subcommands in joinable quests 2024-05-19 09:06:38 -07:00
Martin Michelsen 443a0a3037 prevent players from joining game when quest menu is open 2024-05-19 09:06:38 -07:00
Martin Michelsen d294dbcc55 actually add v2/v3 level tables 2024-05-18 23:21:16 -07:00
Martin Michelsen 0c63d6a07f add v2/v3 level table files 2024-05-18 23:16:28 -07:00
Martin Michelsen 3f6157c03f add 3OJT versions of PlayerInfo patches 2024-05-18 23:16:05 -07:00
Martin Michelsen c8eab046c0 add GC NTE save file format 2024-05-18 21:25:11 -07:00
Martin Michelsen d8230eb37a load non-v4 level tables 2024-05-17 20:32:52 -07:00
Martin Michelsen f71980382a add favored weapon type table in comments 2024-05-16 21:35:21 -07:00
Martin Michelsen 0a8678fda7 fix tekker section id 2024-05-16 19:57:46 -07:00
Martin Michelsen adb5d51510 update save file structs and encode/decode pathways 2024-05-15 22:06:11 -07:00
Martin Michelsen 45679a7f98 add index comments in shop generator 2024-05-15 22:05:34 -07:00
Martin Michelsen f6f5ca47e9 fix flag check during mag evolution 2024-05-15 10:01:38 -07:00
Martin Michelsen a4ade28755 fix BB team flag transparency 2024-05-13 22:43:12 -07:00
Martin Michelsen c957ea6c10 reorganize some quests 2024-05-13 22:34:37 -07:00
Martin Michelsen 6bfb84d999 fix joinability flags on Japanese BB government quests 2024-05-13 22:16:44 -07:00
Martin Michelsen 49fbacf0fa make ep4 quests use orange icon 2024-05-13 21:55:42 -07:00
Martin Michelsen 79efce5252 fix Tethealla client detection 2024-05-13 21:55:32 -07:00
Martin Michelsen cb9a0ed1c4 move illegal delay slot instructions out of delay slots 2024-05-13 21:13:52 -07:00
Martin Michelsen fc5788364b don't encode/decode inventories in GC extended player data 2024-05-13 20:47:21 -07:00
Martin Michelsen df2b64a601 fix big-endian ints in xbox save file format 2024-05-13 20:40:36 -07:00
Martin Michelsen 2ff75fe132 implement savechar/loadchar on DCv2 and Xbox 2024-05-12 22:40:43 -07:00
Martin Michelsen 625e8e0624 recompress all quest files 2024-05-12 16:16:45 -07:00
Martin Michelsen de8ed72233 fix disassembly of max_players header field 2024-05-12 16:11:03 -07:00
Martin Michelsen ce2607253c add missing JP quests from PR #486 2024-05-12 16:08:57 -07:00
Martin Michelsen b6fb9051b6 refine PC save file format 2024-05-12 15:09:31 -07:00
Martin Michelsen f069622b94 add DCv1 save file structure 2024-05-12 00:17:52 -07:00
Martin Michelsen 0b7e532b32 clarify $infhp behaviors 2024-05-11 22:34:12 -07:00
Martin Michelsen f4e6a40097 clean up SaveFileFormats.hh 2024-05-11 22:31:16 -07:00
Martin Michelsen 2ed97974e0 add CallProtectedHandler on BB 2024-05-11 22:31:09 -07:00
Martin Michelsen 251a9ecd0a add DC version of GetExtendedPlayerInfo 2024-05-11 21:33:31 -07:00
Martin Michelsen 777ffc1108 update GC connection instructions 2024-05-11 19:36:39 -07:00
Martin Michelsen 3951a46386 fix typo in readme 2024-05-11 19:33:23 -07:00
Martin Michelsen bfbf1ba87e update BB connection instructions 2024-05-11 19:30:17 -07:00
Martin Michelsen dc7c3eb58c add DC v2 save file format 2024-05-11 18:18:17 -07:00
Martin Michelsen a0126bd6b5 fix bug in GetExtendedPlayerInfoGC 2024-05-11 18:18:17 -07:00
Martin Michelsen c86ecbe9ef explicitly clear unsaved flag in DC item loss patch 2024-05-11 14:28:31 -07:00
Martin Michelsen 99a606be18 add flag 0x40 in part2 2024-05-11 14:28:08 -07:00
Martin Michelsen 7ebae9ed9d update check_for_hacking quest opcode flags 2024-05-11 14:27:54 -07:00
Martin Michelsen e803ca54c6 update DC item loss patches 2024-05-10 00:37:09 -07:00
Martin Michelsen d619bff349 update xbox network location struct 2024-05-10 00:36:53 -07:00
Martin Michelsen c7cb81e0fc add DCv2 item loss prevention patch 2024-05-09 00:24:50 -07:00
Martin Michelsen f7c847bcf0 fix comment 2024-05-08 21:04:10 -07:00
Martin Michelsen b81d119906 update 6x49 command name 2024-05-07 21:34:13 -07:00
Martin Michelsen 5535d749b9 update headers in handler tables 2024-05-07 21:30:34 -07:00
Martin Michelsen 992d204a83 recompress all quest files 2024-05-07 20:29:21 -07:00
Martin Michelsen b478c035bb deduplicate E/J government quest dat files 2024-05-07 20:12:30 -07:00
nolrinale 0f81d98c6e Adjusted quest filtering defaults for BB's Gov. Quests 2024-05-07 19:10:41 -07:00
nolrinale edc659a241 Adds all the Government quests in Japanese for BB 2024-05-07 19:10:41 -07:00
Martin Michelsen ef08805f93 add BB idle disconnect patch 2024-05-06 09:11:39 -07:00
Martin Michelsen 70413668d8 support B2 patches on BB 2024-05-05 10:52:09 -07:00
Martin Michelsen 27bbb2c7e4 add --language option to disassemble_quest_script 2024-05-05 09:03:08 -07:00
Martin Michelsen 43ad1597a4 change quest category menu icons 2024-05-05 08:47:08 -07:00
Martin Michelsen ce0badde87 fix mag stats reset on item combination 2024-05-05 08:42:59 -07:00
Martin Michelsen 9d46d1042b more ep3 debugging 2024-05-05 08:42:44 -07:00
Martin Michelsen 2e7c792b97 fix equip state after item combinations applied 2024-05-04 20:39:52 -07:00
Martin Michelsen c411cec06c remove debug stub 2024-05-04 12:28:49 -07:00
Martin Michelsen 451c8d5e09 add DC idle disconnect patch 2024-05-04 11:52:06 -07:00
Martin Michelsen a35753fdf1 add GetExtendedPlayerInfo for xbox 2024-05-04 11:20:44 -07:00
Martin Michelsen ca6605877a set up DC patch framework 2024-05-04 10:51:42 -07:00
Martin Michelsen 59db3c82f9 generalize ARCodeTranslator 2024-05-04 10:49:51 -07:00
Martin Michelsen e42cfb649f fix NPC inventory item creation 2024-05-03 10:10:56 -07:00
Martin Michelsen cf88455975 override BB player language code at load time 2024-05-02 22:51:24 -07:00
Martin Michelsen b272f2326e check old drop tables against new tables 2024-05-02 21:43:24 -07:00
Martin Michelsen a29494b120 describe 6x8A in more detail 2024-05-02 09:47:18 -07:00
Martin Michelsen 4d172fff64 fix challenge mode times window 2024-05-01 23:26:46 -07:00
Martin Michelsen 57ea246dd7 prep for $loadchar on xbox 2024-05-01 23:26:46 -07:00
Martin Michelsen 636309952e don't allow loading quests in incorrect game mode 2024-05-01 08:31:00 -07:00
Martin Michelsen dfeeed2b1a clarify comments in b88001.json 2024-04-30 22:32:49 -07:00
Martin Michelsen f83822bba0 add option to allow $quest without $debug for certain quests 2024-04-30 22:27:45 -07:00
Martin Michelsen 60f67fa791 add debugging for compute_effective_range_and_target_mode_for_attack 2024-04-30 21:30:45 -07:00
Martin Michelsen 9b6a6e4412 fix HTTP server segfault if proxy server is disabled 2024-04-30 09:11:02 -07:00
Martin Michelsen 83b8c199b9 support GetExtendedPlayerInfo on xbox 2024-04-30 09:10:10 -07:00
Martin Michelsen 3f1939e674 increase number of savechar slots to 16 2024-04-29 22:21:08 -07:00
Martin Michelsen 31616954cc implement extended $loadchar on GC 2024-04-28 23:48:02 -07:00
Martin Michelsen ee21885f13 add more missing initializers 2024-04-28 15:38:57 -07:00
Martin Michelsen 2cc6a85d4b add missing initializer 2024-04-28 15:33:40 -07:00
Martin Michelsen 29320f0858 don't skip server data commands before battle start 2024-04-28 15:19:31 -07:00
Martin Michelsen 29f200b83e add a way for joinable quests to lock themselves 2024-04-28 00:23:21 -07:00
Martin Michelsen 09bf81f77f fix duplicate 6xDD commands 2024-04-27 18:31:10 -07:00
Martin Michelsen ddbb922b95 support joinable quests on all versions 2024-04-27 18:31:10 -07:00
Martin Michelsen c7dd98ccc0 use flag to separate customized GC clients from non-customized 2024-04-27 14:25:46 -07:00
Martin Michelsen f5c2c930d8 don't use $CG in any server announcements 2024-04-27 12:08:31 -07:00
Martin Michelsen 79fee4cec4 explain overwritten field in DecoctionXB 2024-04-27 10:26:02 -07:00
Martin Michelsen 0bec4d0f49 update sub_version conditions 2024-04-27 10:25:45 -07:00
Martin Michelsen a4fc133d75 block 6xB2 in most cases 2024-04-26 21:09:21 -07:00
Martin Michelsen 45c9dc9a23 rename PSOXReticleColors to match convention 2024-04-26 20:43:47 -07:00
Martin Michelsen 594ffbe7e6 add xbox rare drop notifs patch 2024-04-25 20:00:19 -07:00
Martin Michelsen 7decab75c2 update 6xB2 structure 2024-04-24 23:35:15 -07:00
Martin Michelsen 9815126ced save battle records when CA handler raises 2024-04-23 22:36:29 -07:00
Martin Michelsen 4b5eba3727 upgrade to c++23 2024-04-23 22:23:25 -07:00
Martin Michelsen 49010b02f1 sort CMakeLists 2024-04-22 22:07:04 -07:00
Martin Michelsen d08aaef0f8 add remote address to command log messages 2024-04-21 15:19:16 -07:00
Martin Michelsen 245df782b9 fix v2 battle record init sequence 2024-04-21 01:27:29 -07:00
Martin Michelsen 9ffe429a1f implement ban/unban accounts via the shell 2024-04-21 01:14:10 -07:00
Martin Michelsen 673c767a42 add random stream into Ep3 battle records 2024-04-21 01:14:10 -07:00
Martin Michelsen de42135532 implement IPv4 range bans 2024-04-21 01:14:10 -07:00
Martin Michelsen 79bf6b3fa9 fix rendering issue in readme 2024-04-20 14:31:41 -07:00
Martin Michelsen 741456d1da organize system/client-functions 2024-04-20 10:51:48 -07:00
Martin Michelsen c95b158e4e add decrypt/encrypt for simple DCv2 executable encryption 2024-04-20 10:51:48 -07:00
Martin Michelsen d40c260d18 fix infinite loop in determine_first_team_turn 2024-04-17 11:36:32 -07:00
Martin Michelsen 454e0e558b clean up notes directory 2024-04-17 08:30:00 -07:00
Martin Michelsen 5ea49425c7 don't fail on proxy server if maps don't load properly 2024-04-17 00:39:26 -07:00
Martin Michelsen 08ea9403e9 add encrypt/decrypt actions for DCv2 executables 2024-04-17 00:37:57 -07:00
Martin Michelsen f01882db39 improve PRS disassembly output 2024-04-17 00:37:30 -07:00
Martin Michelsen 1870273f89 add further learnings about Ep3 B9 command 2024-04-15 22:53:14 -07:00
Martin Michelsen d6edf1b24d set up framework for DC patching 2024-04-14 22:20:28 -07:00
Martin Michelsen 8ecbe6798d fix --config option to less-common commands 2024-04-14 20:58:55 -07:00
Martin Michelsen 587ad1933d add DC 50Hz sub_versions 2024-04-14 20:57:45 -07:00
Martin Michelsen 70548aef04 move Ep3 recording finalization to CA command handler 2024-04-14 13:56:24 -07:00
Martin Michelsen 43663cbe79 add missing include on linux 2024-04-12 22:24:04 -07:00
Martin Michelsen 5f2e7e543b fix some patch metadata 2024-04-12 22:17:16 -07:00
Martin Michelsen c98d1081a3 add support for auto-patching 2024-04-12 22:17:16 -07:00
Martin Michelsen 0b2272bfa7 don't show non-unique team rewards in purchased list 2024-04-12 22:09:52 -07:00
Martin Michelsen 04982d919c fix 11/2000 set data table 2024-04-12 22:09:52 -07:00
Martin Michelsen 34751f99e9 allow multiple licenses per account 2024-04-12 22:09:52 -07:00
Martin Michelsen 40d5c6ee64 fix --config option to non-server actions 2024-04-07 14:40:18 -07:00
Martin Michelsen be0b70f903 use existing test config for load-maps-test 2024-04-07 13:35:29 -07:00
Martin Michelsen 76aeacfdfd fix permission on custom-sji test input 2024-04-07 13:34:06 -07:00
Martin Michelsen dec979fb52 fix custom-sjis test 2024-04-07 13:13:58 -07:00
Martin Michelsen 1c85d46436 add load-maps test 2024-04-07 13:04:08 -07:00
Martin Michelsen f05dc6d9f9 handle PSO font characters properly 2024-04-07 13:03:11 -07:00
Martin Michelsen e141642dd6 fix episode field in game list command 2024-04-06 22:58:53 -07:00
Martin Michelsen af4d3a3325 implement full character backups on GC 2024-04-06 19:52:22 -07:00
Martin Michelsen 91131f8b36 update notes on xb bugfix patch 2024-04-02 22:22:09 -07:00
Martin Michelsen b2ea059fd8 add xb reticle color patches 2024-04-02 22:21:21 -07:00
Martin Michelsen 150acda1ea add union field team reward 2024-04-02 00:01:15 -07:00
Martin Michelsen 3e1449bb80 add team size field for union field 2024-04-02 00:01:05 -07:00
Martin Michelsen 4c104443bc fix non-unique team rewards 2024-04-01 23:31:55 -07:00
Martin Michelsen de8a210d0f add debug messages for wave events and switch flags 2024-04-01 23:28:41 -07:00
Martin Michelsen 9d2b36b787 add idle disconnect patch 2024-04-01 21:50:39 -07:00
Martin Michelsen 03b78c3825 add WIP XB bugfixes patch 2024-04-01 21:50:39 -07:00
Matt 3c8674dcc7 Provide updated Teth client links (#1)
This adds archive links to updated Teth clients to make set up work with newserv more seamlessly. The Teth clients linked:

- Have map files for Coren
- Have fixed unitxt_e.prs and unitxt_j.prs files so no "Revival Curiass" error
- Connect to 127.0.0.1 by default for the common use case of local server on same machine
- Japanese client has had the version string changed to "JTethVer12513" so it doesn't get overriden to English

I will probably update these archives in the future to use the English files properly with the English client but for now this will make things just work in the mean time hopefully.
2024-04-01 19:22:03 -07:00
Martin Michelsen 95919b8b01 add xbox hungry mag sound patch 2024-03-31 17:59:18 -07:00
Martin Michelsen 1712b13106 add link to original installer in readme 2024-03-31 16:49:35 -07:00
Martin Michelsen 50a32429be split rare announcement item sets by game version 2024-03-31 12:31:25 -07:00
Martin Michelsen 6f0124f7ec add $edit language 2024-03-31 11:59:21 -07:00
Martin Michelsen acbebaeb70 use scrolling message for rare and max level announcements on BB 2024-03-31 10:06:47 -07:00
Martin Michelsen d44b0b3d62 add max level notifications 2024-03-30 23:37:50 -07:00
Martin Michelsen 4a3b0118a8 replace UnlockAllAreas and PreventPersistQuestFlags with generalized rewrite map 2024-03-30 22:36:09 -07:00
Martin Michelsen 7c7df39e6d clarify BB behavior with UnlockAllAreas 2024-03-30 20:47:26 -07:00
Martin Michelsen dba49be1e3 add name for 6xB4x4A 2024-03-30 20:47:08 -07:00
Martin Michelsen 33483bbfbf handle duplicate set event IDs properly 2024-03-30 13:38:17 -07:00
Martin Michelsen 9630b06284 refine 6x68 structure 2024-03-30 13:37:50 -07:00
Martin Michelsen e6acea8247 add $swset, $swclear, and $swsetall 2024-03-29 21:08:42 -07:00
Martin Michelsen 2cd4c733ef switch item pickup notifs to explicit lists 2024-03-29 21:08:42 -07:00
Matt 05e5705537 Update ReceiveCommands.cc 2024-03-29 20:02:08 -07:00
Martin Michelsen 24e48b1abd write short readme section about accounts 2024-03-28 22:51:25 -07:00
Martin Michelsen 6d73cae91b fix desyncs if protected commands aren't supported by client 2024-03-28 22:50:57 -07:00
Martin Michelsen dd9bc51457 implement rare item pickup notifications 2024-03-28 21:44:05 -07:00
Martin Michelsen dce0f91678 highlight hit% if dropped weapon has positive bonus 2024-03-27 20:15:16 -07:00
Martin Michelsen eb5701ece9 update BB patch directory setup instructions 2024-03-26 14:00:48 -07:00
Martin Michelsen 6f99b3b1c8 run patch server on main thread on windows 2024-03-25 22:28:15 -07:00
Martin Michelsen da9765f1aa fix cleanup in compression test 2024-03-25 22:28:02 -07:00
Martin Michelsen b7897cddf2 show uncaught exception messages on windows 2024-03-24 22:00:22 -07:00
Martin Michelsen ce2300b116 add pessimal compression 2024-03-24 21:59:28 -07:00
Martin Michelsen cb05dce764 handle quest loading client bug 2024-03-24 15:43:35 -07:00
Martin Michelsen a762c0f8f8 make prev battle record const 2024-03-24 10:24:36 -07:00
Martin Michelsen cd008ab0ba rewrite DeckState::draw_card_by_ref 2024-03-23 21:02:00 -07:00
Martin Michelsen 53b36d7074 put an extra \n in choice search result text 2024-03-23 21:02:00 -07:00
Martin Michelsen 5a1880bd65 allow sender_c to be null in Ep3 server command handlers 2024-03-23 21:02:00 -07:00
Martin Michelsen 8e280a1464 fix wrong type in default ep3 behavior flags 2024-03-22 22:25:14 -07:00
Martin Michelsen 0bcdd9997e define choice_search_config in gc char file format 2024-03-22 22:25:04 -07:00
Martin Michelsen d5351c4580 set BB player mag color at char creation time 2024-03-22 22:24:45 -07:00
Martin Michelsen 76bc2385ca add PSOBB Hangame functions 2024-03-22 22:24:04 -07:00
Martin Michelsen 325f7c6efc add UnlockAllAreas config option 2024-03-18 10:03:37 -07:00
Martin Michelsen 93d97d3e5b factor out debug mode check 2024-03-17 21:16:31 -07:00
Martin Michelsen 66b64603a0 add $sb command 2024-03-17 19:03:24 -07:00
Martin Michelsen 7405eaea0b add format-ep3-battle-record command 2024-03-17 14:12:57 -07:00
Martin Michelsen 477e433361 update some command notes 2024-03-17 14:12:57 -07:00
Martin Michelsen 7ca2012bc4 add CA commands into Ep3 battle record format 2024-03-16 18:48:27 -07:00
Martin Michelsen dace165ef2 fix enemy data json in /y/data/common-tables 2024-03-16 18:45:35 -07:00
Martin Michelsen f6df2b5b45 add note about C4 crash 2024-03-16 18:45:11 -07:00
Martin Michelsen 1a310df17e fix choice search crash 2024-03-16 09:57:35 -07:00
Martin Michelsen 31edec701b refine game info messages 2024-03-15 22:59:50 -07:00
Martin Michelsen dc36d2ae8d fix quest expr checks from lobby 2024-03-15 10:20:19 -07:00
Martin Michelsen 4e733b0dc6 add object type name in map disassembly 2024-03-15 00:32:00 -07:00
Martin Michelsen 6eadaaca66 use pthreads for libevent on windows 2024-03-15 00:31:50 -07:00
Martin Michelsen d778340999 add BB format of 6x6F command 2024-03-15 00:31:33 -07:00
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
Martin Michelsen 2dc2f85b1a don't disconnect on duplicate EXP requests 2023-12-10 21:45:13 -08:00
Martin Michelsen 6ef5b59724 fix log level on ItemCreator 2023-12-10 21:31:51 -08:00
Martin Michelsen 2f32e8ab7d fix BB inventory desync when buying consumables from shop 2023-12-10 21:16:42 -08:00
Martin Michelsen 60c1aa71dc fix ToolV4 structure 2023-12-10 17:35:57 -08:00
Martin Michelsen a315f6d011 expand metadata comments in q058 2023-12-10 15:22:40 -08:00
Martin Michelsen a42594afd3 fix implicit signed conversion 2023-12-10 14:54:30 -08:00
Martin Michelsen 04445dabd0 fix default BB key config 2023-12-10 14:52:17 -08:00
Martin Michelsen 16cddd28b2 add quest script compiler 2023-12-10 14:24:30 -08:00
Martin Michelsen b53bde9046 expand comment on expand_rate 2023-12-10 09:16:59 -08:00
Martin Michelsen afd63ca1dd make ep2 quests have orange icon on non-BB versions 2023-12-09 19:21:31 -08:00
Martin Michelsen 8ae7696b51 fix $exit when v3 quests are loaded in ep3 games 2023-12-09 19:21:31 -08:00
Martin Michelsen 81d03738da enable $quest to load v3 quests on ep3 2023-12-09 19:10:54 -08:00
Martin Michelsen beb87b546f clean up map logging 2023-12-09 18:32:17 -08:00
Martin Michelsen 12572ed2d4 hide inventory/bank log messages if disabled in config.json 2023-12-09 10:56:58 -08:00
Martin Michelsen bb3d4ac847 disable $bank when character overlay is present 2023-12-09 10:38:48 -08:00
Martin Michelsen 0ded423c84 treat enemy type 0100 as NPC 2023-12-08 23:34:36 -08:00
Martin Michelsen 414ef0d825 don't send card search results if searcher is blocked 2023-12-08 23:34:32 -08:00
Martin Michelsen b54b32b461 reformat DAT constructor tables 2023-12-08 20:39:50 -08:00
Martin Michelsen 67e2428daa don't load Challenge map data on quest start 2023-12-08 20:22:04 -08:00
Martin Michelsen 8654555777 recreate map on challenge mode restart 2023-12-08 18:08:47 -08:00
Martin Michelsen 83166f1eff fix multi-area challenge enemy generation 2023-12-08 17:39:00 -08:00
Martin Michelsen fbf170ef12 fix slime enemy types 2023-12-08 17:38:42 -08:00
Martin Michelsen b7bc148e09 implement solo quest progression flags 2023-12-08 17:01:11 -08:00
Martin Michelsen 009a0fc93d fix Monest child_type 2023-12-08 10:02:36 -08:00
Martin Michelsen 5a98b48521 don't set floor if it's negative 2023-12-08 10:01:01 -08:00
Martin Michelsen bf17ec0943 add unknown enemy type 0118 2023-12-08 09:51:57 -08:00
Martin Michelsen e901f5e681 don't save licenses for replay sessions 2023-12-07 20:27:46 -08:00
Martin Michelsen 6136f8dfb3 implement $edit on v1/v2 2023-12-07 20:08:46 -08:00
Martin Michelsen 0c18656e03 update note about get_game_version 2023-12-07 17:05:26 -08:00
Martin Michelsen 317c9fd616 implement Simple Mail auto-reply when recipient is offline 2023-12-07 12:46:01 -08:00
Martin Michelsen 6d16f8095a factor ClientGameData into Client to reduce data duplication 2023-12-07 12:23:21 -08:00
Martin Michelsen 072ebe81bf add $savechar and $loadchar commands 2023-12-06 23:54:53 -08:00
Martin Michelsen 7db761f181 fix attribute upgrade in Gallon's Shop 2023-12-06 15:57:37 -08:00
Martin Michelsen 7211205e55 fix meseta and material import in $bbchar 2023-12-06 09:55:33 -08:00
Martin Michelsen 85d0bac5cb assign bank item IDs at game join time 2023-12-06 09:46:57 -08:00
Martin Michelsen 713327b0ae fix double language marker on BB 2023-12-05 23:31:16 -08:00
Martin Michelsen 0ce5210c22 add v4 ItemPT data 2023-12-05 23:31:16 -08:00
Martin Michelsen 4ccbb2f683 don't disconnect when no combinations apply 2023-12-05 23:31:16 -08:00
Martin Michelsen 3075370975 add $qcheck command 2023-12-05 23:31:16 -08:00
Matt Swift 9dfdbc624b Add fixed BB Gallon's Shop 2023-12-05 23:07:07 -08:00
Martin Michelsen 027956876d fix episode 3 tests 2023-12-04 22:40:07 -08:00
Martin Michelsen cd1cc43cb3 update to-do list 2023-12-04 22:40:07 -08:00
Martin Michelsen 77798e09be prevent player from joining game if a quest they don't have access to is in progress 2023-12-04 22:40:07 -08:00
Martin Michelsen da0ffea7e0 prevent player from joining game if a quest they don't have access to is in progress 2023-12-04 21:42:51 -08:00
Martin Michelsen 330dbecada rewrite $bbchar implementation 2023-12-04 19:38:42 -08:00
Martin Michelsen 2360beb77b sort bank contents before sending to client 2023-12-04 18:43:37 -08:00
Martin Michelsen 33bbb15bf0 fix stacked item bank deposit bug 2023-12-04 18:23:41 -08:00
Martin Michelsen c25569c688 implement shared bank 2023-12-04 16:59:03 -08:00
Martin Michelsen 01b83044dc cache loaded player files between sessions 2023-12-04 12:38:26 -08:00
Martin Michelsen e05dcb6e70 update rare enemy rates 2023-12-04 10:37:02 -08:00
Martin Michelsen 501a048af0 allow specifying minimum levels for difficulties 2023-12-03 23:35:38 -08:00
Martin Michelsen f605a21c1a add option to specify BB rare enemy rates 2023-12-03 21:44:56 -08:00
Martin Michelsen 8e1edbc34e update notes about DC prototypes 2023-12-03 21:44:56 -08:00
Martin Michelsen 83549fe8e4 update compatibility table 2023-12-03 16:59:05 -08:00
Martin Michelsen fbda7a2a48 fix GC NTE proxy behavior 2023-12-03 16:34:09 -08:00
Martin Michelsen b8d4ab589e update compatibility table 2023-12-03 00:06:32 -08:00
Martin Michelsen e49e159eee implement HDLC/PPP in IPStackSimulator 2023-12-03 00:06:32 -08:00
Martin Michelsen 0442f6e579 fix Ep3 card trade sequence 2023-12-02 18:24:07 -08:00
Martin Michelsen 3160d86eaa only use language from quest header if it's valid 2023-12-01 22:27:58 -08:00
Martin Michelsen 4cd82caa5f fix GC NTE episode number when creating games 2023-12-01 21:34:51 -08:00
Martin Michelsen d943364c29 use DC quest download semantics for GC NTE 2023-12-01 21:00:10 -08:00
Martin Michelsen cddd8007c7 fix 6x75 on GC NTE 2023-12-01 20:29:11 -08:00
Martin Michelsen 039786b2f8 handle GC NTE character data struct 2023-12-01 20:05:12 -08:00
Martin Michelsen 5de53391db disable rare mag evolution logic on v1/v2 2023-12-01 17:34:16 -08:00
Martin Michelsen 5f8e0bd6bd add XB voice chat command structs 2023-12-01 17:32:55 -08:00
Martin Michelsen 3e83669138 update to-do list 2023-12-01 17:32:45 -08:00
Martin Michelsen 5593dc0ecd add PSOBB connection instructions 2023-11-30 10:59:31 -08:00
Martin Michelsen 956e890ad6 use make_shared where appropriate 2023-11-30 10:24:27 -08:00
Martin Michelsen c833b575e4 fix item table reloading 2023-11-30 10:24:11 -08:00
Martin Michelsen 4b3be7eee3 add fallback for undecodable text in quest disassembler 2023-11-30 09:48:40 -08:00
Martin Michelsen f7b6f602cd update to-do list 2023-11-30 09:48:24 -08:00
Martin Michelsen 695f14e3fb implement 6xD8 subcommand 2023-11-30 09:48:12 -08:00
Martin Michelsen 77906b7a57 update example config 2023-11-29 22:51:02 -08:00
Martin Michelsen 14fc0996bd fix team reward keys on quests 2023-11-29 22:48:20 -08:00
Martin Michelsen 3743d0a156 implement quest unlock flags 2023-11-29 22:22:19 -08:00
Martin Michelsen 3d2d96eb7e fix BB bank withdraw conditions 2023-11-29 18:45:30 -08:00
Martin Michelsen ba8917e50d implement team item rewards 2023-11-29 18:28:54 -08:00
Martin Michelsen b09269eabc update to-do list 2023-11-29 17:19:48 -08:00
Martin Michelsen d1ce010d06 make user flag that allows cheating even if cheats are disabled 2023-11-29 17:19:37 -08:00
Martin Michelsen 1e3ca4111a add TODO item about F94D quest opcode 2023-11-29 16:45:02 -08:00
Martin Michelsen 6a052722c9 load V1 rare tables 2023-11-29 16:44:53 -08:00
Martin Michelsen acb9c656c5 implement 6xCB subcommand 2023-11-29 16:42:24 -08:00
Martin Michelsen f5ebf6fdcd fix comment in rare-table-v1.json 2023-11-29 12:55:36 -08:00
Martin Michelsen 9ea84d7101 implement most remaining BB team functions 2023-11-29 11:35:15 -08:00
Martin Michelsen 556360c993 implement choice search 2023-11-28 18:38:43 -08:00
Martin Michelsen 4008d7f4ff remove history/future sections from readme 2023-11-28 18:38:43 -08:00
Matt e47b72dd72 Add Chinese/Korean download quests for PCv2 2023-11-28 14:06:21 -08:00
Martin Michelsen 613d0c6d36 update windows build instructions 2023-11-27 22:54:42 -08:00
6502 changed files with 192664 additions and 178933 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
+34 -8
View File
@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.10)
project(newserv)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED True)
if (MSVC)
add_compile_options(/W4 /WX)
@@ -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,15 +40,32 @@ 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/Account.cc
src/AFSArchive.cc
src/BattleParamsIndex.cc
src/BMLArchive.cc
src/CatSession.cc
src/Channel.cc
src/ChatCommands.cc
src/ChoiceSearch.cc
src/Client.cc
src/CommonItemSet.cc
src/Compression.cc
@@ -65,19 +84,22 @@ 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/IntegralExpression.cc
src/IPFrameInfo.cc
src/IPStackSimulator.cc
src/IPV4RangeSet.cc
src/ItemCreator.cc
src/ItemData.cc
src/ItemNameIndex.cc
src/ItemParameterTable.cc
src/Items.cc
src/LevelTable.cc
src/License.cc
src/Lobby.cc
src/Loggers.cc
src/Main.cc
@@ -85,7 +107,8 @@ set(SOURCES
src/Menu.cc
src/NetworkAddresses.cc
src/PatchFileIndex.cc
src/Player.cc
src/PatchServer.cc
src/PlayerFilesManager.cc
src/PlayerSubordinates.cc
src/ProxyCommands.cc
src/ProxyServer.cc
@@ -98,28 +121,31 @@ 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
)
if(resource_file_FOUND)
set(SOURCES ${SOURCES} src/ARCodeTranslator.cc)
set(SOURCES ${SOURCES} src/AddressTranslator.cc)
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)
+1 -2
View File
@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2023 Martin Michelsen
Copyright (c) 2024 Martin Michelsen
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
@@ -18,4 +18,3 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+441 -215
View File
@@ -1,123 +1,276 @@
# 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).
This project includes code that was reverse-engineered by the community in ages long past, and has been included in many projects since then. It also includes some game data from Phantasy Star Online itself, which was originally created by Sega.
Feel free to submit GitHub issues if you find bugs or have feature requests. I'd like to make the server as stable and complete as possible, but I can't promise that I'll respond to issues in a timely manner, because this is a personal project undertaken primarily for the fun of reverse-engineering. If you want to contribute to newserv yourself, pull requests are welcome as well.
See TODO.md for a list of known issues and future work I've curated, or go to the GitHub issue tracker for issues and requests submitted by the community.
**Table of contents**
* Background
* [History](#history)
* [Future (and to-do list)](#future)
* [Other server projects](#other-server-projects)
* [Using newserv in other projects](#using-newserv-in-other-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
* [User accounts](#user-accounts)
* [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)
* [Connecting external clients](#connecting-external-clients)
* [Non-server features](#non-server-features)
## History
# History
The history of this project essentially mirrors my development as a software engineer from the beginning of my hobby until now. If you don't care about the story, skip to the "Compatibility" or "Setup" sections below.
I originally purchased PSO GC when I heard about PSUL, and wanted to play around with running homebrew on my GameCube. This pathway eventually led to [GCARS-CS](https://github.com/fuzziqersoftware/gcars-cs), but that's another story.
<img align="left" src="s-khyps.png" /> After playing PSO for a while, both offline and online, I wrote a proxy called Khyps sometime in 2003. This was back in the days of the official Sega servers, where vulnerabilities weren't addressed in a timely manner or at all. It was common for malicious players using their own proxies or Action Replay codes (a story for another time) to send invalid commands that the servers would blindly forward, and cause the receiving clients to crash. These crashes were more than simply inconvenient; they could also corrupt your save data, destroying the hours of work you may have put into hunting items and leveling up your character.
<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="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-khyller.png" /> After Khyps I took on the larger challenge of writing a server, which resulted in Khyller sometime in 2005. This was the first server of any type I had ever written. This project eventually evolved into a full-featured environment supporting all versions of the game that I had access to - at the time, PC, GC, and BB. (However, I suspect from reading the ancient source files that Khyller's BB support was very buggy.) As Khyller evolved, the code became increasingly cumbersome, littered with debugging filth that I never cleaned up and odd coding patterns I had picked up over the years. My understanding of the C++ language was woefully incomplete as well (as opposed to now, when it is still incomplete but not woefully so), which resulted in Khyller being essentially a C project that had a couple of classes in it.
<img align="left" src="s-aeon.png" /> Sometime in 2006 or 2007, I abandoned Khyller and rebuilt the entire thing from scratch, resulting in Aeon. Aeon was substantially cleaner in code than Khyller but still fairly hard to work with, and it lacked a few of the more arcane features I had originally written (for example, the ability to convert any quest into a download quest). In addition, the code still had some stability problems... it turns out that Aeon's concurrency primitives were simply incorrect. I had derived the concept of a mutex myself, before taking any real computer engineering classes, but had implemented it incorrectly. I made the race window as small as possible, but Aeon would still randomly crash after running seemingly fine for a few days.
<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="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).
<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).
## Future
## Other server projects
newserv is many things - a server, a proxy, an encryption and decryption tool, a decoder of various PSO-related formats, and more. Primarily, it's a reverse-engineering project in which I try to unravel the secrets of a 20-year-old video game, for honestly no reason. Solving these problems and documenting them in code has been fun, and I'll continue to do it when my time allows.
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:
With that said, I offer no guarantees on how or when this project will advance. Feel free to submit GitHub issues if you find bugs or have feature requests; I'd like to make the server as stable and complete as possible, but I can't promise that I'll respond to issues in a timely manner. If you feel like contributing to newserv yourself, pull requests are welcome as well.
* (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.
See TODO.md for a list of known issues and future work.
## Using newserv in other projects
## Compatibility
There is a fair amount of code in this project that could potentially be useful to other projects. You are free to use code from newserv in your own open-source projects; the only condition is that the contents of the LICENSE file must be included in your project if you use code from newserv. Your project does not also have to use the MIT license; you can use any license you want.
newserv supports several versions of PSO. Specifically:
| Version | Login | Lobbies | Games | Proxy |
|----------------|--------------|--------------|--------------|--------------|
| DC Trial | Yes | Yes | Yes | No |
| DC 11/2000 | Yes | Yes | Yes | No |
| DC 12/2000 | Yes | Yes | Yes | Yes |
| DC 01/2001 | Yes | Yes | Yes | Yes |
| DC V1 | Yes | Yes | Yes | Yes |
| DC 08/2001 | Untested (1) | Untested (1) | Untested (1) | Untested (1) |
| DC V2 | Yes | Yes | Yes | Yes |
| PC | Yes | Yes | Yes | Yes |
| GC Ep1&2 Trial | Untested (1) | Untested (1) | Untested (1) | Untested (1) |
| GC Ep1&2 | Yes | Yes | Yes | Yes |
| GC Ep1&2 Plus | Yes | Yes | Yes | Yes |
| GC Ep3 Trial | Yes | Yes | Partial (3) | Yes |
| GC Ep3 | Yes | Yes | Yes | Yes |
| Xbox Ep1&2 | Yes | Yes | Yes | Yes |
| BB (vanilla) | Yes | Yes | Yes (2) | Yes |
| BB (Tethealla) | Yes | Yes | Yes (2) | Yes |
If you want to use parts of newserv in your project, there are two easy ways to do so with proper licensing:
* If you're using a lot of code from newserv, you can put a copy of newserv's LICENSE file in your repository alongside your own license file, or include the contents of newserv's license in your own license file.
* If you're only using a few files from newserv, you can copy and paste the contents of the LICENSE file into a comment at the beginning of each copied file.
# 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. *newserv's implementations of these versions are based on disassembly of the client executables and have never been tested.*
2. *BB games are mostly playable, but there are still some unimplemented features (for example, some quests that use rare commands may not work). Please submit a GitHub issue if you find something that doesn't work.*
3. *Creating a game works and battle setup behaves mostly normally, but starting a battle doesn't work.*
1. *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`, 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, unitxt_* files and the data.gsl file and place them in `system/patch-bb/data`.
3. If you're using game files from the Tethealla client, make a copy of unitxt_j.prs inside system/patch-bb/data and name it unitxt_e.prs. (If unitxt_e.prs already exists, replace it with the copied file.)
If you do not have a BB client, or using a Tethealla client from another source, Tethealla clients that are compatible with newserv can be found here: [English](https://web.archive.org/web/20240402011115/https://ragol.org/files/bb/TethVer12513_English.zip) / [Japanese](https://web.archive.org/web/20240402013127/https://ragol.org/files/bb/TethVer12513_Japanese.zip). These clients connect to 127.0.0.1 (localhost) automatically.
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 the default gateway and DNS server addresses in the game's 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're not playing PSO Plus or Episode III, this should be all you need to do, assuming you already set LocalAddress in config.json to your PC's private IP address.
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. There are a couple of ways to get around this.
Sodaboy described a fairly easy method, which is to forward the PSO and DNS ports in your router's configuration to your PC's private IP address (the PSO ports are in config.json, and are all TCP; the DNS port is 53 and is UDP). Then, set LocalAddress and ExternalAddress in config.json to your external IP address (from e.g. whatismyip.com). Most routers will let you connect to your public IP address even from within the local network, but the GameCube will think it's connecting to a different network, so it won't reject the connection. If you're concerned about security and don't want your server to be publicly accessible, you can use Windows Firewall or UFW on Linux block incoming connections on the ports you opened, except for connections from the IP addresses you specify.
Another method is to use two network interfaces on the same PC, and tell the GameCube to connect to the one that appears to be on a different network. For example, if your GameCube is on the 10.0.0.x subnet and your PC's address is 10.0.0.5, you can create a fake network adapter on your PC (or use an existing real one) that has an IP address on a different subnet than the GameCube, such as 192.168.0.8. Then, in PSO's network config, set the default gateway and DNS server addresses to 192.168.0.8, and set LocalAddress in config.json to 192.168.0.8, and PSO should connect. This is what I did back in the old days when I primarily developed software on Windows, but I haven't tried 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 connect 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 the tapserver BBA or modem type, you can make it connect to a newserv instance running on the same machine via the tapserver interface. To do this:
1. In the GameCube pane of the Config window, set the SP1 device to Broadband Adapter (tapserver) or Modem Adapter (tapserver).
2. Set IPStackListen (for BBA) or PPPStackListen (for modem) 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 work with newserv (the last Japanese release can be found [here](https://archive.org/details/psobb_jp_setup_12511_20240109/)). To get them to connect to your server, do one of the following:
* Use a drop-in patcher like [AzureFlare](https://github.com/Repflez/AzureFlare).
* Modify your hosts file to redirect the client's destination address to localhost or your server's address.
* Edit psobb.exe to point to your newserv instance. The original clients are packed with various versions of ASProtect, 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 ([English](https://web.archive.org/web/20240402011115/https://ragol.org/files/bb/TethVer12513_English.zip) or [Japanese](https://web.archive.org/web/20240402013127/https://ragol.org/files/bb/TethVer12513_Japanese.zip)). If the server is on the same PC as the client and you don't plan to have any external players, these Tethealla clients will automatically connect to the server without any modifications. This version of the client is not packed, and 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
## User accounts
By default, newserv does not require users to pre-register before playing; the server will instead automatically create an account the first time each player connects. These accounts have no special permissions. You can view, create, edit, and delete user accounts in the server's shell (run `help` in the shell to see how to do this).
A license is a set of credentials that a player can use to log in. There are six types of licenses:
* *DC NTE licenses* consist of a 16-character serial number and 16-character access key.
* *DC licenses* consist of an 8-character hex serial number and an 8-character access key.
* *PC licenses* are the same format as DC licenses, but are used for PC v2.
* *GC licenses* consist of a 10-digit decimal serial number, a 12-character access key, and a password of up to 8 characters.
* *XB licenses* consist of a gamertag of up to 16 characters, a 16-character hex user ID, and a 16-character hex account ID.
* *BB licenses* consist of a username of up to 16 characters and a password of up to 16 characters.
Each account may have multiple licenses. To add a license to an account, use `add-license` in the shell.
On BB, character data is scoped to the license, but system and Guild Card data is scoped to the account. That is, an account with multiple BB licenses can have more than 4 characters (up to 4 per license), but they will all share the same team membership and Guild Card lists.
You may want to give your account elevated privileges. To do so, run `update-account ACCOUNT-ID flags=root` (replacing ACCOUNT-ID with your actual account-id). You can also use update-account to edit other parts of the account; see the help text for more information.
## 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)
For .dat files, the `LANGUAGE` token may be omitted. If it's present, then that .dat file will only be used for that language of the quest; if omitted, then that .dat file will be used for all languages of the quest.
Some quests (mostly battle and challenge mode quests) have additional JSON metadata files that describe how the server should handle them. These metadata files are generally named similarly to their .bin and .dat counterparts, except the `VERSION` token may also be omitted if the metadata applies to all versions of the quest on all PSO versions.
Some quests (mostly battle and challenge mode quests) have additional JSON metadata files that describe how the server should handle them. This includes flags that can be used to hide the quest unless a preceding quest has been cleared, or to hide the quest unless purchased as a team reward. These metadata files are generally named similarly to their .bin and .dat counterparts, except the `VERSION` token may also be omitted if the metadata applies to all languages of the quest on all PSO versions. See system/quests/battle/b88001.json for documentation on the exact format of the JSON file.
Some quests may also include a .pvr file, which contains an image used in the quest. These files are named similarly to their .bin and .dat counterparts.
@@ -133,13 +286,14 @@ There are multiple PSO quest formats out there; newserv supports all of them. It
| Compressed Ep3 | .bin or .mnm | Yes (4) | None (1) |
| Uncompressed | .bind and .datd | Yes | compress-prs (2) |
| Uncompressed Ep3 | .bind or .mnmd | Yes (4) | compress-prs (2) |
| Source | .bin.txt and .dat | Yes | None (5) |
| VMS (DCv1) | .bin.vms and .dat.vms | Yes | decode-vms |
| VMS (DCv2) | .bin.vms and .dat.vms | Decode (3) | decode-vms (3) |
| GCI (decrypted) | .bin.gci and .dat.gci | Yes | decode-gci |
| GCI (with key) | .bin.gci and .dat.gci | Yes | decode-gci |
| GCI (no key) | .bin.gci and .dat.gci | Decode (3) | decode-gci (3) |
| GCI (Ep3 NTE) | .bin.gci or .mnm.gci | Decode (3) | decode-gci (3) |
| GCI (Ep3) | .bin.gci or .mnm.gci | Yes | decode-gci |
| GCI (Ep3 Trial) | .bin.gci or .mnm.gci | Decode (3) | decode-gci (3) |
| DLQ | .bin.dlq and .dat.dlq | Yes | decode-dlq |
| DLQ (Ep3) | .bin.dlq or .mnm.dlq | Yes | decode-dlq |
| QST (online) | .qst | Yes | decode-qst |
@@ -150,16 +304,68 @@ There are multiple PSO quest formats out there; newserv supports all of them. It
2. *Similar to (1), to compress an uncompressed quest file: `newserv compress-prs FILENAME.bind FILENAME.bin` (and likewise for .datd -> .dat)*
3. *Use the decode action to convert these quests to .bin/.dat format before putting them into the server's quests directory. If you know the encryption seed (serial number), pass it in as a hex string with the `--seed=` option. If you don't know the encryption seed, newserv will find it for you, which will likely take a long time.*
4. *Episode 3 quests don't go in the system/quests directory. See the Episode 3 section below.*
5. *Quest source can be assembled into a .bin or .bind file with `newserv assemble-quest-script FILENAME.txt`. See system/quests/retrieval/q058-gc-e.bin.txt for an annotated example; this is the English GameCube version of Lost HEAT SWORD.*
Episode 3 download quests consist only of a .bin file - there is no corresponding .dat file. Episode 3 download quest files may be named with the .mnm extension instead of .bin, since the format is the same as the standard map files (in system/ep3/). These files can be encoded in any of the formats described above, except .qst.
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.)
## Server-side saves
newserv has the ability to save character data on the server side. For PSO BB, this is required of course, but this feature can also be used on other PSO versions.
Each account has 4 BB character slots and 16 non-BB character file slots. The non-BB slots are independent of the BB slots, and can be accessed with the `$savechar <slot>` and `$loadchar <slot>` commands (slots are numbered 1 through 16). `$savechar` copies the character you're currently playing as and saves the data on the server, and `$loadchar` does the reverse, overwriting your current character with the data saved on the server. Note that you can load a character that was saved from a different version of PSO, which allows you to easily transfer characters between games. On v1 and v2, changes done by `$loadchar` will be undone if you join a game; to permanently save your changes, disconnect from the lobby after using the command.
There is a third command, `$bbchar <username> <password> <slot>`, which behaves similarly to `$savechar` but writes the character data to a BB character slot in a different account instead (slots are numbered 1 through 4). This can be used to "upgrade" a character to BB from an earlier version.
Exactly which data is saved and loaded depends on the game version:
| Game | Inventory | Character | Options/chats | Quest flags | Bank | Battle/challenge |
|----------------------|-----------|-----------|---------------|-------------|------|------------------|
| PSO DC v1 prototypes | Yes | Yes | No | No | No | N/A |
| PSO DC v1 | Yes | Yes | No | No | No | N/A |
| PSO DC v2 | Yes | Yes | Yes | Yes | Yes | Yes |
| PSO PC (v2) | Yes | Yes | No | No | No | Save only |
| PSO GC NTE | Yes | Yes | Yes | Yes | Yes | Yes |
| PSO GC (not Plus) | Yes | Yes | Yes | Yes | Yes | Yes |
| PSO GC Plus (1) | Save only | Save only | No | No | No | Save only |
| PSO GC Ep3 (1) | No | Save only | No | No | No | Save only |
| PSO Xbox | Yes | Yes | Yes | Yes | Yes | Yes |
| PSO BB | Yes | Yes | Yes | Yes | Yes | Yes |
*Notes*:
1. *If EnableSendFunctionCallQuestNumber is enabled in config.json, then $savechar and $loadchar can save and restore all character data on these versions, just like on GC non-Plus. Episode 3 characters exist in a separate namespace; that is, you can't use $savechar and $loadchar to convert an Ep3 character to non-Ep3, or vice versa.*
## 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).
@@ -170,11 +376,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.
@@ -182,7 +388,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.
@@ -190,48 +396,71 @@ Episode 3 state and game data is stored in the system/ep3 directory. The files i
* card-text.mnr: Compressed card text archive. Generally only used for debugging.
* card-text.mnrd: Decompressed card text archive; same format as TextCardE.bin. Generally only used for debugging.
* com-decks.json: COM decks used in tournaments. The default decks in this file come from logs from Sega's servers, so the file doesn't include every COM deck Sega ever made - the rest are probably lost to time.
* maps/: Online free battle and quest maps (.mnm/.bin/.mnmd/.bind files). newserv comes with all the original online and offline maps, including Story Mode quests. If you don't want the offline maps and quests to be playable online, delete the .bind files system/ep3/maps.
* maps/: Online free battle and quest maps (.mnm/.bin/.mnmd/.bind files). newserv comes with the default online maps, as well as some fan-made variations and quests to help new players get up to speed.
* maps-download/: Download maps and quests (.mnm/.bin/.mnmd/.bind files). There are two subcategories by default (download maps and Trial Edition download maps), but you can add more by editing QuestCategories in config.json. Categories that have flag 0x40 (Ep3 download) set are indexed from this directory; all others are indexed from system/quests/. Files in maps-download/ subdirectories have the same format as those in the maps/ directory, but should be named like `e###-gc3-LANGUAGE.EXT` (similar to how non-Episode 3 quests are named in the system/quests/ directory). If you want a map to be available for online play and for downloading, the file must exist in both maps/ and in a maps-download/ subdirectory (a symbolic link is acceptable).
* maps-offline/: Offline map files. These are all the offline quests and free battle maps from the client, including some debugging/test maps that were inaccessible during normal play. To make them playable online, put the files in the maps/ directory.
* tournament-state.json: State of all active tournaments. This file is automatically written when any tournament changes state for any reason (e.g. a tournament is created/started/deleted or a match is resolved).
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.
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 a .bin or .mnm file before editing it, but you don't need to compress it again to use it - 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-cards` or `reload ep3-maps` 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.
*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.*
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.
You can put assembly files in the system/client-functions directory with filenames like PatchName.VERS.patch.s and they will appear in the Patches menu for clients that support client functions. Client functions are written in SH-4, 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/System/WriteMemory.ppc.s.
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.
The VERS token in client function filenames refers to the specific version of the game that the client function applies to. Some versions do not support receiving client functions at all. The specific versions are:
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.
| Game | VERS | Architecture |
|-------------------|------|---------------|
| PSO DC NTE | 1OJ1 | Not supported |
| PSO DC 11/2000 | 1OJ2 | Not supported |
| PSO DC 12/2000 | 1OJ3 | Not supported |
| PSO DC 01/2001 | 1OJ4 | Not supported |
| PSO DC v1 JP | 1OJF | Not supported |
| PSO DC v1 US | 1OEF | Not supported |
| PSO DC v1 EU | 1OPF | Not supported |
| PSO DC 08/2001 | 2OJ5 | SH-4 |
| PSO DC v2 JP | 2OJF | SH-4 |
| PSO DC v2 US | 2OEF | SH-4 |
| PSO DC v2 EU | 2OPF | SH-4 |
| PSO PC (v2) | 2OJW | Not supported |
| PSO GC NTE | 3OJT | PowerPC |
| PSO GC v1.2 JP | 3OJ2 | PowerPC |
| PSO GC v1.3 JP | 3OJ3 | PowerPC |
| PSO GC v1.4 JP | 3OJ4 | PowerPC |
| PSO GC v1.5 JP | 3OJ5 | Not supported |
| PSO GC v1.0 US | 3OE0 | PowerPC |
| PSO GC v1.1 US | 3OE1 | PowerPC |
| PSO GC v1.2 US | 3OE2 | Not supported |
| PSO GC v1.0 EU | 3OP0 | PowerPC |
| PSO GC Ep3 NTE | 3SJT | PowerPC |
| PSO GC Ep3 JP | 3SJ0 | PowerPC |
| PSO GC Ep3 US | 3SE0 | Not supported |
| PSO GC Ep3 EU | 3SP0 | Not supported |
| PSO Xbox Beta | 4OJB | x86 |
| PSO Xbox JP Disc | 4OJD | x86 |
| PSO Xbox JP TU | 4OJU | x86 |
| PSO Xbox US Disc | 4OED | x86 |
| PSO Xbox US TU | 4OEU | x86 |
| PSO Xbox EU Disc | 4OPD | x86 |
| PSO Xbox EU TU | 4OPU | x86 |
| PSO BB JP 1.25.13 | 51OC | x86 |
| PSO BB Tethealla | 51OC | x86 |
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.
*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.*
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.
newserv comes with a set of patches for some of the above versions, 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).
### 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.
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 Episode 3 Trial Edition
* PSO GameCube Episode 3 JP
* PSO GameCube Episode 3 USA (experimental; must be manually enabled in config.json)
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.
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 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/System 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.
@@ -248,7 +477,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.
@@ -262,158 +491,155 @@ 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.
* `$matcount` (game server only): Shows how many of each type of material you've used.
* `$li`: Show basic information about the lobby or game you're in. If you're on the proxy server, show information about your connection instead (remote Guild Card number, client ID, etc.).
* `$si` (game server only): Show basic information about the server.
* `$ping`: Show round-trip ping time from the server to you. On the proxy server, show the ping time from you to the proxy and from the proxy to the server.
* `$matcount` (game server only): Show how many of each type of material you've used.
* `$itemnotifs <mode>`: Enable 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): Show the type, name, and stats of the nearest item on the ground.
* `$where` (game server only): Show your current floor number and coordinates. Mainly useful for debugging.
* `$qfread <field-name>` (game server only): Show the value of a quest counter in your player data. The field names are defined in config.json.
* 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 flag in your user account to use this command. Enabling debug does several 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 last available slot in lobbies and games instead of the first, 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. 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. Debug is not required to be enabled if the specified quest has the AllowStartFromChatCommand field set in its metadata file.
* `$qcall <function-id>`: Call a quest function on your client.
* `$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): Show 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.
* `$swset [floor] <flag-num>` and `$swclear [floor] <flag-num>`: Set or clear a switch flag. If floor is not given, sets or clears the flag on your current floor.
* `$swsetall`: Set all switch flags on your current floor. This unlocks all doors, disables all laser fences, triggers all light/poison switches, etc.
* `$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.
* `$ss <data>`: Send a command to the remote server (if in a proxy session) or to the game server.
* `$sb <data>`: Send a command to yourself, and to the remote server or game 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.
* `$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.
* `$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.
* `$arrow <color-id>`: Change your lobby arrow color.
* `$secid <section-id>`: Set 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>`: Set 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]`: Set 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`: Enable or disable 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, send you to the main menu (which ends your proxy session, if you're in one). If you're in a game or spectator team, send 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 (game server only)
* `$savechar <slot>`: Save your current character data on the server in the specified slot. See the "Server-side saves" section for more details.
* `$loadchar <slot>`: Save your current character data on the server in the specified slot. See the "Server-side saves" section for more details.
* `$bbchar <username> <password> <slot>`: Save your current character data on the server in a different account's BB character slots. See the "Server-side saves" section for more details.
* `$edit <stat> <value>`: Modify 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`, `language`, `npc`, or `tech`. If cheats are not allowed, only `namecolor`, `name`, `language`, and `npc` can be used. Changing your character's language is only useful on BB; to do so, use a single-character language code (e.g. to switch your character to English, use `$edit language E`; for Japanese, use `$edit language J`).
* Blue Burst player commands (game server only)
* `$bbchar <username> <password> <1-4>`: Use this command when playing on a non-BB version of PSO. If the username and password are correct, this command converts your current character to BB format and saves it on the server in the given slot. Any character already in that slot is overwritten.
* `$edit <stat> <value>`: Modifies your character data. If the server does not allow cheat mode anywhere (that is, "CheatModeBehavior" is "Off" in config.json), this command does nothing.
* `$save`: Saves your character, system, and Guild Card data immediately. (By default, your character is saved every 60 seconds while online, and your account and Guild Card data are saved whenever they change.)
* `$bank [number]`: Switch 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, switch back to your current character's bank.
* `$save`: Save your character, system, and Guild Card data immediately. (By default, your character is saved every 60 seconds while online, and your account and Guild Card data are saved whenever they change.)
* Game state commands (game server only)
* `$maxlevel <level>`: Sets the maximum level for players to join the current game. (This only applies when joining; if a player joins and then levels up past this level during the game, they are not kicked out, but won't be able to rejoin if they leave.)
* `$minlevel <level>`: Sets the minimum level for players to join the current game.
* `$password <password>`: Sets the game's join password. To unlock the game, run `$password` with nothing after it.
* `$itemtable`: Switches between using the client's or the server's drop table. No effect on BB (the server's drop table is always used). The server's rare tables are defined in JSON files in the system/item-tables directory.
* `$drop`: Enables or disables all item drops from boxes and enemies in the current game.
* `$maxlevel <level>`: Set 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>`: Set the minimum level for players to join the current game.
* `$password <password>`: Set the game's join password. To unlock the game, run `$password` with nothing after it.
* `$dropmode [mode]`: Change 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 that were only visible to the leaving player, which are deleted). 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 appear, 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.
* `$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).
* `$spec`: Toggle the allow spectators flag for Episode 3 games. If any players are spectating when this flag is disabled, they are sent back to the lobby.
* `$inftime`: Toggle infinite-time mode. Must be used before starting a battle. If infinite-time mode is on, the overall and per-phase time limits will be disabled regardless of the values chosen during battle rules 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).
* `$dicerange [d:L-H] [1:L-H] [a1:L-H] [d1:L-H]`: Set 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>`: Show 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`: Cause your team to immediately lose the current battle.
* `$saverec <name>`: Save the recording of the last battle.
* `$playrec <name>`: Play a battle recording. This command creates a spectator team immediately but the replay does not start automatically, to give other players a chance to join. To start the battle replay within the spectator team, run `$playrec` again (with no name). There is a bug in Dolphin that makes 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.
* `$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.
* `$cheat` (game server only): Enable or disable 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`: Enable or disable infinite HP mode. Applies to only you; does not affect other players. When enabled, one-hit KO attacks will still kill you, but on most versions of the game (not DCv1, GC US 1.2, or GC JP 1.5), the server will automatically revive you if you die. On all versions except GC US 1.2 and GC JP 1.5, infinite HP also automatically cures status ailments.
* `$inftp`: Enable or disable infinite TP mode. Applies to only you; does not affect other players.
* `$warpme <floor-id>` (or `$warp <floor-id>`): Warp yourself to the given floor.
* `$warpall <floor-id>`: Warp 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`: Warp yourself to the next floor.
* `$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): Change 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.
* `$allevent <event>` (game server only): Sets the current holiday event in all lobbies.
* `$song <song-id>` (Episode 3 only): Plays a specific song in the current lobby.
* Aesthetic commands
* `$event <event>`: Set 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.
* `$allevent <event>` (game server only): Set the current holiday event in all lobbies.
* `$song <song-id>` (Episode 3 only): Play 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.
* `$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.
* `$ann <message>`: Send an announcement message. The message is sent as temporary on-screen text to all players in all games and lobbies.
* `$ann! <message>`: Send an announcement message. The message is sent as a Simple Mail message to all players in all games and lobbies.
* `$ax <message>`: Send a message to the server's terminal. This cannot be used to run server shell commands; it only prints text to stderr.
* `$silence <identifier>`: Silence a player (remove their ability to chat) or unsilence a player. The identifier may be the player's name or Guild Card number.
* `$kick <identifier>`: Disconnect a player. The identifier may be the player's name or Guild Card number.
* `$ban <duration> <identifier>`: Ban a player. The duration should be of the form `10m` (minutes), `10h` (hours), `10d` (days), `10w` (weeks), `10M` (months), or `10y` (years). (Numbers other than 10 may be used, of course.) As with `$kick`, 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.
### 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`)
* Disassemble quest scripts (`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`)
+13 -24
View File
@@ -1,41 +1,30 @@
## General
- Find a way to silence audio in RunDOL.s
- Encapsulate BB server-side random state and make replays deterministic
- Implement choice search
- Write a simple status API
- Implement per-game logging
- Build an exception-handling abstraction in ChatCommands that shows formatted error messages in all cases
- Make reloading happen on separate threads so compression doesn't block active clients
- Implement decrypt/encrypt actions for VMS files
- Make UI strings localizable (e.g. entries in menus, welcome message, etc.)
- Figure out what causes the corruption message on PC proxy sessions and fix it
- Make $edit for DC/PC
- Add an idle connection timeout for proxy sessions
- 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 received destinations)
## PSO DC
- Investigate if https://crates.io/crates/blaze-ssl-async can be used to implement the HL check server
## Episode 3
- Make disconnecting during a tournament match cause you to forfeit the match
- Enforce tournament deck restrictions (e.g. rank checks, No Assist option) when populating COMs at tournament start time
- It may be possible to send spectators back to the waiting room after a non-tournament battle by sending 6xB4x05 with environment 0x19, then 6xB4x3B again; try this
- Add support for recording battles on the proxy server (both in primary and spectator teams)
- When `reload ep3` happens and the defs file is changed, send the new defs file to all connected players who aren't in a game (if this even works - when exactly does the client decompress the defs file from the server?)
- Make `reload licenses` not vulnerable to online players' licenses overwriting licenses on disk somehow
- Make `reload accounts` not vulnerable to online players' accounts overwriting accounts 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
- Fix receiving Guild Cards from non-Xbox players
- Make the Guild Card description field in SavedPlayerDataBB longer to accommodate XB descriptions (0x200 bytes)
- Research the F94D quest opcode
- Finish porting the remaining GC patches
## PSOBB
- Find any remaining mismatches in enemy indexes / experience
- Fix some edge cases on the BB proxy server (e.g. Change Ship)
- Implement less-common subcommands
- 6xD8: Add S-rank weapon special
- Test team commands
- Test all EA subcommands (a few are still not implemented)
- 6xC1, 6xC2, 6xCD, 6xCE: Team invites/administration (not implemented)
- Fix invite member menu
- Implement story progress flags for unlocking quests
- 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.)
-16
View File
@@ -1,16 +0,0 @@
struct AITalkBin {
be_uint32_t num_scs;
be_uint32_t sc_offsets[num_scs];
struct SCDialogueEntry {
be_uint32_t num_entries;
be_uint32_t unknown_a1;
be_uint32_t size; // in bytes
struct WhenEntry {
be_uint32_t when;
be_uint32_t percent_chance; // 0-100
be_uint32_t count;
be_uint32_t string_ids[count];
} __attribute__((packed));
} __attribute__((packed));
} __attribute__((packed));
+130 -34
View File
@@ -1,29 +1,88 @@
(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
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) Auto-press A as fast as possible during loading screens
042F9AC0 60000000
(Ep1&2 USA v1.1) Change type of all loading screens
0401CA04 3BE0000X
0401CA08 48000038
Values for X: 0 = lobby/game join, 1 = quest load, 3 = pipe up, 4 = pipe down, anything else = silent black screen
(Ep3 USA) Replace loading screen A button sounds with random sounds
042F9B18 4804BB19
@@ -32,6 +91,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 +109,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 +174,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 +229,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 +239,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 +257,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 +280,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 +315,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 +349,14 @@ 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
(v1.1 USA) Replace all sound effects with specified sound effect
042256E4 3F40XXXX
042256E8 635AYYYY
042256EC 4800000C
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -2,4 +2,4 @@ DC NTE: pso02.dricas.ne.jp
Nov 2000 proto: test1.st-pso.games.sega.net
Dec 2000 proto: sg107634.csrd.sega.co.jp OR master.pso.dream-key.com
Jan 2001 proto: master.pso.dream-key.com
Aug 2001 proto (v2): ???
Aug 2001 proto (v2): game01.st-pso.games.sega.net
+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
+963
View File
@@ -0,0 +1,963 @@
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 */
801FE900 60000000 801FF174 60000000 8020010C 60000000 801FF710 60000000 801FF0FC 60000000 801FF0FC 60000000 801FFA44 60000000 801FF9E0 60000000 nop
801FFE5C 60000000 802006D0 60000000 802016CC 60000000 80200C9C 60000000 80200658 60000000 80200658 60000000 80200FD0 60000000 80200F3C 60000000 nop
802019C8 38000000 8020223C 38000000 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 (US12)
802612C4 4BFE1541 80261E9C 4BFE1349 80262EE4 4BFE0665 80262C98 4BFE1241 80261B9C 4BFE1545 80261B9C 4BFE1545 80262F5C 4BFE12B1 802627A4 4BFE12B1 bl -0x0001EABC /* 802430E0 */
804CAF00 42780000 804CE650 42780000 804D0BA0 42780000 804D0940 42780000 804CB6D0 42780000 804CBBB0 42780000 804D0218 42780000 804D0608 42780000
804CAF1C FF00FF15 804CE66C FF00FF15 804D0BBC FF00FF15 804D095C FF00FF15 804CB6EC FF00FF15 804CBBCC FF00FF15 804D0234 FF00FF15 804D0624 FF00FF15
805CBFBC 42C00000 805D65BC 42C00000 805DDA5C 42C00000 805DD7FC 42C00000 805CC8C4 42C00000 805D38E4 42C00000 805DD104 42C00000 805D9344 42C00000
804CAE40 42960000 804CE590 42960000 804D0AE0 42960000 804D0880 42960000 804CB610 42960000 804CBAF0 42960000 804D0158 42960000 804D0548 42960000
804CAE4C 42960000 804CE59C 42960000 804D0AEC 42960000 804D088C 42960000 804CB61C 42960000 804CBAFC 42960000 804D0164 42960000 804D0554 42960000
804CAE58 42960000 804CE5A8 42960000 804D0AF8 42960000 804D0898 42960000 804CB628 42960000 804CBB08 42960000 804D0170 42960000 804D0560 42960000
804CAE64 42960000 804CE5B4 42960000 804D0B04 42960000 804D08A4 42960000 804CB634 42960000 804CBB14 42960000 804D017C 42960000 804D056C 42960000
804CAE70 42960000 804CE5C0 42960000 804D0B10 42960000 804D08B0 42960000 804CB640 42960000 804CBB20 42960000 804D0188 42960000 804D0578 42960000
80261260 4BDAA3F1 80261E38 4BDA9819 80262E80 4BDA87D1 80262C34 4BDA8A1D 80261B38 4BDA9B19 80261B38 4BDA9B19 80262EF8 4BDA8759 80262740 4BDA8F11 bl -0x002578A8 /* 8000B650 */
80261420 4BDAA245 80261FF8 4BDA966D 80263040 4BDA8625 80262DF4 4BDA8871 80261CF8 4BDA996D 80261CF8 4BDA996D 802630B8 4BDA85AD 80262900 4BDA8D65 bl -0x00257A54 /* 8000B664 */
8000B650 3CA08001 8000B650 3CA08001 8000B650 3CA08001 8000B650 3CA08001 8000B650 3CA08001 8000B650 3CA08001 8000B650 3CA08001 8000B650 3CA08001 lis r5, 0x8001
8000B654 8065B6BC 8000B654 8065B6BC 8000B654 8065B6BC 8000B654 8065B6BC 8000B654 8065B6BC 8000B654 8065B6BC 8000B654 8065B6BC 8000B654 8065B6BC lwz r3, [r5 - 0x4944]
8000B658 7FFEFB78 8000B658 7FFEFB78 8000B658 7FFEFB78 8000B658 7FFEFB78 8000B658 7FFEFB78 8000B658 7FFEFB78 8000B658 7FFEFB78 8000B658 7FFEFB78 mr r30, r31
8000B65C A8DE032C 8000B65C A8DE032C 8000B65C A8DE032C 8000B65C A8DE032C 8000B65C A8DE032C 8000B65C A8DE032C 8000B65C A8DE032C 8000B65C A8DE032C lha r6, [r30 + 0x032C]
8000B660 48000010 8000B660 48000010 8000B660 48000010 8000B660 48000010 8000B660 48000010 8000B660 48000010 8000B660 48000010 8000B660 48000010 b +0x00000010 /* 8000B670 */
8000B664 A8DE02B8 8000B664 A8DE02B8 8000B664 A8DE02B8 8000B664 A8DE02B8 8000B664 A8DE02B8 8000B664 A8DE02B8 8000B664 A8DE02B8 8000B664 A8DE02B8 lha r6, [r30 + 0x02B8]
8000B668 3CA08001 8000B668 3CA08001 8000B668 3CA08001 8000B668 3CA08001 8000B668 3CA08001 8000B668 3CA08001 8000B668 3CA08001 8000B668 3CA08001 lis r5, 0x8001
8000B66C 9065B6BC 8000B66C 9065B6BC 8000B66C 9065B6BC 8000B66C 9065B6BC 8000B66C 9065B6BC 8000B66C 9065B6BC 8000B66C 9065B6BC 8000B66C 9065B6BC stw [r5 - 0x4944], r3
8000B670 7C0802A6 8000B670 7C0802A6 8000B670 7C0802A6 8000B670 7C0802A6 8000B670 7C0802A6 8000B670 7C0802A6 8000B670 7C0802A6 8000B670 7C0802A6 mflr r0
8000B674 9005B6C0 8000B674 9005B6C0 8000B674 9005B6C0 8000B674 9005B6C0 8000B674 9005B6C0 8000B674 9005B6C0 8000B674 9005B6C0 8000B674 9005B6C0 stw [r5 - 0x4940], r0
8000B678 7C651B78 8000B678 7C651B78 8000B678 7C651B78 8000B678 7C651B78 8000B678 7C651B78 8000B678 7C651B78 8000B678 7C651B78 8000B678 7C651B78 mr r5, r3
8000B67C A8FE02B8 8000B67C A8FE02B8 8000B67C A8FE02B8 8000B67C A8FE02B8 8000B67C A8FE02B8 8000B67C A8FE02B8 8000B67C A8FE02B8 8000B67C A8FE02B8 lha r7, [r30 + 0x02B8]
8000B680 3C808000 8000B680 3C808000 8000B680 3C808000 8000B680 3C808000 8000B680 3C808000 8000B680 3C808000 8000B680 3C808000 8000B680 3C808000 lis r4, 0x8000
8000B684 6084B6AC 8000B684 6084B6AC 8000B684 6084B6AC 8000B684 6084B6AC 8000B684 6084B6AC 8000B684 6084B6AC 8000B684 6084B6AC 8000B684 6084B6AC ori r4, r4, 0xB6AC
8000B688 38640018 8000B688 38640018 8000B688 38640018 8000B688 38640018 8000B688 38640018 8000B688 38640018 8000B688 38640018 8000B688 38640018 addi r3, r4, 0x0018
8000B68C 4CC63182 8000B68C 4CC63182 8000B68C 4CC63182 8000B68C 4CC63182 8000B68C 4CC63182 8000B68C 4CC63182 8000B68C 4CC63182 8000B68C 4CC63182 crxor crb6, crb6, crb6
8000B690 4838A86D 8000B690 4838D275 8000B690 4838F115 8000B690 4838EEC5 8000B690 4838BB3D 8000B690 4838BB95 8000B690 4838F295 8000B690 4838DD85 bl sprintf /* 8039A924 */
8000B694 3C808000 8000B694 3C808000 8000B694 3C808000 8000B694 3C808000 8000B694 3C808000 8000B694 3C808000 8000B694 3C808000 8000B694 3C808000 lis r4, 0x8000
8000B698 6084B6C4 8000B698 6084B6C4 8000B698 6084B6C4 8000B698 6084B6C4 8000B698 6084B6C4 8000B698 6084B6C4 8000B698 6084B6C4 8000B698 6084B6C4 ori r4, r4, 0xB6C4
8000B69C 7F83E378 8000B69C 7F83E378 8000B69C 7F83E378 8000B69C 7F83E378 8000B69C 7F83E378 8000B69C 7F83E378 8000B69C 7F83E378 8000B69C 7F83E378 mr r3, r28
8000B6A0 8004FFFC 8000B6A0 8004FFFC 8000B6A0 8004FFFC 8000B6A0 8004FFFC 8000B6A0 8004FFFC 8000B6A0 8004FFFC 8000B6A0 8004FFFC 8000B6A0 8004FFFC lwz r0, [r4 - 0x0004]
8000B6A4 7C0803A6 8000B6A4 7C0803A6 8000B6A4 7C0803A6 8000B6A4 7C0803A6 8000B6A4 7C0803A6 8000B6A4 7C0803A6 8000B6A4 7C0803A6 8000B6A4 7C0803A6 mtlr r0
8000B6A8 4E800020 8000B6A8 4E800020 8000B6A8 4E800020 8000B6A8 4E800020 8000B6A8 4E800020 8000B6A8 4E800020 8000B6A8 4E800020 8000B6A8 4E800020 blr
8000B6AC 25730A0A 8000B6AC 25730A0A 8000B6AC 25730A0A 8000B6AC 25730A0A 8000B6AC 25730A0A 8000B6AC 25730A0A 8000B6AC 25730A0A 8000B6AC 25730A0A .invalid
8000B6B0 48503A25 8000B6B0 48503A25 8000B6B0 48503A25 8000B6B0 48503A25 8000B6B0 48503A25 8000B6B0 48503A25 8000B6B0 48503A25 8000B6B0 48503A25 bl +0x00503A24 /* 8050F0D4 */
8000B6B4 642F2564 8000B6B4 642F2564 8000B6B4 642F2564 8000B6B4 642F2564 8000B6B4 642F2564 8000B6B4 642F2564 8000B6B4 642F2564 8000B6B4 642F2564 oris r15, r1, 0x2564
8000B6B8 00000000 8000B6B8 00000000 8000B6B8 00000000 8000B6B8 00000000 8000B6B8 00000000 8000B6B8 00000000 8000B6B8 00000000 8000B6B8 00000000 .invalid
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 */
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,94 @@
###########################################################
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.
BIN
View File
Binary file not shown.
Binary file not shown.
View File
Binary file not shown.
File diff suppressed because it is too large Load Diff
-11
View File
@@ -1,11 +0,0 @@
star value tables
psobb [B1-437]
00010203 04090909 01020304 05090909 01020304 05090909 01020304 05090909 01020304 05090909 00010203 04090909 01020304 05090909 01020304 05090909 01020304 05090909 00010203 09090901 02030409 09090102 03040909 09090A0A 090A0A09 0A0A090C 0B0A0A0A 0A0A0A0B 0A090A0A 0A0A0A09 0A0A0A0A 0A0A0A0A 0A0A0B0A 0C0C0B0A 0A090A09 090A0A0A 0A0C090C 0B0A090A 090C0A0B 0A0A0A0A 0A0A0A0B 0B0A0A0A 09090A09 0C0A0A0A 0B0A0B09 0A0A090A 0A0B090B 0A0B0B0A 090A090A 0B090A0A 0A0A0A0A 0A0A0A09 090C0C0C 0C0C0C0C 0C0C0C0C 0C0C0C0C 0C0C0C0C 0C0C0C0C 0C0C0009 0A0A0A0B 090A0A09 0A0A0B0A 0A0A0A0A 0A0A0A0A 0A0A0A0A 0A0A0A0A 0A0A0A0A 0B0B0B0B 0B0B0B0B 0B0B0B0A 0C0A0C0B 0A0A0A0A 0A0B0A0B 0B0B0B0B 0A0A090A 0A0A090B 0B0B0B0C 0C0C0C0C 0A0A0C0A 090A0C09 0A0B0A0A 0A0A0C0A 0A0A0A09 0A0C0A09 0A0A0A0A 0A090C0B 09090909 09090909 09090909 09090909 0909090B 0A0C0A0B 0B0C0A0A 0A090A0A 0A0A0B0A 0A0A0A0A 0909090A 0A090C0A 0C0C0C0C 0C0C0C0C 0C0C0C0C 0C0C0C0C 0C0C0C0C 0C0C0C0C 0C0C0C0C 0C0C0102 03040102 03040203 04020304 01020304 01020304 01020304 01020304 01020304 01020304 03040000 00010102 02030304 04050506 06070707 07080808 08080809 09090A0A 0A0A0A0A 0B0C0A0A 0A0A0A0A 0B0B0B0A 0B0B0C0B 0B0B0B0B 0A0A0A0A 0A0A0C09 0909090A 0A0B0C09 0B0A0A0A 0A0A0A0A 0A0A0A0B 0A0A0A0A 0A0A0A00 00010203 03040405 05050606 07070808 08080808 0A0A0A0A 0A0A0909 090A0A0A 0A0A0A0A 0A0A0B0A 0A0B0A09 0909090A 0B0B0000 0B000000 00080808 08080808 09080808 09080808 09070707 07070909 090C0909 09090909 09090909 09090909 09090909 09090909 09090909 09090909 09090909 09090909 09090909 09090909 09090909 0A0A0B0A 0B0A0909 0B0B0B0C 0A0A0A09 0A0A0A0A 090A0A0A 0A0A0A0A 0A0A0A0A 0203050B 0203050B 0203050B 0203050B 0204060B 0204060B 0203050B 080B080A 0B020305 02030502 03050304 06030405 07080B04 06090406 09040609 06090B06 090B0909 09090909 0A0B0B0B 0B0B0B0B 0B0B0B0B 0B0B0B0B 0B0B0B0B 0A0B0B0B 0B0B0B0B
psogc [94-2F7]
00010203 04090909 01020304 05090909 01020304 05090909 01020304 05090909 01020304 05090909 00010203 04090909 01020304 05090909 01020304 05090909 01020304 05090909 00010203 09090901 02030409 09090102 03040909 09090A0A 090A0A09 0A0A090C 0B0A0A0A 0A0A0A0B 0A090A0A 0A0A0A09 0A0A0A0A 0A0A0A0A 0A0A0B0A 0C0C0B0A 0A090A09 090A0A0A 0A0C090C 0B0A090A 090C0A0B 0A0A0A0A 0A0A0A0B 0B0A0A0A 09090A09 0C0A0A0A 0B0A0B09 0A0A090A 0A0B090B 0A0B0B0A 090A090A 0B090A0A 0A0A0A0A 0A0A0A09 090C0C0C 0C0C0C0C 0C0C0C0C 0C0C0C0C 0C0C0C0C 0C0C0C0C 0C0C0009 0A0A0A0B 090A0A09 0A0A0B0A 0A0A0A0A 0A0A0A0A 0A0A0A0A 0A0A0A0A 0A0A0A0A 0B0B0B0B 0B0B0B0B 0B0B0B0A 0C0A0C0B 0A0A0A0A 0A0B0A0B 0B0B0B0B 0A0A090A 0A0A090B 0B0B0B0C 0C0C0C0C 01020304 01020304 02030402 03040102 03040102 03040102 03040102 03040102 03040102 03040304 00000001 01020203 03040405 05060607 07070708 08080808 08090909 0A0A0A0A 0A0A0B0C 0A0A0A0A 0A0A0B0B 0B0A0B0B 0C0B0B0B 0B0B0000 01020303 04040505 05060607 07080808 0808080A 0A0A0A0A 0A090909 0A0A0A0A 0A0A0A0A 0A0B0A0A 0B0A0909 09090A0B 0B000000 00000000 08080808 08080809 08080809 08080809 07070707 07090909 0C090909 09090909 09090909 09090909 09090909 09090909 09090909 09090909 09090909 09090909 09090909 09090909 09090902 03050B02 03050B02 03050B02 03050B02 04060B02 04060B02 03050B08 0B080A0B 02030502 03050203 05030406 03040507 080B0406 09040609 04060906 090B0609 0B090909 090909
0203050B0203050B0203050B0203050B
+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))
+4 -2
View File
@@ -7,6 +7,8 @@
#include <phosg/Filesystem.hh>
#include <phosg/Strings.hh>
#include "Text.hh"
using namespace std;
AFSArchive::AFSArchive(shared_ptr<const string> data)
@@ -14,12 +16,12 @@ AFSArchive::AFSArchive(shared_ptr<const string> data)
struct FileHeader {
be_uint32_t magic;
le_uint32_t num_files;
} __attribute__((packed));
} __packed_ws__(FileHeader, 8);
struct FileEntry {
le_uint32_t offset;
le_uint32_t size;
} __attribute__((packed));
} __packed_ws__(FileEntry, 8);
StringReader r(*this->data);
const auto& header = r.get<FileHeader>();
-8
View File
@@ -1,8 +0,0 @@
#pragma once
#include <stdexcept>
#include <string>
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");
}
-154
View File
@@ -1,154 +0,0 @@
#include "ARCodeTranslator.hh"
#include <phosg/Filesystem.hh>
#include <phosg/Strings.hh>
#include <resource_file/ExecutableFormats/DOLFile.hh>
using namespace std;
void run_ar_code_translator(const std::string& initial_directory, const std::string& use_file, const std::string& command) {
string directory = initial_directory;
while (ends_with(directory, "/")) {
directory.resize(directory.size() - 1);
}
PrefixedLogger log("[ar-trans] ");
unordered_map<string, shared_ptr<DOLFile>> files;
for (const auto& filename : list_directory(directory)) {
if (ends_with(filename, ".dol")) {
string name = filename.substr(0, filename.size() - 4);
string path = directory + "/" + filename;
files.emplace(name, new DOLFile(path.c_str()));
log.info("Loaded %s", name.c_str());
}
}
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;
break;
}
}
if (!source_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) {
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 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)) {
break;
}
if (source_class == 0x48000000) {
source_opcode &= 0xFC000003;
target_opcode &= 0xFC000003;
} else if (source_class == 0x40000000) {
source_opcode &= 0xFFFF0003;
target_opcode &= 0xFFFF0003;
}
if (source_opcode != target_opcode) {
break;
}
} else {
if (source_r.get_u32l() != target_r.get_u32l()) {
break;
}
}
}
if (z == match_length) {
num_matches++;
last_match_address = target_section.address + target_section_offset;
}
}
}
log.info("(find_match) For match length %zX, %zu matches found", 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");
}
}
throw runtime_error("scan field too long; too many matches");
};
auto handle_command = [&](const string& command) -> void {
auto tokens = split(command, ' ');
if (tokens.empty()) {
throw runtime_error("no command given");
}
strip_trailing_whitespace(tokens[tokens.size() - 1]);
if (tokens[0] == "use") {
source_filename = tokens.at(1);
source_file = files.at(source_filename);
} 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());
}
}
}
} 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 {
while (!feof(stdin)) {
if (!source_filename.empty()) {
fprintf(stdout, "ar-trans:%s/%s> ", directory.c_str(), source_filename.c_str());
} else {
fprintf(stdout, "ar-trans:%s> ", directory.c_str());
}
fflush(stdout);
string command = fgets(stdin);
try {
handle_command(command);
} catch (const exception& e) {
log.error("Failed: %s", e.what());
}
}
fputc('\n', stdout);
}
}
-5
View File
@@ -1,5 +0,0 @@
#pragma once
#include <string>
void run_ar_code_translator(const std::string& initial_directory, const std::string& use_file, const std::string& command);
+1003
View File
File diff suppressed because it is too large Load Diff
+263
View File
@@ -0,0 +1,263 @@
#pragma once
#include <memory>
#include <mutex>
#include <phosg/JSON.hh>
#include <shared_mutex>
#include <string>
#include <unordered_map>
#include <vector>
#include "Text.hh"
class LicenseIndex;
struct DCNTELicense {
std::string serial_number;
std::string access_key;
static std::shared_ptr<DCNTELicense> from_json(const JSON& json);
JSON json() const;
};
struct V1V2License {
uint32_t serial_number = 0;
std::string access_key;
static std::shared_ptr<V1V2License> from_json(const JSON& json);
JSON json() const;
};
struct GCLicense {
uint32_t serial_number = 0;
std::string access_key;
std::string password;
static std::shared_ptr<GCLicense> from_json(const JSON& json);
JSON json() const;
};
struct XBLicense {
std::string gamertag;
uint64_t user_id = 0;
uint64_t account_id = 0;
static std::shared_ptr<XBLicense> from_json(const JSON& json);
JSON json() const;
};
struct BBLicense {
std::string username;
std::string password;
static std::shared_ptr<BBLicense> from_json(const JSON& json);
JSON json() const;
};
struct Account {
enum class Flag : uint32_t {
// clang-format off
KICK_USER = 0x00000001,
BAN_USER = 0x00000002,
SILENCE_USER = 0x00000004,
CHANGE_EVENT = 0x00000010,
ANNOUNCE = 0x00000020,
FREE_JOIN_GAMES = 0x00000040,
DEBUG = 0x01000000,
CHEAT_ANYWHERE = 0x02000000,
DISABLE_QUEST_REQUIREMENTS = 0x04000000,
ALWAYS_ENABLE_CHAT_COMMANDS = 0x08000000,
MODERATOR = 0x00000007,
ADMINISTRATOR = 0x000000FF,
ROOT = 0x7FFFFFFF,
IS_SHARED_ACCOUNT = 0x80000000,
// NOTE: When adding or changing license flags, don't forget to change the
// documentation in the shell's help text.
UNUSED_BITS = 0x70FFFF00,
// clang-format on
};
// account_id is also the account's guild card number
uint32_t account_id = 0;
uint32_t flags = 0;
uint64_t ban_end_time = 0; // 0 = not banned
std::string last_player_name;
std::string auto_reply_message;
uint32_t ep3_current_meseta = 0;
uint32_t ep3_total_meseta_earned = 0;
uint32_t bb_team_id = 0;
bool is_temporary = false; // If true, isn't saved to disk
std::unordered_set<std::string> auto_patches_enabled;
std::unordered_map<std::string, std::shared_ptr<DCNTELicense>> dc_nte_licenses;
std::unordered_map<uint32_t, std::shared_ptr<V1V2License>> dc_licenses;
std::unordered_map<uint32_t, std::shared_ptr<V1V2License>> pc_licenses;
std::unordered_map<uint32_t, std::shared_ptr<GCLicense>> gc_licenses;
std::unordered_map<std::string, std::shared_ptr<XBLicense>> xb_licenses;
std::unordered_map<std::string, std::shared_ptr<BBLicense>> bb_licenses;
Account() = default;
explicit Account(const JSON& json);
virtual ~Account() = default;
JSON json() const;
virtual void save() const;
virtual void delete_file() const;
[[nodiscard]] inline bool check_flag(Flag flag) const {
return !!(this->flags & static_cast<uint32_t>(flag));
}
inline void set_flag(Flag flag) {
this->flags |= static_cast<uint32_t>(flag);
}
inline void clear_flag(Flag flag) {
this->flags &= (~static_cast<uint32_t>(flag));
}
inline void toggle_flag(Flag flag) {
this->flags ^= static_cast<uint32_t>(flag);
}
inline void replace_all_flags(Flag mask) {
this->flags = static_cast<uint32_t>(mask);
}
void print(FILE* stream) const;
};
struct Login {
bool account_was_created = false;
// This field will never be null
std::shared_ptr<Account> account;
// Exactly one of the following will be non-null, representing the license
// that the client logged in with
std::shared_ptr<DCNTELicense> dc_nte_license;
std::shared_ptr<V1V2License> dc_license;
std::shared_ptr<V1V2License> pc_license;
std::shared_ptr<GCLicense> gc_license;
std::shared_ptr<XBLicense> xb_license;
std::shared_ptr<BBLicense> bb_license;
};
class AccountIndex {
public:
class no_username : public std::invalid_argument {
public:
no_username() : invalid_argument("serial number is zero or username is missing") {}
};
class incorrect_password : public std::invalid_argument {
public:
incorrect_password() : invalid_argument("incorrect password") {}
};
class incorrect_access_key : public std::invalid_argument {
public:
incorrect_access_key() : invalid_argument("incorrect access key") {}
};
class missing_account : public std::invalid_argument {
public:
missing_account() : invalid_argument("missing account") {}
};
explicit AccountIndex(bool force_all_temporary);
virtual ~AccountIndex() = default;
std::shared_ptr<Account> create_account(bool is_temporary) const;
size_t count() const;
std::vector<std::shared_ptr<Account>> all() const;
void add(std::shared_ptr<Account> a);
void remove(uint32_t serial_number);
void add_dc_nte_license(std::shared_ptr<Account> account, std::shared_ptr<DCNTELicense> license);
void add_dc_license(std::shared_ptr<Account> account, std::shared_ptr<V1V2License> license);
void add_pc_license(std::shared_ptr<Account> account, std::shared_ptr<V1V2License> license);
void add_gc_license(std::shared_ptr<Account> account, std::shared_ptr<GCLicense> license);
void add_xb_license(std::shared_ptr<Account> account, std::shared_ptr<XBLicense> license);
void add_bb_license(std::shared_ptr<Account> account, std::shared_ptr<BBLicense> license);
void remove_dc_nte_license(std::shared_ptr<Account> account, const std::string& serial_number);
void remove_dc_license(std::shared_ptr<Account> account, uint32_t serial_number);
void remove_pc_license(std::shared_ptr<Account> account, uint32_t serial_number);
void remove_gc_license(std::shared_ptr<Account> account, uint32_t serial_number);
void remove_xb_license(std::shared_ptr<Account> account, const std::string& gamertag);
void remove_bb_license(std::shared_ptr<Account> account, const std::string& username);
std::shared_ptr<Account> from_account_id(uint32_t account_id) const;
std::shared_ptr<Login> from_dc_nte_credentials(
const std::string& serial_number,
const std::string& access_key,
bool allow_create);
std::shared_ptr<Login> from_dc_credentials(
uint32_t serial_number,
const std::string& access_key,
const std::string& character_name,
bool allow_create);
std::shared_ptr<Login> from_pc_nte_credentials(
uint32_t guild_card_number,
bool allow_create);
std::shared_ptr<Login> from_pc_credentials(
uint32_t serial_number,
const std::string& access_key,
const std::string& character_name,
bool allow_create);
std::shared_ptr<Login> from_gc_credentials(
uint32_t serial_number,
const std::string& access_key,
const std::string* password,
const std::string& character_name,
bool allow_create);
std::shared_ptr<Login> from_xb_credentials(
const std::string& gamertag,
uint64_t user_id,
uint64_t account_id,
bool allow_create);
std::shared_ptr<Login> from_bb_credentials(
const std::string& username,
const std::string* password,
bool allow_create);
std::shared_ptr<Account> create_temporary_account_for_shared_account(
std::shared_ptr<const Account> src_a, const std::string& variation_data) const;
protected:
bool force_all_temporary;
// This class must be thread-safe because it's used by both the patch server
// and game server threads
mutable std::shared_mutex lock;
std::unordered_map<uint32_t, std::shared_ptr<Account>> by_account_id;
std::unordered_map<std::string, std::shared_ptr<Account>> by_dc_nte_serial_number;
std::unordered_map<uint32_t, std::shared_ptr<Account>> by_dc_serial_number;
std::unordered_map<uint32_t, std::shared_ptr<Account>> by_pc_serial_number;
std::unordered_map<uint32_t, std::shared_ptr<Account>> by_gc_serial_number;
std::unordered_map<std::string, std::shared_ptr<Account>> by_xb_gamertag;
std::unordered_map<std::string, std::shared_ptr<Account>> by_bb_username;
void add_locked(std::shared_ptr<Account> a);
std::shared_ptr<Login> from_dc_nte_credentials_locked(
const std::string& serial_number,
const std::string& access_key);
std::shared_ptr<Login> from_dc_credentials_locked(
uint32_t serial_number,
const std::string& access_key,
const std::string& character_name);
std::shared_ptr<Login> from_pc_credentials_locked(
uint32_t serial_number,
const std::string& access_key,
const std::string& character_name);
std::shared_ptr<Login> from_gc_credentials_locked(
uint32_t serial_number,
const std::string& access_key,
const std::string* password,
const std::string& character_name);
std::shared_ptr<Login> from_xb_credentials_locked(
const std::string& gamertag,
uint64_t user_id,
uint64_t account_id);
std::shared_ptr<Login> from_bb_credentials_locked(
const std::string& username,
const std::string* password);
};
+14
View File
@@ -0,0 +1,14 @@
#pragma once
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
inline void run_address_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");
}
+528
View File
@@ -0,0 +1,528 @@
#include "AddressTranslator.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;
class AddressTranslator {
public:
enum class ExpandMethod {
PPC_TEXT_FORWARD = 0,
PPC_TEXT_FORWARD_WITH_BARRIER,
PPC_TEXT_BACKWARD,
PPC_TEXT_BACKWARD_WITH_BARRIER,
PPC_TEXT_BOTH,
PPC_TEXT_BOTH_WITH_BARRIER,
PPC_TEXT_BOTH_IGNORE_ORIGIN,
PPC_DATA_FORWARD,
PPC_DATA_BACKWARD,
PPC_DATA_BOTH,
RAW_FORWARD,
RAW_BACKWARD,
RAW_BOTH,
};
static const char* name_for_expand_method(ExpandMethod method) {
switch (method) {
case ExpandMethod::PPC_TEXT_FORWARD:
return "PPC_TEXT_FORWARD";
case ExpandMethod::PPC_TEXT_FORWARD_WITH_BARRIER:
return "PPC_TEXT_FORWARD_WITH_BARRIER";
case ExpandMethod::PPC_TEXT_BACKWARD:
return "PPC_TEXT_BACKWARD";
case ExpandMethod::PPC_TEXT_BACKWARD_WITH_BARRIER:
return "PPC_TEXT_BACKWARD_WITH_BARRIER";
case ExpandMethod::PPC_TEXT_BOTH:
return "PPC_TEXT_BOTH";
case ExpandMethod::PPC_TEXT_BOTH_WITH_BARRIER:
return "PPC_TEXT_BOTH_WITH_BARRIER";
case ExpandMethod::PPC_TEXT_BOTH_IGNORE_ORIGIN:
return "PPC_TEXT_BOTH_IGNORE_ORIGIN";
case ExpandMethod::PPC_DATA_FORWARD:
return "PPC_DATA_FORWARD";
case ExpandMethod::PPC_DATA_BACKWARD:
return "PPC_DATA_BACKWARD";
case ExpandMethod::PPC_DATA_BOTH:
return "PPC_DATA_BOTH";
case ExpandMethod::RAW_FORWARD:
return "RAW_FORWARD";
case ExpandMethod::RAW_BACKWARD:
return "RAW_BACKWARD";
case ExpandMethod::RAW_BOTH:
return "RAW_BOTH";
default:
throw logic_error("invalid expand method");
}
}
static bool is_ppc_expand_method(ExpandMethod method) {
switch (method) {
case ExpandMethod::PPC_TEXT_FORWARD:
case ExpandMethod::PPC_TEXT_FORWARD_WITH_BARRIER:
case ExpandMethod::PPC_TEXT_BACKWARD:
case ExpandMethod::PPC_TEXT_BACKWARD_WITH_BARRIER:
case ExpandMethod::PPC_TEXT_BOTH:
case ExpandMethod::PPC_TEXT_BOTH_WITH_BARRIER:
case ExpandMethod::PPC_TEXT_BOTH_IGNORE_ORIGIN:
case ExpandMethod::PPC_DATA_FORWARD:
case ExpandMethod::PPC_DATA_BACKWARD:
case ExpandMethod::PPC_DATA_BOTH:
return true;
case ExpandMethod::RAW_FORWARD:
case ExpandMethod::RAW_BACKWARD:
case ExpandMethod::RAW_BOTH:
return false;
default:
throw logic_error("invalid expand method");
}
}
static bool is_ppc_data_expand_method(ExpandMethod method) {
switch (method) {
case ExpandMethod::PPC_DATA_FORWARD:
case ExpandMethod::PPC_DATA_BACKWARD:
case ExpandMethod::PPC_DATA_BOTH:
return true;
case ExpandMethod::PPC_TEXT_FORWARD:
case ExpandMethod::PPC_TEXT_FORWARD_WITH_BARRIER:
case ExpandMethod::PPC_TEXT_BACKWARD:
case ExpandMethod::PPC_TEXT_BACKWARD_WITH_BARRIER:
case ExpandMethod::PPC_TEXT_BOTH:
case ExpandMethod::PPC_TEXT_BOTH_WITH_BARRIER:
case ExpandMethod::PPC_TEXT_BOTH_IGNORE_ORIGIN:
case ExpandMethod::RAW_FORWARD:
case ExpandMethod::RAW_BACKWARD:
case ExpandMethod::RAW_BOTH:
return false;
default:
throw logic_error("invalid expand method");
}
}
AddressTranslator(const string& directory)
: log("[addr-trans] "),
directory(directory),
enable_ppc(false) {
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;
DOLFile dol(path.c_str());
auto mem = make_shared<MemoryContext>();
dol.load_into(mem);
this->mems.emplace(name, mem);
this->enable_ppc = true;
this->log.info("Loaded %s", name.c_str());
} else if (ends_with(filename, ".xbe")) {
string name = filename.substr(0, filename.size() - 4);
string path = directory + "/" + filename;
XBEFile xbe(path.c_str());
auto mem = make_shared<MemoryContext>();
xbe.load_into(mem);
this->mems.emplace(name, mem);
this->log.info("Loaded %s", name.c_str());
} else if (ends_with(filename, ".bin")) {
string name = filename.substr(0, filename.size() - 4);
string path = directory + "/" + filename;
string data = load_file(path);
auto mem = make_shared<MemoryContext>();
mem->allocate_at(0x8C010000, data.size());
mem->memcpy(0x8C010000, data.data(), data.size());
this->mems.emplace(name, mem);
this->log.info("Loaded %s", name.c_str());
}
}
}
~AddressTranslator() = default;
const string& get_source_filename() const {
return this->src_filename;
}
void set_source_file(const string& filename) {
this->src_filename = filename;
this->src_mem = this->mems.at(this->src_filename);
}
void find_ppc_rtoc_global_regs() const {
for (const auto& it : this->mems) {
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& block : it.second->allocated_blocks()) {
StringReader r = it.second->reader(block.first, block.second);
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 MemoryContext> dest_mem,
uint32_t src_addr,
uint32_t src_size,
ExpandMethod expand_method) const {
bool is_ppc = this->is_ppc_expand_method(expand_method);
bool is_ppc_data = this->is_ppc_data_expand_method(expand_method);
if (!this->src_mem) {
throw runtime_error("no source file selected");
}
if (src_size == 0) {
src_size = is_ppc ? 4 : 1;
}
pair<uint32_t, uint32_t> src_section = make_pair(0, 0);
for (const auto& sec : this->src_mem->allocated_blocks()) {
if (src_addr >= sec.first && src_addr + src_size <= sec.first + sec.second) {
src_section = sec;
break;
}
}
if (!src_section.second) {
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_addr - src_section.first;
size_t src_bytes_available_before = src_offset;
size_t src_bytes_available_after = src_section.second - 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;
size_t match_length = match_bytes_before + match_bytes_after + 4;
StringReader src_r = this->src_mem->reader(src_section.first + src_offset - match_bytes_before, match_length);
for (const auto& dest_section : dest_mem->allocated_blocks()) {
for (size_t dest_match_offset = 0;
dest_match_offset + match_length < dest_section.second;
dest_match_offset += (is_ppc ? 4 : 1)) {
src_r.go(0);
StringReader dest_r = dest_mem->reader(dest_section.first + dest_match_offset, match_length);
size_t z;
if (is_ppc) {
for (z = 0; z < match_length; z += 4) {
if ((expand_method == ExpandMethod::PPC_TEXT_BOTH_IGNORE_ORIGIN) && (z == match_bytes_before)) {
src_r.skip(4);
dest_r.skip(4);
} else if (!is_ppc_data) {
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 (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 (src_opcode != dest_opcode) {
break;
}
} else {
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;
}
}
}
} else {
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.first + 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::PPC_TEXT_BACKWARD_WITH_BARRIER:
can_expand_backward = (src_r.pget_u32b(0) != 0x4E800020) &&
(src_bytes_available_before >= match_bytes_before + 4);
break;
case ExpandMethod::PPC_TEXT_BACKWARD:
case ExpandMethod::PPC_DATA_BACKWARD:
can_expand_backward = (src_bytes_available_before >= match_bytes_before + 4);
break;
case ExpandMethod::PPC_TEXT_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::PPC_TEXT_FORWARD:
case ExpandMethod::PPC_DATA_FORWARD:
can_expand_forward = (src_bytes_available_after >= match_bytes_after + 4);
break;
case ExpandMethod::PPC_TEXT_BOTH_WITH_BARRIER:
case ExpandMethod::PPC_TEXT_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::PPC_TEXT_BOTH:
case ExpandMethod::PPC_DATA_BOTH:
can_expand_backward = (src_bytes_available_before >= match_bytes_before + 4);
can_expand_forward = (src_bytes_available_after >= match_bytes_after + 4);
break;
case ExpandMethod::RAW_BACKWARD:
can_expand_backward = (src_bytes_available_before > match_bytes_before);
break;
case ExpandMethod::RAW_FORWARD:
can_expand_forward = (src_bytes_available_after > match_bytes_after);
break;
case ExpandMethod::RAW_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 += (is_ppc ? 4 : 1);
}
if (can_expand_forward) {
match_bytes_after += (is_ppc ? 4 : 1);
}
}
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_mem) {
throw runtime_error("no source file selected");
}
map<string, uint32_t> results;
for (const auto& it : this->mems) {
if (it.second == this->src_mem) {
log.info("(%s) %08" PRIX32 " (from source)", it.first.c_str(), src_addr);
results.emplace(it.first, src_addr);
} else {
vector<future<uint32_t>> futures;
static const vector<ExpandMethod> ppc_methods = {
ExpandMethod::PPC_TEXT_FORWARD,
ExpandMethod::PPC_TEXT_FORWARD_WITH_BARRIER,
ExpandMethod::PPC_TEXT_BACKWARD,
ExpandMethod::PPC_TEXT_BACKWARD_WITH_BARRIER,
ExpandMethod::PPC_TEXT_BOTH,
ExpandMethod::PPC_TEXT_BOTH_WITH_BARRIER,
ExpandMethod::PPC_TEXT_BOTH_IGNORE_ORIGIN,
ExpandMethod::PPC_DATA_FORWARD,
ExpandMethod::PPC_DATA_BACKWARD,
ExpandMethod::PPC_DATA_BOTH,
};
static const vector<ExpandMethod> raw_methods = {
ExpandMethod::RAW_FORWARD,
ExpandMethod::RAW_BACKWARD,
ExpandMethod::RAW_BOTH,
};
const auto& methods = this->enable_ppc ? ppc_methods : raw_methods;
for (size_t z = 0; z < methods.size(); z++) {
futures.emplace_back(async(&AddressTranslator::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),
tokens.size() >= 3 ? stoul(tokens[2], nullptr, 16) : 0);
} else if (tokens[0] == "find-ppc-globals") {
this->find_ppc_rtoc_global_regs();
} else if (!tokens[0].empty()) {
throw runtime_error("unknown command");
}
}
void run_shell() {
while (!feof(stdin)) {
if (!this->src_filename.empty()) {
fprintf(stdout, "addr-trans:%s/%s> ", this->directory.c_str(), this->src_filename.c_str());
} else {
fprintf(stdout, "addr-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 MemoryContext>> mems;
string src_filename;
shared_ptr<const MemoryContext> src_mem;
bool enable_ppc;
};
void run_address_translator(const std::string& directory, const std::string& use_filename, const std::string& command) {
AddressTranslator 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;
}
+10
View File
@@ -0,0 +1,10 @@
#pragma once
#include <stdint.h>
#include <string>
#include <utility>
#include <vector>
void run_address_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);
+16 -6
View File
@@ -9,16 +9,21 @@
using namespace std;
template <bool IsBigEndian>
struct BMLHeader {
struct BMLHeaderT {
using U32T = typename std::conditional<IsBigEndian, be_uint32_t, le_uint32_t>::type;
parray<uint8_t, 0x04> unknown_a1;
U32T num_entries;
parray<uint8_t, 0x38> unknown_a2;
} __attribute__((packed));
} __packed__;
using BMLHeader = BMLHeaderT<false>;
using BMLHeaderBE = BMLHeaderT<true>;
check_struct_size(BMLHeader, 0x40);
check_struct_size(BMLHeaderBE, 0x40);
template <bool IsBigEndian>
struct BMLHeaderEntry {
struct BMLHeaderEntryT {
using U32T = typename std::conditional<IsBigEndian, be_uint32_t, le_uint32_t>::type;
pstring<TextEncoding::ASCII, 0x20> filename;
@@ -28,17 +33,22 @@ struct BMLHeaderEntry {
U32T compressed_gvm_size;
U32T decompressed_gvm_size;
parray<uint8_t, 0x0C> unknown_a2;
} __attribute__((packed));
} __packed__;
using BMLHeaderEntry = BMLHeaderEntryT<false>;
using BMLHeaderEntryBE = BMLHeaderEntryT<true>;
check_struct_size(BMLHeaderEntry, 0x40);
check_struct_size(BMLHeaderEntryBE, 0x40);
template <bool IsBigEndian>
void BMLArchive::load_t() {
StringReader r(*this->data);
const auto& header = r.get<BMLHeader<IsBigEndian>>();
const auto& header = r.get<BMLHeaderT<IsBigEndian>>();
size_t offset = 0x800;
while (this->entries.size() < header.num_entries) {
const auto& entry = r.get<BMLHeaderEntry<IsBigEndian>>();
const auto& entry = r.get<BMLHeaderEntryT<IsBigEndian>>();
if (offset + entry.compressed_size > this->data->size()) {
throw runtime_error("BML data entry extends beyond end of data");
+83 -83
View File
@@ -1,83 +1,83 @@
#include "BattleParamsIndex.hh"
#include <phosg/Filesystem.hh>
#include <phosg/Strings.hh>
#include "Loggers.hh"
#include "PSOEncryption.hh"
#include "StaticGameData.hh"
using namespace std;
void BattleParamsIndex::Table::print(FILE* stream) const {
auto print_entry = +[](FILE* stream, const PlayerStats& e) {
fprintf(stream,
"%5hu %5hu %5hu %5hu %5hu %5hu %5hu %5hu %5" PRIu32 " %5" PRIu32,
e.char_stats.atp.load(),
e.char_stats.mst.load(),
e.char_stats.evp.load(),
e.char_stats.hp.load(),
e.char_stats.dfp.load(),
e.char_stats.ata.load(),
e.char_stats.lck.load(),
e.unknown_a1.load(),
e.experience.load(),
e.meseta.load());
};
for (size_t diff = 0; diff < 4; diff++) {
fprintf(stream, "%c ZZ ATP PSV EVP HP DFP ATA LCK ESP EXP DIFF\n",
abbreviation_for_difficulty(diff));
for (size_t z = 0; z < 0x60; z++) {
fprintf(stream, " %02zX ", z);
print_entry(stream, this->stats[diff][z]);
fputc('\n', stream);
}
}
}
BattleParamsIndex::BattleParamsIndex(
shared_ptr<const string> data_on_ep1,
shared_ptr<const string> data_on_ep2,
shared_ptr<const string> data_on_ep4,
shared_ptr<const string> data_off_ep1,
shared_ptr<const string> data_off_ep2,
shared_ptr<const string> data_off_ep4) {
this->files[0][0].data = data_on_ep1;
this->files[0][1].data = data_on_ep2;
this->files[0][2].data = data_on_ep4;
this->files[1][0].data = data_off_ep1;
this->files[1][1].data = data_off_ep2;
this->files[1][2].data = data_off_ep4;
for (uint8_t is_solo = 0; is_solo < 2; is_solo++) {
for (uint8_t episode = 0; episode < 3; episode++) {
auto& file = this->files[is_solo][episode];
if (file.data->size() < sizeof(Table)) {
throw runtime_error(string_printf(
"battle params table size is incorrect (expected %zX bytes, have %zX bytes; is_solo=%hhu, episode=%hhu)",
sizeof(Table), file.data->size(), is_solo, episode));
}
file.table = reinterpret_cast<const Table*>(file.data->data());
}
}
}
const BattleParamsIndex::Table& BattleParamsIndex::get_table(bool solo, Episode episode) const {
uint8_t ep_index;
switch (episode) {
case Episode::EP1:
ep_index = 0;
break;
case Episode::EP2:
ep_index = 1;
break;
case Episode::EP4:
ep_index = 2;
break;
default:
throw invalid_argument("invalid episode");
}
return *this->files[!!solo][ep_index].table;
}
#include "BattleParamsIndex.hh"
#include <phosg/Filesystem.hh>
#include <phosg/Strings.hh>
#include "Loggers.hh"
#include "PSOEncryption.hh"
#include "StaticGameData.hh"
using namespace std;
void BattleParamsIndex::Table::print(FILE* stream) const {
auto print_entry = +[](FILE* stream, const PlayerStats& e) {
fprintf(stream,
"%5hu %5hu %5hu %5hu %5hu %5hu %5hu %5hu %5" PRIu32 " %5" PRIu32,
e.char_stats.atp.load(),
e.char_stats.mst.load(),
e.char_stats.evp.load(),
e.char_stats.hp.load(),
e.char_stats.dfp.load(),
e.char_stats.ata.load(),
e.char_stats.lck.load(),
e.esp.load(),
e.experience.load(),
e.meseta.load());
};
for (size_t diff = 0; diff < 4; diff++) {
fprintf(stream, "%c ZZ ATP PSV EVP HP DFP ATA LCK ESP EXP DIFF\n",
abbreviation_for_difficulty(diff));
for (size_t z = 0; z < 0x60; z++) {
fprintf(stream, " %02zX ", z);
print_entry(stream, this->stats[diff][z]);
fputc('\n', stream);
}
}
}
BattleParamsIndex::BattleParamsIndex(
shared_ptr<const string> data_on_ep1,
shared_ptr<const string> data_on_ep2,
shared_ptr<const string> data_on_ep4,
shared_ptr<const string> data_off_ep1,
shared_ptr<const string> data_off_ep2,
shared_ptr<const string> data_off_ep4) {
this->files[0][0].data = data_on_ep1;
this->files[0][1].data = data_on_ep2;
this->files[0][2].data = data_on_ep4;
this->files[1][0].data = data_off_ep1;
this->files[1][1].data = data_off_ep2;
this->files[1][2].data = data_off_ep4;
for (uint8_t is_solo = 0; is_solo < 2; is_solo++) {
for (uint8_t episode = 0; episode < 3; episode++) {
auto& file = this->files[is_solo][episode];
if (file.data->size() < sizeof(Table)) {
throw runtime_error(string_printf(
"battle params table size is incorrect (expected %zX bytes, have %zX bytes; is_solo=%hhu, episode=%hhu)",
sizeof(Table), file.data->size(), is_solo, episode));
}
file.table = reinterpret_cast<const Table*>(file.data->data());
}
}
}
const BattleParamsIndex::Table& BattleParamsIndex::get_table(bool solo, Episode episode) const {
uint8_t ep_index;
switch (episode) {
case Episode::EP1:
ep_index = 0;
break;
case Episode::EP2:
ep_index = 1;
break;
case Episode::EP4:
ep_index = 2;
break;
default:
throw invalid_argument("invalid episode");
}
return *this->files[!!solo][ep_index].table;
}
+100 -100
View File
@@ -1,100 +1,100 @@
#pragma once
#include <inttypes.h>
#include <array>
#include <memory>
#include <phosg/Encoding.hh>
#include <random>
#include <string>
#include <vector>
#include "EnemyType.hh"
#include "LevelTable.hh"
#include "StaticGameData.hh"
#include "Text.hh"
class BattleParamsIndex {
public:
// These files are little-endian, even on PSO GC.
struct AttackData {
/* 00 */ le_int16_t unknown_a1;
/* 02 */ le_int16_t atp;
/* 04 */ le_int16_t ata_bonus;
/* 06 */ le_uint16_t unknown_a4;
/* 08 */ le_float distance_x;
/* 0C */ le_float angle_x;
/* 10 */ le_float distance_y;
/* 14 */ le_uint16_t unknown_a8;
/* 16 */ le_uint16_t unknown_a9;
/* 18 */ le_uint16_t unknown_a10;
/* 1A */ le_uint16_t unknown_a11;
/* 1C */ le_uint32_t unknown_a12;
/* 20 */ le_uint32_t unknown_a13;
/* 24 */ le_uint32_t unknown_a14;
/* 28 */ le_uint32_t unknown_a15;
/* 2C */ le_uint32_t unknown_a16;
/* 30 */
} __attribute__((packed));
struct ResistData {
/* 00 */ le_int16_t evp_bonus;
/* 02 */ le_uint16_t efr;
/* 04 */ le_uint16_t eic;
/* 06 */ le_uint16_t eth;
/* 08 */ le_uint16_t elt;
/* 0A */ le_uint16_t edk;
/* 0C */ le_uint32_t unknown_a6;
/* 10 */ le_uint32_t unknown_a7;
/* 14 */ le_uint32_t unknown_a8;
/* 18 */ le_uint32_t unknown_a9;
/* 1C */ le_int32_t dfp_bonus;
/* 20 */
} __attribute__((packed));
struct MovementData {
/* 00 */ le_float idle_move_speed;
/* 04 */ le_float idle_animation_speed;
/* 08 */ le_float move_speed;
/* 0C */ le_float animation_speed;
/* 10 */ le_float unknown_a1;
/* 14 */ le_float unknown_a2;
/* 18 */ le_uint32_t unknown_a3;
/* 1C */ le_uint32_t unknown_a4;
/* 20 */ le_uint32_t unknown_a5;
/* 24 */ le_uint32_t unknown_a6;
/* 28 */ le_uint32_t unknown_a7;
/* 2C */ le_uint32_t unknown_a8;
/* 30 */
} __attribute__((packed));
struct Table {
/* 0000 */ parray<parray<PlayerStats, 0x60>, 4> stats;
/* 3600 */ parray<parray<AttackData, 0x60>, 4> attack_data;
/* 7E00 */ parray<parray<ResistData, 0x60>, 4> resist_data;
/* AE00 */ parray<parray<MovementData, 0x60>, 4> movement_data;
/* F600 */
void print(FILE* stream) const;
} __attribute__((packed));
BattleParamsIndex(
std::shared_ptr<const std::string> data_on_ep1, // BattleParamEntry_on.dat
std::shared_ptr<const std::string> data_on_ep2, // BattleParamEntry_lab_on.dat
std::shared_ptr<const std::string> data_on_ep4, // BattleParamEntry_ep4_on.dat
std::shared_ptr<const std::string> data_off_ep1, // BattleParamEntry.dat
std::shared_ptr<const std::string> data_off_ep2, // BattleParamEntry_lab.dat
std::shared_ptr<const std::string> data_off_ep4); // BattleParamEntry_ep4.dat
const Table& get_table(bool solo, Episode episode) const;
private:
struct File {
std::shared_ptr<const std::string> data;
const Table* table;
};
// Indexed as [online/offline][episode]
std::array<std::array<File, 3>, 2> files;
};
#pragma once
#include <inttypes.h>
#include <array>
#include <memory>
#include <phosg/Encoding.hh>
#include <random>
#include <string>
#include <vector>
#include "EnemyType.hh"
#include "LevelTable.hh"
#include "StaticGameData.hh"
#include "Text.hh"
class BattleParamsIndex {
public:
// These files are little-endian, even on PSO GC.
struct AttackData {
/* 00 */ le_int16_t unknown_a1;
/* 02 */ le_int16_t atp;
/* 04 */ le_int16_t ata_bonus;
/* 06 */ le_uint16_t unknown_a4;
/* 08 */ le_float distance_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;
/* 18 */ le_uint16_t unknown_a10;
/* 1A */ le_uint16_t unknown_a11;
/* 1C */ le_uint32_t unknown_a12;
/* 20 */ le_uint32_t unknown_a13;
/* 24 */ le_uint32_t unknown_a14;
/* 28 */ le_uint32_t unknown_a15;
/* 2C */ le_uint32_t unknown_a16;
/* 30 */
} __packed_ws__(AttackData, 0x30);
struct ResistData {
/* 00 */ le_int16_t evp_bonus;
/* 02 */ le_uint16_t efr;
/* 04 */ le_uint16_t eic;
/* 06 */ le_uint16_t eth;
/* 08 */ le_uint16_t elt;
/* 0A */ le_uint16_t edk;
/* 0C */ le_uint32_t unknown_a6;
/* 10 */ le_uint32_t unknown_a7;
/* 14 */ le_uint32_t unknown_a8;
/* 18 */ le_uint32_t unknown_a9;
/* 1C */ le_int32_t dfp_bonus;
/* 20 */
} __packed_ws__(ResistData, 0x20);
struct MovementData {
/* 00 */ le_float idle_move_speed;
/* 04 */ le_float idle_animation_speed;
/* 08 */ le_float move_speed;
/* 0C */ le_float animation_speed;
/* 10 */ le_float unknown_a1;
/* 14 */ le_float unknown_a2;
/* 18 */ le_uint32_t unknown_a3;
/* 1C */ le_uint32_t unknown_a4;
/* 20 */ le_uint32_t unknown_a5;
/* 24 */ le_uint32_t unknown_a6;
/* 28 */ le_uint32_t unknown_a7;
/* 2C */ le_uint32_t unknown_a8;
/* 30 */
} __packed_ws__(MovementData, 0x30);
struct Table {
/* 0000 */ parray<parray<PlayerStats, 0x60>, 4> stats;
/* 3600 */ parray<parray<AttackData, 0x60>, 4> attack_data;
/* 7E00 */ parray<parray<ResistData, 0x60>, 4> resist_data;
/* AE00 */ parray<parray<MovementData, 0x60>, 4> movement_data;
/* F600 */
void print(FILE* stream) const;
} __packed_ws__(Table, 0xF600);
BattleParamsIndex(
std::shared_ptr<const std::string> data_on_ep1, // BattleParamEntry_on.dat
std::shared_ptr<const std::string> data_on_ep2, // BattleParamEntry_lab_on.dat
std::shared_ptr<const std::string> data_on_ep4, // BattleParamEntry_ep4_on.dat
std::shared_ptr<const std::string> data_off_ep1, // BattleParamEntry.dat
std::shared_ptr<const std::string> data_off_ep2, // BattleParamEntry_lab.dat
std::shared_ptr<const std::string> data_off_ep4); // BattleParamEntry_ep4.dat
const Table& get_table(bool solo, Episode episode) const;
private:
struct File {
std::shared_ptr<const std::string> data;
const Table* table;
};
// Indexed as [online/offline][episode]
std::array<std::array<File, 3>, 2> files;
};
+188 -137
View File
@@ -1,137 +1,188 @@
#include "CatSession.hh"
#include <arpa/inet.h>
#include <ctype.h>
#include <errno.h>
#include <event2/buffer.h>
#include <event2/bufferevent.h>
#include <event2/event.h>
#include <event2/listener.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <algorithm>
#include <iostream>
#include <phosg/Encoding.hh>
#include <phosg/Filesystem.hh>
#include <phosg/Network.hh>
#include <phosg/Random.hh>
#include <phosg/Strings.hh>
#include <phosg/Time.hh>
#include "Loggers.hh"
#include "PSOProtocol.hh"
#include "ProxyCommands.hh"
#include "ReceiveCommands.hh"
#include "ReceiveSubcommands.hh"
#include "SendCommands.hh"
using namespace std;
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"),
bb_key_file(bb_key_file) {
if (remote.ss_family != AF_INET) {
throw runtime_error("remote is not AF_INET");
}
string netloc_str = render_sockaddr_storage(remote);
this->log.info("Connecting to %s", netloc_str.c_str());
struct bufferevent* bev = bufferevent_socket_new(
this->base.get(), -1, BEV_OPT_CLOSE_ON_FREE | BEV_OPT_DEFER_CALLBACKS);
if (!bev) {
throw runtime_error(string_printf("failed to open socket (%d)", EVUTIL_SOCKET_ERROR()));
}
this->channel.set_bufferevent(bev);
if (bufferevent_socket_connect(this->channel.bev.get(),
reinterpret_cast<const sockaddr*>(&remote), sizeof(struct sockaddr_in)) != 0) {
throw runtime_error(string_printf("failed to connect (%d)", EVUTIL_SOCKET_ERROR()));
}
}
void CatSession::dispatch_on_channel_input(
Channel& ch, uint16_t command, uint32_t flag, std::string& data) {
auto* session = reinterpret_cast<CatSession*>(ch.context_obj);
session->on_channel_input(command, flag, data);
}
void CatSession::on_channel_input(
uint16_t command, uint32_t flag, std::string& data) {
if (!uses_v4_encryption(this->channel.version)) {
if (command == 0x02 || command == 0x17 || command == 0x91 || command == 0x9B) {
const auto& cmd = check_size_t<S_ServerInitDefault_DC_PC_V3_02_17_91_9B>(data, 0xFFFF);
if (uses_v3_encryption(this->channel.version)) {
this->channel.crypt_in.reset(new PSOV3Encryption(cmd.server_key));
this->channel.crypt_out.reset(new PSOV3Encryption(cmd.client_key));
this->log.info("Enabled V3 encryption (server key %08" PRIX32 ", client key %08" PRIX32 ")",
cmd.server_key.load(), cmd.client_key.load());
} else { // PC, DC, or patch server
this->channel.crypt_in.reset(new PSOV2Encryption(cmd.server_key));
this->channel.crypt_out.reset(new PSOV2Encryption(cmd.client_key));
this->log.info("Enabled V2 encryption (server key %08" PRIX32 ", client key %08" PRIX32 ")",
cmd.server_key.load(), cmd.client_key.load());
}
}
} else { // BB
if (command == 0x03 || command == 0x9B) {
if (!this->bb_key_file) {
throw runtime_error("BB encryption requires a key file");
}
const auto& cmd = check_size_t<S_ServerInitDefault_BB_03_9B>(data, 0xFFFF);
this->channel.crypt_in.reset(new PSOBBEncryption(*this->bb_key_file, &cmd.server_key[0], sizeof(cmd.server_key)));
this->channel.crypt_out.reset(new PSOBBEncryption(*this->bb_key_file, &cmd.client_key[0], sizeof(cmd.client_key)));
this->log.info("Enabled BB encryption");
}
}
// TODO: Use the iovec form of print_data here instead of
// prepend_command_header (which copies the string)
string full_cmd = prepend_command_header(
this->channel.version, this->channel.crypt_in.get(), command, flag, data);
print_data(stdout, full_cmd, 0, nullptr, PrintDataFlags::PRINT_ASCII | PrintDataFlags::OFFSET_16_BITS);
}
void CatSession::dispatch_on_channel_error(Channel& ch, short events) {
auto* session = reinterpret_cast<CatSession*>(ch.context_obj);
session->on_channel_error(events);
}
void CatSession::on_channel_error(short events) {
if (events & BEV_EVENT_CONNECTED) {
this->log.info("Channel connected");
}
if (events & BEV_EVENT_ERROR) {
int err = EVUTIL_SOCKET_ERROR();
this->log.warning("Error %d (%s) in unlinked client stream", err,
evutil_socket_error_to_string(err));
}
if (events & (BEV_EVENT_ERROR | BEV_EVENT_EOF)) {
this->log.info("Session endpoint has disconnected");
this->channel.disconnect();
event_base_loopexit(this->base.get(), nullptr);
}
}
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());
}
#include "CatSession.hh"
#include <arpa/inet.h>
#include <ctype.h>
#include <errno.h>
#include <event2/buffer.h>
#include <event2/bufferevent.h>
#include <event2/event.h>
#include <event2/listener.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <algorithm>
#include <iostream>
#include <phosg/Encoding.hh>
#include <phosg/Filesystem.hh>
#include <phosg/Network.hh>
#include <phosg/Random.hh>
#include <phosg/Strings.hh>
#include <phosg/Time.hh>
#include "Loggers.hh"
#include "PSOProtocol.hh"
#include "ProxyCommands.hh"
#include "ReceiveCommands.hh"
#include "ReceiveSubcommands.hh"
#include "SendCommands.hh"
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)
: 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");
}
string netloc_str = render_sockaddr_storage(remote);
this->log.info("Connecting to %s", netloc_str.c_str());
struct bufferevent* bev = bufferevent_socket_new(
this->base.get(), -1, BEV_OPT_CLOSE_ON_FREE | BEV_OPT_DEFER_CALLBACKS);
if (!bev) {
throw runtime_error(string_printf("failed to open socket (%d)", EVUTIL_SOCKET_ERROR()));
}
this->channel.set_bufferevent(bev, 0);
if (bufferevent_socket_connect(this->channel.bev.get(),
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(
Channel& ch, uint16_t command, uint32_t flag, std::string& data) {
auto* session = reinterpret_cast<CatSession*>(ch.context_obj);
session->on_channel_input(command, flag, data);
}
void CatSession::on_channel_input(
uint16_t command, uint32_t flag, std::string& data) {
if (!uses_v4_encryption(this->channel.version)) {
if (command == 0x02 || command == 0x17 || command == 0x91 || command == 0x9B) {
const auto& cmd = check_size_t<S_ServerInitDefault_DC_PC_V3_02_17_91_9B>(data, 0xFFFF);
if (uses_v3_encryption(this->channel.version)) {
this->channel.crypt_in = make_shared<PSOV3Encryption>(cmd.server_key);
this->channel.crypt_out = make_shared<PSOV3Encryption>(cmd.client_key);
this->log.info("Enabled V3 encryption (server key %08" PRIX32 ", client key %08" PRIX32 ")",
cmd.server_key.load(), cmd.client_key.load());
} else { // PC, DC, or patch server
this->channel.crypt_in = make_shared<PSOV2Encryption>(cmd.server_key);
this->channel.crypt_out = make_shared<PSOV2Encryption>(cmd.client_key);
this->log.info("Enabled V2 encryption (server key %08" PRIX32 ", client key %08" PRIX32 ")",
cmd.server_key.load(), cmd.client_key.load());
}
}
} else { // BB
if (command == 0x03 || command == 0x9B) {
if (!this->bb_key_file) {
throw runtime_error("BB encryption requires a key file");
}
const auto& cmd = check_size_t<S_ServerInitDefault_BB_03_9B>(data, 0xFFFF);
this->channel.crypt_in = make_shared<PSOBBEncryption>(*this->bb_key_file, &cmd.server_key[0], sizeof(cmd.server_key));
this->channel.crypt_out = make_shared<PSOBBEncryption>(*this->bb_key_file, &cmd.client_key[0], sizeof(cmd.client_key));
this->log.info("Enabled BB encryption");
}
}
// TODO: Use the iovec form of print_data here instead of
// prepend_command_header (which copies the string)
string full_cmd = prepend_command_header(
this->channel.version, this->channel.crypt_in.get(), command, flag, data);
print_data(stdout, full_cmd, 0, nullptr, PrintDataFlags::PRINT_ASCII | PrintDataFlags::OFFSET_16_BITS);
}
void CatSession::dispatch_on_channel_error(Channel& ch, short events) {
auto* session = reinterpret_cast<CatSession*>(ch.context_obj);
session->on_channel_error(events);
}
void CatSession::on_channel_error(short events) {
if (events & BEV_EVENT_CONNECTED) {
this->log.info("Channel connected");
}
if (events & BEV_EVENT_ERROR) {
int err = EVUTIL_SOCKET_ERROR();
this->log.warning("Error %d (%s) in unlinked client stream", err,
evutil_socket_error_to_string(err));
}
if (events & (BEV_EVENT_ERROR | BEV_EVENT_EOF)) {
this->log.info("Session endpoint has disconnected");
this->channel.disconnect();
event_base_loopexit(this->base.get(), nullptr);
}
}
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());
}
}
}
+54 -41
View File
@@ -1,41 +1,54 @@
#pragma once
#include <event2/event.h>
#include <functional>
#include <map>
#include <memory>
#include <phosg/Filesystem.hh>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "PSOEncryption.hh"
#include "PSOProtocol.hh"
#include "ServerState.hh"
#include "Shell.hh"
class CatSession : public Shell {
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);
virtual ~CatSession() = default;
protected:
PrefixedLogger log;
Channel channel;
std::shared_ptr<const PSOBBEncryption::KeyFile> bb_key_file;
virtual void print_prompt();
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_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);
};
#pragma once
#include <event2/event.h>
#include <functional>
#include <map>
#include <memory>
#include <phosg/Filesystem.hh>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include "PSOEncryption.hh"
#include "PSOProtocol.hh"
#include "ServerState.hh"
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;
class exit_shell : public std::runtime_error {
public:
exit_shell();
~exit_shell() = default;
};
virtual void execute_command(const std::string& command);
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();
};
+421 -423
View File
@@ -1,423 +1,421 @@
#include "Channel.hh"
#include <errno.h>
#include <event2/buffer.h>
#include <event2/bufferevent.h>
#include <event2/event.h>
#include <string.h>
#include <unistd.h>
#include <phosg/Network.hh>
#include <phosg/Time.hh>
#include "Loggers.hh"
#include "Version.hh"
using namespace std;
extern bool use_terminal_colors;
static void flush_and_free_bufferevent(struct bufferevent* bev) {
bufferevent_flush(bev, EV_READ | EV_WRITE, BEV_FINISHED);
bufferevent_free(bev);
}
Channel::Channel(
Version version,
uint8_t language,
on_command_received_t on_command_received,
on_error_t on_error,
void* context_obj,
const string& name,
TerminalFormat terminal_send_color,
TerminalFormat terminal_recv_color)
: bev(nullptr, flush_and_free_bufferevent),
version(version),
language(language),
name(name),
terminal_send_color(terminal_send_color),
terminal_recv_color(terminal_recv_color),
on_command_received(on_command_received),
on_error(on_error),
context_obj(context_obj) {
}
Channel::Channel(
struct bufferevent* bev,
Version version,
uint8_t language,
on_command_received_t on_command_received,
on_error_t on_error,
void* context_obj,
const string& name,
TerminalFormat terminal_send_color,
TerminalFormat terminal_recv_color)
: bev(nullptr, flush_and_free_bufferevent),
version(version),
language(language),
name(name),
terminal_send_color(terminal_send_color),
terminal_recv_color(terminal_recv_color),
on_command_received(on_command_received),
on_error(on_error),
context_obj(context_obj) {
this->set_bufferevent(bev);
}
void Channel::replace_with(
Channel&& other,
on_command_received_t on_command_received,
on_error_t on_error,
void* context_obj,
const std::string& name) {
this->set_bufferevent(other.bev.release());
this->local_addr = other.local_addr;
this->remote_addr = other.remote_addr;
this->is_virtual_connection = other.is_virtual_connection;
this->version = other.version;
this->language = other.language;
this->crypt_in = other.crypt_in;
this->crypt_out = other.crypt_out;
this->name = name;
this->terminal_send_color = other.terminal_send_color;
this->terminal_recv_color = other.terminal_recv_color;
this->on_command_received = on_command_received;
this->on_error = on_error;
this->context_obj = context_obj;
other.disconnect(); // Clears crypts, addrs, etc.
}
void Channel::set_bufferevent(struct bufferevent* bev) {
this->bev.reset(bev);
if (this->bev.get()) {
int fd = bufferevent_getfd(this->bev.get());
if (fd < 0) {
this->is_virtual_connection = true;
memset(&this->local_addr, 0, sizeof(this->local_addr));
memset(&this->remote_addr, 0, sizeof(this->remote_addr));
} else {
this->is_virtual_connection = false;
get_socket_addresses(fd, &this->local_addr, &this->remote_addr);
}
bufferevent_setcb(this->bev.get(),
&Channel::dispatch_on_input, nullptr,
&Channel::dispatch_on_error, this);
bufferevent_enable(this->bev.get(), EV_READ | EV_WRITE);
} else {
this->is_virtual_connection = false;
memset(&this->local_addr, 0, sizeof(this->local_addr));
memset(&this->remote_addr, 0, sizeof(this->remote_addr));
}
}
void Channel::disconnect() {
if (this->bev.get()) {
// If the output buffer is not empty, move the bufferevent into the draining
// pool instead of disconnecting it, to make sure all the data gets sent.
struct evbuffer* out_buffer = bufferevent_get_output(this->bev.get());
if (evbuffer_get_length(out_buffer) == 0) {
this->bev.reset(); // Destructor flushes and frees the bufferevent
} else {
// The callbacks will free it when all the data is sent or the client
// disconnects
auto on_output = +[](struct bufferevent* bev, void*) -> void {
flush_and_free_bufferevent(bev);
};
auto on_error = +[](struct bufferevent* bev, short events, void*) -> void {
if (events & BEV_EVENT_ERROR) {
int err = EVUTIL_SOCKET_ERROR();
channel_exceptions_log.warning(
"Disconnecting channel caused error %d (%s)", err,
evutil_socket_error_to_string(err));
}
if (events & (BEV_EVENT_EOF | BEV_EVENT_ERROR)) {
bufferevent_flush(bev, EV_WRITE, BEV_FINISHED);
bufferevent_free(bev);
}
};
struct bufferevent* bev = this->bev.release();
bufferevent_setcb(bev, nullptr, on_output, on_error, bev);
bufferevent_disable(bev, EV_READ);
}
}
memset(&this->local_addr, 0, sizeof(this->local_addr));
memset(&this->remote_addr, 0, sizeof(this->remote_addr));
this->is_virtual_connection = false;
this->crypt_in.reset();
this->crypt_out.reset();
}
Channel::Message Channel::recv() {
struct evbuffer* buf = bufferevent_get_input(this->bev.get());
size_t header_size = (this->version == Version::BB_V4) ? 8 : 4;
PSOCommandHeader header;
if (evbuffer_copyout(buf, &header, header_size) < static_cast<ssize_t>(header_size)) {
throw out_of_range("no command available");
}
if (this->crypt_in.get()) {
this->crypt_in->decrypt(&header, header_size, false);
}
size_t command_logical_size = header.size(version);
// If encryption is enabled, BB pads commands to 8-byte boundaries, and this
// is not reflected in the size field. This logic does not occur if encryption
// is not yet enabled.
size_t command_physical_size = (this->crypt_in.get() && (version == Version::BB_V4))
? ((command_logical_size + 7) & ~7)
: command_logical_size;
if (evbuffer_get_length(buf) < command_physical_size) {
throw out_of_range("no command available");
}
// If we get here, then there is a full command in the buffer. Some encryption
// algorithms' advancement depends on the decrypted data, so we have to
// actually decrypt the header again (with advance=true) to keep them in a
// consistent state.
string header_data(header_size, '\0');
if (evbuffer_remove(buf, header_data.data(), header_data.size()) < static_cast<ssize_t>(header_data.size())) {
throw logic_error("enough bytes available, but could not remove them");
}
if (this->crypt_in.get()) {
this->crypt_in->decrypt(header_data.data(), header_data.size());
}
string command_data(command_physical_size - header_size, '\0');
if (evbuffer_remove(buf, command_data.data(), command_data.size()) < static_cast<ssize_t>(command_data.size())) {
throw logic_error("enough bytes available, but could not remove them");
}
if (this->crypt_in.get()) {
// Some versions of PSO DC can send commands whose sizes are not a multiple
// of 4, but the server is expected to always use a multiple of 4 bytes when
// decrypting (the extra cipher bytes are lost). To emulate this behavior,
// we have to round up the size for DC commands here.
size_t orig_size = command_data.size();
command_data.resize((orig_size + 3) & (~3), 0);
this->crypt_in->decrypt(command_data.data(), command_data.size());
command_data.resize(orig_size);
}
command_data.resize(command_logical_size - header_size);
if (command_data_log.should_log(LogLevel::INFO) && (this->terminal_recv_color != TerminalFormat::END)) {
if (use_terminal_colors && this->terminal_recv_color != TerminalFormat::NORMAL) {
print_color_escape(stderr, this->terminal_recv_color, TerminalFormat::BOLD, TerminalFormat::END);
}
if (version == Version::BB_V4) {
command_data_log.info(
"Received from %s (version=BB command=%04hX flag=%08" PRIX32 ")",
this->name.c_str(),
header.command(this->version),
header.flag(this->version));
} else {
command_data_log.info(
"Received from %s (version=%s command=%02hX flag=%02" PRIX32 ")",
this->name.c_str(),
name_for_enum(this->version),
header.command(this->version),
header.flag(this->version));
}
vector<struct iovec> iovs;
iovs.emplace_back(iovec{.iov_base = header_data.data(), .iov_len = header_data.size()});
iovs.emplace_back(iovec{.iov_base = command_data.data(), .iov_len = command_data.size()});
print_data(stderr, iovs, 0, nullptr, PrintDataFlags::PRINT_ASCII | PrintDataFlags::DISABLE_COLOR | PrintDataFlags::OFFSET_16_BITS);
if (use_terminal_colors && this->terminal_recv_color != TerminalFormat::NORMAL) {
print_color_escape(stderr, TerminalFormat::NORMAL, TerminalFormat::END);
}
}
return {
.command = header.command(this->version),
.flag = header.flag(this->version),
.data = std::move(command_data),
};
}
void Channel::send(uint16_t cmd, uint32_t flag, bool silent) {
this->send(cmd, flag, nullptr, 0, silent);
}
void Channel::send(uint16_t cmd, uint32_t flag, const std::vector<std::pair<const void*, size_t>> blocks, bool silent) {
if (!this->connected()) {
channel_exceptions_log.warning("Attempted to send command on closed channel; dropping data");
return;
}
size_t size = 0;
for (const auto& b : blocks) {
size += b.second;
}
string send_data;
size_t logical_size;
size_t send_data_size = 0;
switch (this->version) {
case Version::DC_NTE:
case Version::DC_V1_11_2000_PROTOTYPE:
case Version::DC_V1:
case Version::DC_V2:
case Version::GC_NTE:
case Version::GC_V3:
case Version::GC_EP3_TRIAL_EDITION:
case Version::GC_EP3:
case Version::XB_V3: {
PSOCommandHeaderDCV3 header;
if (this->crypt_out.get() &&
(this->version != Version::DC_NTE) &&
(this->version != Version::DC_V1_11_2000_PROTOTYPE) &&
(this->version != Version::DC_V1)) {
send_data_size = (sizeof(header) + size + 3) & ~3;
} else {
send_data_size = (sizeof(header) + size);
}
logical_size = send_data_size;
header.command = cmd;
header.flag = flag;
header.size = send_data_size;
send_data.append(reinterpret_cast<const char*>(&header), sizeof(header));
break;
}
case Version::PC_PATCH:
case Version::BB_PATCH:
case Version::PC_V2: {
PSOCommandHeaderPC header;
if (this->crypt_out.get()) {
send_data_size = (sizeof(header) + size + 3) & ~3;
} else {
send_data_size = (sizeof(header) + size);
}
logical_size = send_data_size;
header.size = send_data_size;
header.command = cmd;
header.flag = flag;
send_data.append(reinterpret_cast<const char*>(&header), sizeof(header));
break;
}
case Version::BB_V4: {
// BB has an annoying behavior here: command lengths must be multiples of
// 4, but the actual data length must be a multiple of 8. If the size
// field is not divisible by 8, 4 extra bytes are sent anyway. This
// behavior only applies when encryption is enabled - any commands sent
// before encryption is enabled have no size restrictions (except they
// must include a full header and must fit in the client's receive
// buffer), and no implicit extra bytes are sent.
PSOCommandHeaderBB header;
if (this->crypt_out.get()) {
send_data_size = (sizeof(header) + size + 7) & ~7;
} else {
send_data_size = (sizeof(header) + size);
}
logical_size = (sizeof(header) + size + 3) & ~3;
header.size = logical_size;
header.command = cmd;
header.flag = flag;
send_data.append(reinterpret_cast<const char*>(&header), sizeof(header));
break;
}
default:
throw logic_error("unimplemented game version in send_command");
}
// All versions of PSO I've seen (so far) have a receive buffer 0x7C00
// bytes in size
if (send_data_size > 0x7C00) {
throw runtime_error("outbound command too large");
}
send_data.reserve(send_data_size);
for (const auto& b : blocks) {
send_data.append(reinterpret_cast<const char*>(b.first), b.second);
}
send_data.resize(send_data_size, '\0');
if (!silent && (command_data_log.should_log(LogLevel::INFO)) && (this->terminal_send_color != TerminalFormat::END)) {
if (use_terminal_colors && this->terminal_send_color != TerminalFormat::NORMAL) {
print_color_escape(stderr, TerminalFormat::FG_YELLOW, TerminalFormat::BOLD, TerminalFormat::END);
}
if (version == Version::BB_V4) {
command_data_log.info("Sending to %s (version=BB command=%04hX flag=%08" PRIX32 ")",
this->name.c_str(), cmd, flag);
} else {
command_data_log.info("Sending to %s (version=%s command=%02hX flag=%02" PRIX32 ")",
this->name.c_str(), name_for_enum(version), cmd, flag);
}
print_data(stderr, send_data.data(), logical_size, 0, nullptr, PrintDataFlags::PRINT_ASCII | PrintDataFlags::DISABLE_COLOR | PrintDataFlags::OFFSET_16_BITS);
if (use_terminal_colors && this->terminal_send_color != TerminalFormat::NORMAL) {
print_color_escape(stderr, TerminalFormat::NORMAL, TerminalFormat::END);
}
}
if (this->crypt_out.get()) {
this->crypt_out->encrypt(send_data.data(), send_data.size());
}
struct evbuffer* buf = bufferevent_get_output(this->bev.get());
evbuffer_add(buf, send_data.data(), send_data.size());
}
void Channel::send(uint16_t cmd, uint32_t flag, const void* data, size_t size, bool silent) {
this->send(cmd, flag, {make_pair(data, size)}, silent);
}
void Channel::send(uint16_t cmd, uint32_t flag, const string& data, bool silent) {
this->send(cmd, flag, data.data(), data.size(), silent);
}
void Channel::send(const void* data, size_t size, bool silent) {
size_t header_size = (this->version == Version::BB_V4) ? 8 : 4;
const auto* header = reinterpret_cast<const PSOCommandHeader*>(data);
this->send(
header->command(this->version),
header->flag(this->version),
reinterpret_cast<const uint8_t*>(data) + header_size,
size - header_size,
silent);
}
void Channel::send(const string& data, bool silent) {
return this->send(data.data(), data.size(), silent);
}
void Channel::dispatch_on_input(struct bufferevent*, void* ctx) {
Channel* ch = reinterpret_cast<Channel*>(ctx);
// The client can be disconnected during on_command_received, so we have to
// make sure ch->bev is valid every time before calling recv()
while (ch->bev.get()) {
Message msg;
try {
msg = ch->recv();
} catch (const out_of_range&) {
break;
} catch (const exception& e) {
channel_exceptions_log.warning("Error receiving on channel: %s", e.what());
ch->on_error(*ch, BEV_EVENT_ERROR);
break;
}
if (ch->on_command_received) {
ch->on_command_received(*ch, msg.command, msg.flag, msg.data);
}
}
}
void Channel::dispatch_on_error(struct bufferevent*, short events, void* ctx) {
Channel* ch = reinterpret_cast<Channel*>(ctx);
if (ch->on_error) {
ch->on_error(*ch, events);
} else {
ch->disconnect();
}
}
#include "Channel.hh"
#include <errno.h>
#include <event2/buffer.h>
#include <event2/bufferevent.h>
#include <event2/event.h>
#include <string.h>
#include <unistd.h>
#include <phosg/Network.hh>
#include <phosg/Time.hh>
#include "Loggers.hh"
#include "Version.hh"
using namespace std;
extern bool use_terminal_colors;
static void flush_and_free_bufferevent(struct bufferevent* bev) {
bufferevent_flush(bev, EV_READ | EV_WRITE, BEV_FINISHED);
bufferevent_free(bev);
}
Channel::Channel(
Version version,
uint8_t language,
on_command_received_t on_command_received,
on_error_t on_error,
void* context_obj,
const string& name,
TerminalFormat terminal_send_color,
TerminalFormat terminal_recv_color)
: bev(nullptr, flush_and_free_bufferevent),
virtual_network_id(0),
version(version),
language(language),
name(name),
terminal_send_color(terminal_send_color),
terminal_recv_color(terminal_recv_color),
on_command_received(on_command_received),
on_error(on_error),
context_obj(context_obj) {
}
Channel::Channel(
struct bufferevent* bev,
uint64_t virtual_network_id,
Version version,
uint8_t language,
on_command_received_t on_command_received,
on_error_t on_error,
void* context_obj,
const string& name,
TerminalFormat terminal_send_color,
TerminalFormat terminal_recv_color)
: bev(nullptr, flush_and_free_bufferevent),
version(version),
language(language),
name(name),
terminal_send_color(terminal_send_color),
terminal_recv_color(terminal_recv_color),
on_command_received(on_command_received),
on_error(on_error),
context_obj(context_obj) {
this->set_bufferevent(bev, virtual_network_id);
}
void Channel::replace_with(
Channel&& other,
on_command_received_t on_command_received,
on_error_t on_error,
void* context_obj,
const std::string& name) {
this->set_bufferevent(other.bev.release(), other.virtual_network_id);
this->local_addr = other.local_addr;
this->remote_addr = other.remote_addr;
this->version = other.version;
this->language = other.language;
this->crypt_in = other.crypt_in;
this->crypt_out = other.crypt_out;
this->name = name;
this->terminal_send_color = other.terminal_send_color;
this->terminal_recv_color = other.terminal_recv_color;
this->on_command_received = on_command_received;
this->on_error = on_error;
this->context_obj = context_obj;
other.disconnect(); // Clears crypts, addrs, etc.
}
void Channel::set_bufferevent(struct bufferevent* bev, uint64_t virtual_network_id) {
this->bev.reset(bev);
this->virtual_network_id = virtual_network_id;
if (this->bev.get()) {
int fd = bufferevent_getfd(this->bev.get());
if (fd < 0) {
memset(&this->local_addr, 0, sizeof(this->local_addr));
memset(&this->remote_addr, 0, sizeof(this->remote_addr));
} else {
get_socket_addresses(fd, &this->local_addr, &this->remote_addr);
}
bufferevent_setcb(this->bev.get(), &Channel::dispatch_on_input, nullptr, &Channel::dispatch_on_error, this);
bufferevent_enable(this->bev.get(), EV_READ | EV_WRITE);
} else {
memset(&this->local_addr, 0, sizeof(this->local_addr));
memset(&this->remote_addr, 0, sizeof(this->remote_addr));
}
}
void Channel::disconnect() {
if (this->bev.get()) {
// If the output buffer is not empty, move the bufferevent into the draining
// pool instead of disconnecting it, to make sure all the data gets sent.
struct evbuffer* out_buffer = bufferevent_get_output(this->bev.get());
if (evbuffer_get_length(out_buffer) == 0) {
this->bev.reset(); // Destructor flushes and frees the bufferevent
} else {
// The callbacks will free it when all the data is sent or the client
// disconnects
auto on_output = +[](struct bufferevent* bev, void*) -> void {
flush_and_free_bufferevent(bev);
};
auto on_error = +[](struct bufferevent* bev, short events, void*) -> void {
if (events & BEV_EVENT_ERROR) {
int err = EVUTIL_SOCKET_ERROR();
channel_exceptions_log.warning(
"Disconnecting channel caused error %d (%s)", err,
evutil_socket_error_to_string(err));
}
if (events & (BEV_EVENT_EOF | BEV_EVENT_ERROR)) {
bufferevent_flush(bev, EV_WRITE, BEV_FINISHED);
bufferevent_free(bev);
}
};
struct bufferevent* bev = this->bev.release();
bufferevent_setcb(bev, nullptr, on_output, on_error, bev);
bufferevent_disable(bev, EV_READ);
}
}
memset(&this->local_addr, 0, sizeof(this->local_addr));
memset(&this->remote_addr, 0, sizeof(this->remote_addr));
this->virtual_network_id = false;
this->crypt_in.reset();
this->crypt_out.reset();
}
Channel::Message Channel::recv() {
struct evbuffer* buf = bufferevent_get_input(this->bev.get());
size_t header_size = (this->version == Version::BB_V4) ? 8 : 4;
PSOCommandHeader header;
if (evbuffer_copyout(buf, &header, header_size) < static_cast<ssize_t>(header_size)) {
throw out_of_range("no command available");
}
if (this->crypt_in.get()) {
this->crypt_in->decrypt(&header, header_size, false);
}
size_t command_logical_size = header.size(version);
// If encryption is enabled, BB pads commands to 8-byte boundaries, and this
// is not reflected in the size field. This logic does not occur if encryption
// is not yet enabled.
size_t command_physical_size = (this->crypt_in.get() && (version == Version::BB_V4))
? ((command_logical_size + 7) & ~7)
: command_logical_size;
if (evbuffer_get_length(buf) < command_physical_size) {
throw out_of_range("no command available");
}
// If we get here, then there is a full command in the buffer. Some encryption
// algorithms' advancement depends on the decrypted data, so we have to
// actually decrypt the header again (with advance=true) to keep them in a
// consistent state.
string header_data(header_size, '\0');
if (evbuffer_remove(buf, header_data.data(), header_data.size()) < static_cast<ssize_t>(header_data.size())) {
throw logic_error("enough bytes available, but could not remove them");
}
if (this->crypt_in.get()) {
this->crypt_in->decrypt(header_data.data(), header_data.size());
}
string command_data(command_physical_size - header_size, '\0');
if (evbuffer_remove(buf, command_data.data(), command_data.size()) < static_cast<ssize_t>(command_data.size())) {
throw logic_error("enough bytes available, but could not remove them");
}
if (this->crypt_in.get()) {
// Some versions of PSO DC can send commands whose sizes are not a multiple
// of 4, but the server is expected to always use a multiple of 4 bytes when
// decrypting (the extra cipher bytes are lost). To emulate this behavior,
// we have to round up the size for DC commands here.
size_t orig_size = command_data.size();
command_data.resize((orig_size + 3) & (~3), 0);
this->crypt_in->decrypt(command_data.data(), command_data.size());
command_data.resize(orig_size);
}
command_data.resize(command_logical_size - header_size);
if (command_data_log.should_log(LogLevel::INFO) && (this->terminal_recv_color != TerminalFormat::END)) {
if (use_terminal_colors && this->terminal_recv_color != TerminalFormat::NORMAL) {
print_color_escape(stderr, this->terminal_recv_color, TerminalFormat::BOLD, TerminalFormat::END);
}
if (version == Version::BB_V4) {
command_data_log.info(
"Received from %s (version=BB command=%04hX flag=%08" PRIX32 ")",
this->name.c_str(),
header.command(this->version),
header.flag(this->version));
} else {
command_data_log.info(
"Received from %s (version=%s command=%02hX flag=%02" PRIX32 ")",
this->name.c_str(),
name_for_enum(this->version),
header.command(this->version),
header.flag(this->version));
}
vector<struct iovec> iovs;
iovs.emplace_back(iovec{.iov_base = header_data.data(), .iov_len = header_data.size()});
iovs.emplace_back(iovec{.iov_base = command_data.data(), .iov_len = command_data.size()});
print_data(stderr, iovs, 0, nullptr, PrintDataFlags::PRINT_ASCII | PrintDataFlags::DISABLE_COLOR | PrintDataFlags::OFFSET_16_BITS);
if (use_terminal_colors && this->terminal_recv_color != TerminalFormat::NORMAL) {
print_color_escape(stderr, TerminalFormat::NORMAL, TerminalFormat::END);
}
}
return {
.command = header.command(this->version),
.flag = header.flag(this->version),
.data = std::move(command_data),
};
}
void Channel::send(uint16_t cmd, uint32_t flag, bool silent) {
this->send(cmd, flag, nullptr, 0, silent);
}
void Channel::send(uint16_t cmd, uint32_t flag, const std::vector<std::pair<const void*, size_t>> blocks, bool silent) {
if (!this->connected()) {
channel_exceptions_log.warning("Attempted to send command on closed channel; dropping data");
return;
}
size_t size = 0;
for (const auto& b : blocks) {
size += b.second;
}
string send_data;
size_t logical_size;
size_t send_data_size = 0;
switch (this->version) {
case Version::DC_NTE:
case Version::DC_V1_11_2000_PROTOTYPE:
case Version::DC_V1:
case Version::DC_V2:
case Version::GC_NTE:
case Version::GC_V3:
case Version::GC_EP3_NTE:
case Version::GC_EP3:
case Version::XB_V3: {
PSOCommandHeaderDCV3 header;
if (this->crypt_out.get() &&
(this->version != Version::DC_NTE) &&
(this->version != Version::DC_V1_11_2000_PROTOTYPE) &&
(this->version != Version::DC_V1)) {
send_data_size = (sizeof(header) + size + 3) & ~3;
} else {
send_data_size = (sizeof(header) + size);
}
logical_size = send_data_size;
header.command = cmd;
header.flag = flag;
header.size = send_data_size;
send_data.append(reinterpret_cast<const char*>(&header), sizeof(header));
break;
}
case Version::PC_PATCH:
case Version::BB_PATCH:
case Version::PC_NTE:
case Version::PC_V2: {
PSOCommandHeaderPC header;
if (this->crypt_out.get()) {
send_data_size = (sizeof(header) + size + 3) & ~3;
} else {
send_data_size = (sizeof(header) + size);
}
logical_size = send_data_size;
header.size = send_data_size;
header.command = cmd;
header.flag = flag;
send_data.append(reinterpret_cast<const char*>(&header), sizeof(header));
break;
}
case Version::BB_V4: {
// BB has an annoying behavior here: command lengths must be multiples of
// 4, but the actual data length must be a multiple of 8. If the size
// field is not divisible by 8, 4 extra bytes are sent anyway. This
// behavior only applies when encryption is enabled - any commands sent
// before encryption is enabled have no size restrictions (except they
// must include a full header and must fit in the client's receive
// buffer), and no implicit extra bytes are sent.
PSOCommandHeaderBB header;
if (this->crypt_out.get()) {
send_data_size = (sizeof(header) + size + 7) & ~7;
} else {
send_data_size = (sizeof(header) + size);
}
logical_size = (sizeof(header) + size + 3) & ~3;
header.size = logical_size;
header.command = cmd;
header.flag = flag;
send_data.append(reinterpret_cast<const char*>(&header), sizeof(header));
break;
}
default:
throw logic_error("unimplemented game version in send_command");
}
// All versions of PSO I've seen (so far) have a receive buffer 0x7C00
// bytes in size
if (send_data_size > 0x7C00) {
throw runtime_error("outbound command too large");
}
send_data.reserve(send_data_size);
for (const auto& b : blocks) {
send_data.append(reinterpret_cast<const char*>(b.first), b.second);
}
send_data.resize(send_data_size, '\0');
if (!silent && (command_data_log.should_log(LogLevel::INFO)) && (this->terminal_send_color != TerminalFormat::END)) {
if (use_terminal_colors && this->terminal_send_color != TerminalFormat::NORMAL) {
print_color_escape(stderr, TerminalFormat::FG_YELLOW, TerminalFormat::BOLD, TerminalFormat::END);
}
if (version == Version::BB_V4) {
command_data_log.info("Sending to %s (version=BB command=%04hX flag=%08" PRIX32 ")",
this->name.c_str(), cmd, flag);
} else {
command_data_log.info("Sending to %s (version=%s command=%02hX flag=%02" PRIX32 ")",
this->name.c_str(), name_for_enum(version), cmd, flag);
}
print_data(stderr, send_data.data(), logical_size, 0, nullptr, PrintDataFlags::PRINT_ASCII | PrintDataFlags::DISABLE_COLOR | PrintDataFlags::OFFSET_16_BITS);
if (use_terminal_colors && this->terminal_send_color != TerminalFormat::NORMAL) {
print_color_escape(stderr, TerminalFormat::NORMAL, TerminalFormat::END);
}
}
if (this->crypt_out.get()) {
this->crypt_out->encrypt(send_data.data(), send_data.size());
}
struct evbuffer* buf = bufferevent_get_output(this->bev.get());
evbuffer_add(buf, send_data.data(), send_data.size());
}
void Channel::send(uint16_t cmd, uint32_t flag, const void* data, size_t size, bool silent) {
this->send(cmd, flag, {make_pair(data, size)}, silent);
}
void Channel::send(uint16_t cmd, uint32_t flag, const string& data, bool silent) {
this->send(cmd, flag, data.data(), data.size(), silent);
}
void Channel::send(const void* data, size_t size, bool silent) {
size_t header_size = (this->version == Version::BB_V4) ? 8 : 4;
const auto* header = reinterpret_cast<const PSOCommandHeader*>(data);
this->send(
header->command(this->version),
header->flag(this->version),
reinterpret_cast<const uint8_t*>(data) + header_size,
size - header_size,
silent);
}
void Channel::send(const string& data, bool silent) {
return this->send(data.data(), data.size(), silent);
}
void Channel::dispatch_on_input(struct bufferevent*, void* ctx) {
Channel* ch = reinterpret_cast<Channel*>(ctx);
// The client can be disconnected during on_command_received, so we have to
// make sure ch->bev is valid every time before calling recv()
while (ch->bev.get()) {
Message msg;
try {
msg = ch->recv();
} catch (const out_of_range&) {
break;
} catch (const exception& e) {
channel_exceptions_log.warning("Error receiving on channel: %s", e.what());
ch->on_error(*ch, BEV_EVENT_ERROR);
break;
}
if (ch->on_command_received) {
ch->on_command_received(*ch, msg.command, msg.flag, msg.data);
}
}
}
void Channel::dispatch_on_error(struct bufferevent*, short events, void* ctx) {
Channel* ch = reinterpret_cast<Channel*>(ctx);
if (ch->on_error) {
ch->on_error(*ch, events);
} else {
ch->disconnect();
}
}
+103 -102
View File
@@ -1,102 +1,103 @@
#pragma once
#include <netinet/in.h>
#include <memory>
#include <string>
#include "PSOEncryption.hh"
#include "PSOProtocol.hh"
#include "Version.hh"
struct Channel {
std::unique_ptr<struct bufferevent, void (*)(struct bufferevent*)> bev;
struct sockaddr_storage local_addr;
struct sockaddr_storage remote_addr;
bool is_virtual_connection;
Version version;
uint8_t language;
std::shared_ptr<PSOEncryption> crypt_in;
std::shared_ptr<PSOEncryption> crypt_out;
std::string name;
TerminalFormat terminal_send_color;
TerminalFormat terminal_recv_color;
struct Message {
uint16_t command;
uint32_t flag;
std::string data;
};
typedef void (*on_command_received_t)(Channel&, uint16_t, uint32_t, std::string&);
typedef void (*on_error_t)(Channel&, short);
on_command_received_t on_command_received;
on_error_t on_error;
void* context_obj;
// Creates an unconnected channel
Channel(
Version version,
uint8_t language,
on_command_received_t on_command_received,
on_error_t on_error,
void* context_obj,
const std::string& name,
TerminalFormat terminal_send_color = TerminalFormat::END,
TerminalFormat terminal_recv_color = TerminalFormat::END);
// Creates a connected channel
Channel(
struct bufferevent* bev,
Version version,
uint8_t language,
on_command_received_t on_command_received,
on_error_t on_error,
void* context_obj,
const std::string& name = "",
TerminalFormat terminal_send_color = TerminalFormat::END,
TerminalFormat terminal_recv_color = TerminalFormat::END);
Channel(const Channel& other) = delete;
Channel(Channel&& other) = delete;
Channel& operator=(const Channel& other) = delete;
Channel& operator=(Channel&& other) = delete;
void replace_with(
Channel&& other,
on_command_received_t on_command_received,
on_error_t on_error,
void* context_obj,
const std::string& name = "");
void set_bufferevent(struct bufferevent* bev);
inline bool connected() const {
return this->bev.get() != nullptr;
}
void disconnect();
// Receives a message. Throws std::out_of_range if no messages are available.
Message recv();
// Sends a message with an automatically-constructed header.
void send(uint16_t cmd, uint32_t flag = 0, bool silent = false);
void send(uint16_t cmd, uint32_t flag, const void* data, size_t size, bool silent = false);
void send(uint16_t cmd, uint32_t flag, const std::vector<std::pair<const void*, size_t>> blocks, bool silent = false);
void send(uint16_t cmd, uint32_t flag, const std::string& data, bool silent = false);
template <typename CmdT>
requires(!std::is_pointer_v<CmdT>)
void send(uint16_t cmd, uint32_t flag, const CmdT& data, bool silent = false) {
this->send(cmd, flag, &data, sizeof(data), silent);
}
// Sends a message with a pre-existing header (as the first few bytes in the
// data)
void send(const void* data, size_t size, bool silent = false);
void send(const std::string& data, bool silent = false);
private:
static void dispatch_on_input(struct bufferevent*, void* ctx);
static void dispatch_on_error(struct bufferevent*, short events, void* ctx);
};
#pragma once
#include <netinet/in.h>
#include <memory>
#include <string>
#include "PSOEncryption.hh"
#include "PSOProtocol.hh"
#include "Version.hh"
struct Channel {
std::unique_ptr<struct bufferevent, void (*)(struct bufferevent*)> bev;
struct sockaddr_storage local_addr;
struct sockaddr_storage remote_addr;
uint64_t virtual_network_id; // 0 = normal TCP connection
Version version;
uint8_t language;
std::shared_ptr<PSOEncryption> crypt_in;
std::shared_ptr<PSOEncryption> crypt_out;
std::string name;
TerminalFormat terminal_send_color;
TerminalFormat terminal_recv_color;
struct Message {
uint16_t command;
uint32_t flag;
std::string data;
};
typedef void (*on_command_received_t)(Channel&, uint16_t, uint32_t, std::string&);
typedef void (*on_error_t)(Channel&, short);
on_command_received_t on_command_received;
on_error_t on_error;
void* context_obj;
// Creates an unconnected channel
Channel(
Version version,
uint8_t language,
on_command_received_t on_command_received,
on_error_t on_error,
void* context_obj,
const std::string& name,
TerminalFormat terminal_send_color = TerminalFormat::END,
TerminalFormat terminal_recv_color = TerminalFormat::END);
// Creates a connected channel
Channel(
struct bufferevent* bev,
uint64_t virtual_network_id,
Version version,
uint8_t language,
on_command_received_t on_command_received,
on_error_t on_error,
void* context_obj,
const std::string& name = "",
TerminalFormat terminal_send_color = TerminalFormat::END,
TerminalFormat terminal_recv_color = TerminalFormat::END);
Channel(const Channel& other) = delete;
Channel(Channel&& other) = delete;
Channel& operator=(const Channel& other) = delete;
Channel& operator=(Channel&& other) = delete;
void replace_with(
Channel&& other,
on_command_received_t on_command_received,
on_error_t on_error,
void* context_obj,
const std::string& name = "");
void set_bufferevent(struct bufferevent* bev, uint64_t virtual_network_id);
inline bool connected() const {
return this->bev.get() != nullptr;
}
void disconnect();
// Receives a message. Throws std::out_of_range if no messages are available.
Message recv();
// Sends a message with an automatically-constructed header.
void send(uint16_t cmd, uint32_t flag = 0, bool silent = false);
void send(uint16_t cmd, uint32_t flag, const void* data, size_t size, bool silent = false);
void send(uint16_t cmd, uint32_t flag, const std::vector<std::pair<const void*, size_t>> blocks, bool silent = false);
void send(uint16_t cmd, uint32_t flag, const std::string& data, bool silent = false);
template <typename CmdT>
requires(!std::is_pointer_v<CmdT>)
void send(uint16_t cmd, uint32_t flag, const CmdT& data, bool silent = false) {
this->send(cmd, flag, &data, sizeof(data), silent);
}
// Sends a message with a pre-existing header (as the first few bytes in the
// data)
void send(const void* data, size_t size, bool silent = false);
void send(const std::string& data, bool silent = false);
private:
static void dispatch_on_input(struct bufferevent*, void* ctx);
static void dispatch_on_error(struct bufferevent*, short events, void* ctx);
};
+2613 -1800
View File
File diff suppressed because it is too large Load Diff
+14 -14
View File
@@ -1,14 +1,14 @@
#pragma once
#include <stdint.h>
#include <memory>
#include <string>
#include "Client.hh"
#include "Lobby.hh"
#include "ProxyServer.hh"
#include "ServerState.hh"
void on_chat_command(std::shared_ptr<Client> c, const std::string& text);
void on_chat_command(std::shared_ptr<ProxyServer::LinkedSession> ses, const std::string& text);
#pragma once
#include <stdint.h>
#include <memory>
#include <string>
#include "Client.hh"
#include "Lobby.hh"
#include "ProxyServer.hh"
#include "ServerState.hh"
void on_chat_command(std::shared_ptr<Client> c, const std::string& text);
void on_chat_command(std::shared_ptr<ProxyServer::LinkedSession> ses, const std::string& text);
+150
View File
@@ -0,0 +1,150 @@
#include "ChoiceSearch.hh"
#include <inttypes.h>
#include <string.h>
#include "Client.hh"
using namespace std;
const vector<ChoiceSearchCategory> CHOICE_SEARCH_CATEGORIES({
ChoiceSearchCategory{
.id = 0x0001,
.name = "Level",
.choices = {
{0x0000, "Any"},
{0x0001, "Own level +/- 5"},
{0x0002, "Level 1-10"},
{0x0003, "Level 11-20"},
{0x0004, "Level 21-40"},
{0x0005, "Level 41-60"},
{0x0006, "Level 61-80"},
{0x0007, "Level 81-100"},
{0x0008, "Level 101-120"},
{0x0009, "Level 121-160"},
{0x000A, "Level 161-200"},
},
.client_matches = +[](shared_ptr<Client> searcher_c, shared_ptr<Client> target_c, uint16_t choice_id) -> bool {
if (choice_id == 0x0000) {
return true;
}
uint32_t target_level = target_c->character()->disp.stats.level + 1;
switch (choice_id) {
case 0x0001:
return (labs(static_cast<int32_t>(target_level - searcher_c->character()->disp.stats.level)) <= 5);
case 0x0002:
return (target_level <= 10);
case 0x0003:
return (target_level > 10) && (target_level <= 20);
case 0x0004:
return (target_level > 20) && (target_level <= 40);
case 0x0005:
return (target_level > 40) && (target_level <= 60);
case 0x0006:
return (target_level > 60) && (target_level <= 80);
case 0x0007:
return (target_level > 80) && (target_level <= 100);
case 0x0008:
return (target_level > 100) && (target_level <= 120);
case 0x0009:
return (target_level > 120) && (target_level <= 160);
case 0x000A:
return (target_level > 160) && (target_level <= 200);
}
return false;
},
},
ChoiceSearchCategory{
.id = 0x0002,
.name = "Class",
.choices = {
{0x0000, "Any"},
{0x0010, "Hunter"},
{0x0001, "HUmar"},
{0x0002, "HUnewearl"},
{0x0003, "HUcast"},
{0x000A, "HUcaseal"},
{0x0011, "Ranger"},
{0x0004, "RAmar"},
{0x000C, "RAmarl"},
{0x0005, "RAcast"},
{0x0006, "RAcaseal"},
{0x0012, "Force"},
{0x000B, "FOmar"},
{0x0007, "FOmarl"},
{0x0008, "FOnewm"},
{0x0009, "FOnewearl"},
},
.client_matches = +[](shared_ptr<Client>, shared_ptr<Client> target_c, uint16_t choice_id) -> bool {
switch (choice_id) {
case 0x0000:
return true;
case 0x0010:
return target_c->character()->disp.visual.class_flags & 0x20;
case 0x0011:
return target_c->character()->disp.visual.class_flags & 0x40;
case 0x0012:
return target_c->character()->disp.visual.class_flags & 0x80;
default:
return ((choice_id - 1) == target_c->character()->disp.visual.char_class);
}
},
},
ChoiceSearchCategory{
.id = 0x0003,
.name = "Platform",
.choices = {
{0x0000, "Any"},
{0x0001, "DC betas"},
{0x0002, "DC V1"},
{0x0003, "DC V2 / PC"},
{0x0004, "GC / Xbox Episodes 1&2"},
{0x0005, "GC Episode 3"},
{0x0006, "BB"},
},
.client_matches = +[](shared_ptr<Client>, shared_ptr<Client> target_c, uint16_t choice_id) -> bool {
if (choice_id == 0x0000) {
return true;
}
switch (target_c->version()) {
case Version::DC_NTE:
case Version::DC_V1_11_2000_PROTOTYPE:
return (choice_id == 0x0001);
case Version::DC_V1:
return (choice_id == 0x0002);
case Version::DC_V2:
case Version::PC_NTE:
case Version::PC_V2:
return (choice_id == 0x0003);
case Version::GC_NTE:
case Version::GC_V3:
case Version::XB_V3:
return (choice_id == 0x0004);
case Version::GC_EP3_NTE:
case Version::GC_EP3:
return (choice_id == 0x0005);
case Version::BB_V4:
return (choice_id == 0x0006);
default:
return false;
}
},
},
ChoiceSearchCategory{
.id = 0x0204,
.name = "Game mode",
.choices = {
{0x0000, "Any"},
{0x0001, "Normal"},
{0x0002, "Hard"},
{0x0003, "Very Hard"},
{0x0004, "Ultimate"},
{0x0005, "Battle"},
{0x0006, "Challenge"},
},
.client_matches = +[](shared_ptr<Client>, shared_ptr<Client> target_c, uint16_t choice_id) -> bool {
uint16_t target_choice_id = target_c->character()->choice_search_config.get_setting(0x0204);
return (choice_id == 0) || (target_choice_id == 0) || (choice_id == target_choice_id);
},
},
});
+64
View File
@@ -0,0 +1,64 @@
#pragma once
#include <functional>
#include <memory>
#include <phosg/Encoding.hh>
#include <string>
#include <vector>
#include "Text.hh"
class Client;
template <bool IsBigEndian>
struct ChoiceSearchConfigT {
using U16T = typename std::conditional<IsBigEndian, be_uint16_t, le_uint16_t>::type;
using U32T = typename std::conditional<IsBigEndian, be_uint32_t, le_uint32_t>::type;
U32T disabled = 1; // 0 = enabled, 1 = disabled. Unused in command C3
struct Entry {
U16T parent_choice_id = 0;
U16T choice_id = 0;
} __packed_ws__(Entry, 4);
parray<Entry, 5> entries;
int32_t get_setting(uint16_t parent_choice_id) const {
for (size_t z = 0; z < this->entries.size(); z++) {
if (this->entries[z].parent_choice_id == parent_choice_id) {
return this->entries[z].choice_id;
}
}
return -1;
}
operator ChoiceSearchConfigT<!IsBigEndian>() const {
ChoiceSearchConfigT<!IsBigEndian> ret;
ret.disabled = this->disabled.load();
for (size_t z = 0; z < this->entries.size(); z++) {
auto& ret_e = ret.entries[z];
const auto& this_e = this->entries[z];
ret_e.parent_choice_id = this_e.parent_choice_id.load();
ret_e.choice_id = this_e.choice_id.load();
}
return ret;
}
} __packed__;
using ChoiceSearchConfig = ChoiceSearchConfigT<false>;
using ChoiceSearchConfigBE = ChoiceSearchConfigT<true>;
check_struct_size(ChoiceSearchConfig, 0x18);
check_struct_size(ChoiceSearchConfigBE, 0x18);
struct ChoiceSearchCategory {
struct Choice {
uint16_t id;
const char* name;
};
uint16_t id;
const char* name;
std::vector<Choice> choices;
std::function<bool(std::shared_ptr<Client> searcher_c, std::shared_ptr<Client> target_c, uint16_t choice_id)> client_matches;
};
extern const std::vector<ChoiceSearchCategory> CHOICE_SEARCH_CATEGORIES;
+1147 -337
View File
File diff suppressed because it is too large Load Diff
+418 -245
View File
@@ -1,245 +1,418 @@
#pragma once
#include <netinet/in.h>
#include <memory>
#include <stdexcept>
#include "Channel.hh"
#include "CommandFormats.hh"
#include "Episode3/BattleRecord.hh"
#include "Episode3/Tournament.hh"
#include "FileContentsCache.hh"
#include "FunctionCompiler.hh"
#include "License.hh"
#include "PSOEncryption.hh"
#include "PSOProtocol.hh"
#include "PatchFileIndex.hh"
#include "Player.hh"
#include "QuestScript.hh"
#include "TeamIndex.hh"
#include "Text.hh"
extern const uint64_t CLIENT_CONFIG_MAGIC;
class Server;
struct Lobby;
struct Client : public std::enable_shared_from_this<Client> {
enum class Flag : uint64_t {
// clang-format off
// Version-related flags
CHECKED_FOR_DC_V1_PROTOTYPE = 0x0000000000000002,
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,
// 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,
ACCEPTED_TEAM_INVITATION = 0x0000000080000000,
// Cheat mode flags
SWITCH_ASSIST_ENABLED = 0x0000000100000000,
INFINITE_HP_ENABLED = 0x0000000200000000,
INFINITE_TP_ENABLED = 0x0000000400000000,
DEBUG_ENABLED = 0x0000000800000000,
// 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,
// clang-format on
};
struct Config {
uint64_t enabled_flags = 0; // Client::Flag enum
uint32_t specific_version = 0;
int32_t override_random_seed = 0;
uint8_t override_section_id = 0xFF; // FF = no override
uint8_t override_lobby_event = 0xFF; // FF = no override
uint8_t override_lobby_number = 0x80; // 80 = no override
uint32_t proxy_destination_address = 0;
uint16_t proxy_destination_port = 0;
Config() = default;
[[nodiscard]] static inline bool check_flag(uint64_t enabled_flags, Flag flag) {
return !!(enabled_flags & static_cast<uint64_t>(flag));
}
[[nodiscard]] inline bool check_flag(Flag flag) const {
return this->check_flag(this->enabled_flags, flag);
}
inline void set_flag(Flag flag) {
this->enabled_flags |= static_cast<uint64_t>(flag);
}
inline void clear_flag(Flag flag) {
this->enabled_flags &= (~static_cast<uint64_t>(flag));
}
inline void toggle_flag(Flag flag) {
this->enabled_flags ^= static_cast<uint64_t>(flag);
}
void set_flags_for_version(Version version, int64_t sub_version);
template <size_t Bytes>
void parse_from(const parray<uint8_t, Bytes>& data) {
StringReader r(data.data(), data.size());
if (r.get_u32l() != CLIENT_CONFIG_MAGIC) {
throw std::invalid_argument("config signature is incorrect");
}
this->specific_version = r.get_u32l();
this->enabled_flags = r.get_u64l();
this->override_random_seed = r.get_u32l();
this->proxy_destination_address = r.get_u32b();
this->proxy_destination_port = r.get_u16l();
this->override_section_id = r.get_u8();
this->override_lobby_event = r.get_u8();
this->override_lobby_number = r.get_u8();
}
template <size_t Bytes>
void serialize_into(parray<uint8_t, Bytes>& data) const {
StringWriter w;
w.put_u32l(CLIENT_CONFIG_MAGIC);
w.put_u32l(this->specific_version);
w.put_u64l(this->enabled_flags);
w.put_u32l(this->override_random_seed);
w.put_u32b(this->proxy_destination_address);
w.put_u16l(this->proxy_destination_port);
w.put_u8(this->override_section_id);
w.put_u8(this->override_lobby_event);
w.put_u8(this->override_lobby_number);
const auto& s = w.str();
for (size_t z = 0; z < s.size(); z++) {
data[z] = s[z];
}
data.clear_after(s.size(), 0xFF);
}
};
std::weak_ptr<Server> server;
std::weak_ptr<ServerState> server_state;
uint64_t id;
PrefixedLogger log;
// License & account
std::shared_ptr<License> license;
// Network
Channel channel;
struct sockaddr_storage next_connection_addr;
ServerBehavior server_behavior;
bool should_disconnect;
bool should_send_to_lobby_server;
bool should_send_to_proxy_server;
std::unordered_map<std::string, std::function<void()>> disconnect_hooks;
std::shared_ptr<XBNetworkLocation> xb_netloc;
parray<le_uint32_t, 3> xb_9E_unknown_a1a;
uint8_t bb_connection_phase;
uint64_t ping_start_time;
// Patch server
std::vector<PatchFileChecksumRequest> patch_file_checksum_requests;
// Lobby/positioning
Config config;
int32_t sub_version;
float x;
float z;
uint32_t floor;
std::weak_ptr<Lobby> lobby;
uint8_t lobby_client_id;
uint8_t lobby_arrow_color;
int64_t preferred_lobby_id; // <0 = no preference
ClientGameData game_data;
std::unique_ptr<struct event, void (*)(struct event*)> save_game_data_event;
std::unique_ptr<struct event, void (*)(struct event*)> send_ping_event;
std::unique_ptr<struct event, void (*)(struct event*)> idle_timeout_event;
int16_t card_battle_table_number;
uint16_t card_battle_table_seat_number;
uint16_t card_battle_table_seat_state;
std::weak_ptr<Episode3::Tournament::Team> ep3_tournament_team;
std::shared_ptr<Episode3::BattleRecord> ep3_prev_battle_record;
std::shared_ptr<const Menu> last_menu_sent;
struct JoinCommand {
uint16_t command;
uint32_t flag;
std::string data;
};
std::unique_ptr<std::deque<JoinCommand>> game_join_command_queue;
// Miscellaneous (used by chat commands)
uint32_t next_exp_value; // next EXP value to give
G_SwitchStateChanged_6x05 last_switch_enabled_command;
bool can_chat;
std::string pending_bb_save_username;
uint8_t pending_bb_save_character_index;
std::deque<std::function<void(uint32_t, uint32_t)>> function_call_response_queue;
// File loading state
uint32_t dol_base_addr;
std::shared_ptr<DOLFileIndex::File> loading_dol_file;
std::unordered_map<std::string, std::shared_ptr<const std::string>> sending_files;
Client(
std::shared_ptr<Server> server,
struct bufferevent* bev,
Version version,
ServerBehavior server_behavior);
~Client();
void reschedule_save_game_data_event();
void reschedule_ping_and_timeout_events();
inline Version version() const {
return this->channel.version;
}
inline uint8_t language() const {
return this->channel.language;
}
void set_license(std::shared_ptr<License> l);
std::shared_ptr<ServerState> require_server_state() const;
std::shared_ptr<Lobby> require_lobby() const;
std::shared_ptr<TeamIndex::Team> team();
static void dispatch_save_game_data(evutil_socket_t, short, void* ctx);
void save_game_data();
static void dispatch_send_ping(evutil_socket_t, short, void* ctx);
void send_ping();
static void dispatch_idle_timeout(evutil_socket_t, short, void* ctx);
void idle_timeout();
void suspend_timeouts();
};
#pragma once
#include <netinet/in.h>
#include <memory>
#include <stdexcept>
#include "Account.hh"
#include "Channel.hh"
#include "CommandFormats.hh"
#include "Episode3/BattleRecord.hh"
#include "Episode3/Tournament.hh"
#include "FileContentsCache.hh"
#include "FunctionCompiler.hh"
#include "PSOEncryption.hh"
#include "PSOProtocol.hh"
#include "PatchFileIndex.hh"
#include "Quest.hh"
#include "QuestScript.hh"
#include "TeamIndex.hh"
#include "Text.hh"
extern const uint64_t CLIENT_CONFIG_MAGIC;
class Server;
struct Lobby;
class Parsed6x70Data;
class Client : public std::enable_shared_from_this<Client> {
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 = 0xFF3CFFFF7C0BFFFB,
// Version-related flags
CHECKED_FOR_DC_V1_PROTOTYPE = 0x0000000000000002,
NO_D6_AFTER_LOBBY = 0x0000000000000100,
NO_D6 = 0x0000000000000200,
FORCE_ENGLISH_LANGUAGE_BB = 0x0000000000000400,
// Flags describing the behavior for send_function_call
HAS_SEND_FUNCTION_CALL = 0x0000000000001000,
ENCRYPTED_SEND_FUNCTION_CALL = 0x0000000000002000,
SEND_FUNCTION_CALL_CHECKSUM_ONLY = 0x0000000000004000,
SEND_FUNCTION_CALL_NO_CACHE_PATCH = 0x0000000000008000,
CAN_RECEIVE_ENABLE_B2_QUEST = 0x0000000000020000,
AWAITING_ENABLE_B2_QUEST = 0x0000000000040000, // Server-side only
// State flags
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,
HAS_AUTO_PATCHES = 0x0000004000000000,
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_ARTIFICIAL_PLAYER_STATES = 0x0200000000000000, // Server-side only
SHOULD_SEND_ENABLE_SAVE = 0x0004000000000000,
SWITCH_ASSIST_ENABLED = 0x0000000100000000,
IS_CLIENT_CUSTOMIZATION = 0x0100000000000000,
// 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_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,
PROXY_VIRTUAL_CLIENT = 0x0400000000000000,
// 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 = 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
uint8_t override_lobby_event = 0xFF; // FF = no override
uint8_t override_lobby_number = 0x80; // 80 = no override
uint32_t proxy_destination_address = 0;
uint16_t proxy_destination_port = 0;
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));
}
[[nodiscard]] inline bool check_flag(Flag flag) const {
return this->check_flag(this->enabled_flags, flag);
}
inline void set_flag(Flag flag) {
this->enabled_flags |= static_cast<uint64_t>(flag);
}
inline void clear_flag(Flag flag) {
this->enabled_flags &= (~static_cast<uint64_t>(flag));
}
inline void toggle_flag(Flag flag) {
this->enabled_flags ^= static_cast<uint64_t>(flag);
}
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());
if (r.get_u32l() != CLIENT_CONFIG_MAGIC) {
throw std::invalid_argument("config signature is incorrect");
}
this->specific_version = r.get_u32l();
this->enabled_flags = r.get_u64l();
this->override_random_seed = r.get_u32l();
this->proxy_destination_address = r.get_u32b();
this->proxy_destination_port = r.get_u16l();
this->override_section_id = r.get_u8();
this->override_lobby_event = r.get_u8();
this->override_lobby_number = r.get_u8();
}
template <size_t Bytes>
void serialize_into(parray<uint8_t, Bytes>& data) const {
StringWriter w;
w.put_u32l(CLIENT_CONFIG_MAGIC);
w.put_u32l(this->specific_version);
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);
w.put_u8(this->override_section_id);
w.put_u8(this->override_lobby_event);
w.put_u8(this->override_lobby_number);
const auto& s = w.str();
for (size_t z = 0; z < s.size(); z++) {
data[z] = s[z];
}
data.clear_after(s.size(), 0xFF);
}
};
std::weak_ptr<Server> server;
uint64_t id;
PrefixedLogger log;
std::shared_ptr<Login> login;
// Network
Channel channel;
struct sockaddr_storage next_connection_addr;
ServerBehavior server_behavior;
bool should_disconnect;
bool should_send_to_lobby_server;
bool should_send_to_proxy_server;
std::unordered_map<std::string, std::function<void()>> disconnect_hooks;
std::shared_ptr<XBNetworkLocation> xb_netloc;
parray<le_uint32_t, 3> xb_9E_unknown_a1a;
uint8_t bb_connection_phase;
uint64_t ping_start_time;
// 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;
uint32_t floor;
std::weak_ptr<Lobby> lobby;
uint8_t lobby_client_id;
uint8_t lobby_arrow_color;
int64_t preferred_lobby_id; // <0 = no preference
std::unique_ptr<struct event, void (*)(struct event*)> save_game_data_event;
std::unique_ptr<struct event, void (*)(struct event*)> send_ping_event;
std::unique_ptr<struct event, void (*)(struct event*)> idle_timeout_event;
int16_t card_battle_table_number;
uint16_t card_battle_table_seat_number;
uint16_t card_battle_table_seat_state;
std::weak_ptr<Episode3::Tournament::Team> ep3_tournament_team;
std::shared_ptr<const Episode3::BattleRecord> ep3_prev_battle_record;
std::shared_ptr<const Menu> last_menu_sent;
uint32_t last_game_info_requested;
struct JoinCommand {
uint16_t command;
uint32_t flag;
std::string data;
};
std::unique_ptr<std::deque<JoinCommand>> game_join_command_queue;
// Character / game data
struct PendingItemTrade {
uint8_t other_client_id;
bool confirmed; // true if client has sent a D2 command
std::vector<ItemData> items;
};
struct PendingCardTrade {
uint8_t other_client_id;
bool confirmed; // true if client has sent an EE D2 command
std::vector<std::pair<uint32_t, uint32_t>> card_to_count;
};
bool should_update_play_time;
std::unordered_set<uint32_t> blocked_senders;
std::unique_ptr<PlayerDispDataDCPCV3> v1_v2_last_reported_disp;
std::shared_ptr<Parsed6x70Data> last_reported_6x70;
// These are null unless the client is within the trade sequence (D0-D4 or EE commands)
std::unique_ptr<PendingItemTrade> pending_item_trade;
std::unique_ptr<PendingCardTrade> pending_card_trade;
uint32_t telepipe_lobby_id;
G_SetTelepipeState_6x68 telepipe_state;
std::shared_ptr<Episode3::PlayerConfig> ep3_config; // Null for non-Ep3
int8_t bb_character_index;
ItemData bb_identify_result;
std::array<std::vector<ItemData>, 3> bb_shop_contents;
// Miscellaneous (used by chat commands)
uint32_t next_exp_value; // next EXP value to give
RecentSwitchFlags recent_switch_flags; // used for switch assist
bool can_chat;
struct PendingCharacterExport {
std::shared_ptr<const Account> dest_account;
ssize_t character_index = -1;
std::shared_ptr<const BBLicense> dest_bb_license; // Only used for $bbchar; null for $savechar
};
std::unique_ptr<PendingCharacterExport> pending_character_export;
std::deque<std::function<void(uint32_t, uint32_t)>> function_call_response_queue;
// File loading state
uint32_t dol_base_addr;
std::shared_ptr<DOLFileIndex::File> loading_dol_file;
std::unordered_map<std::string, std::shared_ptr<const std::string>> sending_files;
Client(
std::shared_ptr<Server> server,
struct bufferevent* bev,
uint64_t virtual_network_id,
Version version,
ServerBehavior server_behavior);
~Client();
void update_channel_name();
void reschedule_save_game_data_event();
void reschedule_ping_and_timeout_events();
inline Version version() const {
return this->channel.version;
}
inline uint8_t language() const {
return this->channel.language;
}
void convert_account_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 evaluate_quest_availability_expression(
std::shared_ptr<const IntegralExpression> expr,
std::shared_ptr<const Lobby> game,
uint8_t event,
uint8_t difficulty,
size_t num_players,
bool v1_present) const;
bool can_see_quest(
std::shared_ptr<const Quest> q,
std::shared_ptr<const Lobby> game,
uint8_t event,
uint8_t difficulty,
size_t num_players,
bool v1_present) const;
bool can_play_quest(
std::shared_ptr<const Quest> q,
std::shared_ptr<const Lobby> game,
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();
static void dispatch_send_ping(evutil_socket_t, short, void* ctx);
void send_ping();
static void dispatch_idle_timeout(evutil_socket_t, short, void* ctx);
void idle_timeout();
void suspend_timeouts();
const std::string& get_bb_username() const;
void set_bb_username(const std::string& bb_username);
void create_battle_overlay(std::shared_ptr<const BattleRules> rules, std::shared_ptr<const LevelTable> level_table);
void create_challenge_overlay(Version version, size_t template_index, std::shared_ptr<const LevelTable> level_table);
inline void delete_overlay() {
this->overlay_character_data.reset();
}
inline bool has_overlay() const {
return this->overlay_character_data.get() != nullptr;
}
void import_blocked_senders(const parray<le_uint32_t, 30>& blocked_senders);
std::shared_ptr<PSOBBBaseSystemFile> system_file(bool allow_load = true);
std::shared_ptr<PSOBBCharacterFile> character(bool allow_load = true, bool allow_overlay = true);
std::shared_ptr<PSOBBGuildCardFile> guild_card_file(bool allow_load = true);
std::shared_ptr<const PSOBBBaseSystemFile> system_file(bool allow_load = true) const;
std::shared_ptr<const PSOBBCharacterFile> character(bool allow_load = true, bool allow_overlay = true) const;
std::shared_ptr<const PSOBBGuildCardFile> guild_card_file(bool allow_load = true) const;
void create_character_file(
uint32_t guild_card_number,
uint8_t language,
const PlayerDispDataBBPreview& preview,
std::shared_ptr<const LevelTable> level_table);
std::string system_filename() const;
static std::string character_filename(const std::string& bb_username, int8_t index);
static std::string backup_character_filename(uint32_t account_id, size_t index, bool is_ep3);
std::string character_filename(int8_t index = -1) const;
std::string guild_card_filename() const;
std::string shared_bank_filename() const;
std::string legacy_player_filename() const;
std::string legacy_account_filename() const;
void save_all();
void save_system_file() const;
static void save_character_file(
const std::string& filename,
std::shared_ptr<const PSOBBBaseSystemFile> sys,
std::shared_ptr<const PSOBBCharacterFile> character);
static void save_ep3_character_file(
const std::string& filename,
const PSOGCEp3CharacterFile::Character& character);
// Note: This function is not const because it updates the player's play time.
void save_character_file();
void save_guild_card_file() const;
void load_backup_character(uint32_t account_id, size_t index);
std::shared_ptr<PSOGCEp3CharacterFile::Character> load_ep3_backup_character(uint32_t account_id, size_t index);
void save_and_unload_character();
PlayerBank200& current_bank();
std::shared_ptr<PSOBBCharacterFile> current_bank_character();
bool use_shared_bank(); // Returns true if the bank exists; false if it was created
void use_character_bank(int8_t bb_character_index);
void use_default_bank();
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
// lobbies, overlay_character_data is null.
std::shared_ptr<PSOBBBaseSystemFile> system_data;
std::shared_ptr<PSOBBCharacterFile> overlay_character_data;
std::shared_ptr<PSOBBCharacterFile> character_data;
std::shared_ptr<PSOBBGuildCardFile> guild_card_data;
std::shared_ptr<PlayerBank200> external_bank;
std::shared_ptr<PSOBBCharacterFile> external_bank_character;
int8_t external_bank_character_index;
uint64_t last_play_time_update;
void save_and_clear_external_bank();
void load_all_files();
void update_character_data_after_load(std::shared_ptr<PSOBBCharacterFile> character_data);
};
+7255 -6761
View File
File diff suppressed because it is too large Load Diff
+531 -166
View File
@@ -1,181 +1,495 @@
#include "CommonItemSet.hh"
#include "AFSArchive.hh"
#include "EnemyType.hh"
#include "GSLArchive.hh"
#include "StaticGameData.hh"
using namespace std;
CommonItemSet::Table::Table(
shared_ptr<const string> owned_data, const StringReader& r, bool is_big_endian, bool is_v3)
: owned_data(owned_data),
r(r),
is_big_endian(is_big_endian),
is_v3(is_v3) {
if (is_big_endian) {
const auto& be_offsets = r.pget<Offsets<true>>(r.pget_u32b(this->r.size() - 0x10));
this->offsets.base_weapon_type_prob_table_offset = be_offsets.base_weapon_type_prob_table_offset.load();
this->offsets.subtype_base_table_offset = be_offsets.subtype_base_table_offset.load();
this->offsets.subtype_area_length_table_offset = be_offsets.subtype_area_length_table_offset.load();
this->offsets.grind_prob_table_offset = be_offsets.grind_prob_table_offset.load();
this->offsets.armor_shield_type_index_prob_table_offset = be_offsets.armor_shield_type_index_prob_table_offset.load();
this->offsets.armor_slot_count_prob_table_offset = be_offsets.armor_slot_count_prob_table_offset.load();
this->offsets.enemy_meseta_ranges_offset = be_offsets.enemy_meseta_ranges_offset.load();
this->offsets.enemy_type_drop_probs_offset = be_offsets.enemy_type_drop_probs_offset.load();
this->offsets.enemy_item_classes_offset = be_offsets.enemy_item_classes_offset.load();
this->offsets.box_meseta_ranges_offset = be_offsets.box_meseta_ranges_offset.load();
this->offsets.bonus_value_prob_table_offset = be_offsets.bonus_value_prob_table_offset.load();
this->offsets.nonrare_bonus_prob_spec_offset = be_offsets.nonrare_bonus_prob_spec_offset.load();
this->offsets.bonus_type_prob_table_offset = be_offsets.bonus_type_prob_table_offset.load();
this->offsets.special_mult_offset = be_offsets.special_mult_offset.load();
this->offsets.special_percent_offset = be_offsets.special_percent_offset.load();
this->offsets.tool_class_prob_table_offset = be_offsets.tool_class_prob_table_offset.load();
this->offsets.technique_index_prob_table_offset = be_offsets.technique_index_prob_table_offset.load();
this->offsets.technique_level_ranges_offset = be_offsets.technique_level_ranges_offset.load();
this->offsets.armor_or_shield_type_bias = be_offsets.armor_or_shield_type_bias;
this->offsets.unit_max_stars_offset = be_offsets.unit_max_stars_offset.load();
this->offsets.box_item_class_prob_table_offset = be_offsets.box_item_class_prob_table_offset.load();
} else {
this->offsets = r.pget<Offsets<false>>(r.pget_u32l(this->r.size() - 0x10));
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>
void from_json_into(const JSON& json, parray<IntT, Count>& ret) {
if (json.size() != Count) {
throw runtime_error("incorrect array length");
}
for (size_t z = 0; z < Count; z++) {
ret[z] = json.at(z).as_int();
}
}
const parray<uint8_t, 0x0C>& CommonItemSet::Table::base_weapon_type_prob_table() const {
return this->r.pget<parray<uint8_t, 0x0C>>(this->offsets.base_weapon_type_prob_table_offset);
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;
}
const parray<int8_t, 0x0C>& CommonItemSet::Table::subtype_base_table() const {
return this->r.pget<parray<int8_t, 0x0C>>(this->offsets.subtype_base_table_offset);
template <typename IntT, size_t Count>
void from_json_into(const JSON& json, parray<CommonItemSet::Table::Range<IntT>, Count>& ret) {
if (json.size() != Count) {
throw runtime_error("incorrect array length");
}
for (size_t z = 0; z < Count; z++) {
from_json_into(json.at(z), ret[z]);
}
}
const parray<uint8_t, 0x0C>& CommonItemSet::Table::subtype_area_length_table() const {
return this->r.pget<parray<uint8_t, 0x0C>>(this->offsets.subtype_area_length_table_offset);
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});
}
}
const parray<parray<uint8_t, 4>, 9>& CommonItemSet::Table::grind_prob_table() const {
return this->r.pget<parray<parray<uint8_t, 4>, 9>>(this->offsets.grind_prob_table_offset);
template <typename IntT>
void from_json_into(const JSON& json, CommonItemSet::Table::Range<IntT>& ret) {
if (json.is_int()) {
IntT v = json.as_int();
ret.min = v;
ret.max = v;
} else {
const auto& l = json.as_list();
if (l.size() != 2) {
throw runtime_error("incorrect range list length");
}
ret.min = l.at(0)->as_int();
ret.max = l.at(1)->as_int();
}
}
const parray<uint8_t, 0x05>& CommonItemSet::Table::armor_shield_type_index_prob_table() const {
return this->r.pget<parray<uint8_t, 0x05>>(this->offsets.armor_shield_type_index_prob_table_offset);
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;
}
const parray<uint8_t, 0x05>& CommonItemSet::Table::armor_slot_count_prob_table() const {
return this->r.pget<parray<uint8_t, 0x05>>(this->offsets.armor_slot_count_prob_table_offset);
template <typename IntT, size_t Count1, size_t Count2>
void from_json_into(const JSON& json, parray<parray<IntT, Count2>, Count1>& ret) {
if (json.size() != Count1) {
throw runtime_error("incorrect array length");
}
for (size_t z = 0; z < Count1; z++) {
from_json_into(json.at(z), ret[z]);
}
}
const parray<CommonItemSet::Table::Range<uint16_t>, 0x64>& CommonItemSet::Table::enemy_meseta_ranges() const {
if (!this->parsed_enemy_meseta_ranges_populated) {
if (this->is_big_endian) {
const auto& data = r.pget<parray<Range<be_uint16_t>, 0x64>>(this->offsets.enemy_meseta_ranges_offset);
for (size_t z = 0; z < data.size(); z++) {
this->parsed_enemy_meseta_ranges[z] = Range<uint16_t>{data[z].min, data[z].max};
template <typename IntT, size_t Count1, size_t Count2>
void from_json_into(const JSON& json, parray<parray<CommonItemSet::Table::Range<IntT>, Count2>, Count1>& ret) {
if (json.size() != Count1) {
throw runtime_error("incorrect array length");
}
for (size_t z = 0; z < Count1; z++) {
from_json_into(json.at(z), ret[z]);
}
}
CommonItemSet::Table::Table(const JSON& json, Episode episode)
: episode(episode) {
from_json_into(json.at("BaseWeaponTypeProbTable"), this->base_weapon_type_prob_table);
from_json_into(json.at("SubtypeBaseTable"), this->subtype_base_table);
from_json_into(json.at("SubtypeAreaLengthTable"), this->subtype_area_length_table);
from_json_into(json.at("GrindProbTable"), this->grind_prob_table);
from_json_into(json.at("ArmorShieldTypeIndexProbTable"), this->armor_shield_type_index_prob_table);
from_json_into(json.at("ArmorSlotCountProbTable"), this->armor_slot_count_prob_table);
from_json_into(json.at("BoxMesetaRanges"), this->box_meseta_ranges);
this->has_rare_bonus_value_prob_table = json.at("HasRareBonusValueProbTable").as_bool();
from_json_into(json.at("BonusValueProbTable"), this->bonus_value_prob_table);
from_json_into(json.at("NonRareBonusProbSpec"), this->nonrare_bonus_prob_spec);
from_json_into(json.at("BonusTypeProbTable"), this->bonus_type_prob_table);
from_json_into(json.at("SpecialMult"), this->special_mult);
from_json_into(json.at("SpecialPercent"), this->special_percent);
from_json_into(json.at("ToolClassProbTable"), this->tool_class_prob_table);
from_json_into(json.at("TechniqueIndexProbTable"), this->technique_index_prob_table);
from_json_into(json.at("TechniqueLevelRanges"), this->technique_level_ranges);
this->armor_or_shield_type_bias = json.at("ArmorOrShieldTypeBias").as_int();
from_json_into(json.at("UnitMaxStarsTable"), this->unit_max_stars_table);
from_json_into(json.at("BoxItemClassProbTable"), this->box_item_class_prob_table);
const auto& enemy_meseta_ranges_json = json.at("EnemyMesetaRanges").as_dict();
const auto& enemy_type_drop_probs_json = json.at("EnemyTypeDropProbs").as_dict();
const auto& enemy_item_classes_json = json.at("EnemyItemClasses").as_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) {
for (auto type : enemy_types_for_rare_table_index(episode, z)) {
string name = string_printf("%s:%s", abbreviation_for_episode(episode), name_for_enum(type));
from_json_into(*enemy_meseta_ranges_json.at(name), this->enemy_meseta_ranges[z]);
this->enemy_type_drop_probs[z] = enemy_type_drop_probs_json.at(name)->as_int();
this->enemy_item_classes[z] = enemy_item_classes_json.at(name)->as_int();
}
}
}
}
static const char* name_for_common_item_class(uint8_t item_class) {
switch (item_class) {
case 0x00:
return "WEAPON ";
case 0x01:
return "ARMOR ";
case 0x02:
return "SHIELD ";
case 0x03:
return "UNIT ";
case 0x04:
return "TOOL ";
case 0x05:
return "MESETA ";
case 0x06:
return "NOTHING";
default:
return "UNKNOWN";
}
}
void CommonItemSet::Table::print(FILE* stream) const {
const auto& meseta_ranges = this->enemy_meseta_ranges;
const auto& drop_probs = this->enemy_type_drop_probs;
const auto& item_classes = this->enemy_item_classes;
fprintf(stream, "Enemy tables:\n");
fprintf(stream, " ## $LOW $HIGH DAR%% ITEM ENEMIES\n");
for (size_t z = 0; z < 0x64; z++) {
string enemies_str;
for (EnemyType enemy_type : enemy_types_for_rare_table_index(this->episode, z)) {
if (!enemies_str.empty()) {
enemies_str += ", ";
}
enemies_str += name_for_enum(enemy_type);
}
if (drop_probs[z]) {
fprintf(stream, " %02zX %5hu %5hu %3hhu%% %02hX:%s %s\n",
z, meseta_ranges[z].min, meseta_ranges[z].max, drop_probs[z], item_classes[z],
name_for_common_item_class(item_classes[z]), enemies_str.c_str());
} else {
fprintf(stream, " %02zX ----- ----- 0%% -- %s\n", z, enemies_str.c_str());
}
}
static const array<const char*, 12> base_weapon_type_names = {
"SABER ",
"SWORD ",
"DAGGER ",
"PARTISAN",
"SLICER ",
"HANDGUN ",
"RIFLE ",
"MECHGUN ",
"SHOT ",
"CANE ",
"ROD ",
"WAND ",
};
fprintf(stream, "Base weapon config:\n");
fprintf(stream, " TYPE PROB [SB AL] FLOORS\n");
for (size_t z = 0; z < 12; z++) {
uint8_t floor_to_class[10];
if (this->subtype_base_table[z] < 0) {
size_t start_floor = std::min<size_t>(-this->subtype_area_length_table[z], 10);
for (size_t x = 0; x < start_floor; x++) {
floor_to_class[x] = 0xFF;
}
for (size_t x = start_floor; x < 10; x++) {
floor_to_class[x] = (x - start_floor) / this->subtype_area_length_table[z];
}
} else {
const auto& data = r.pget<parray<Range<le_uint16_t>, 0x64>>(this->offsets.enemy_meseta_ranges_offset);
for (size_t z = 0; z < data.size(); z++) {
this->parsed_enemy_meseta_ranges[z] = Range<uint16_t>{data[z].min, data[z].max};
for (size_t x = 0; x < 10; x++) {
floor_to_class[x] = this->subtype_base_table[z] + (x / this->subtype_area_length_table[z]);
}
}
this->parsed_enemy_meseta_ranges_populated = true;
fprintf(stream, " %02zX:%s %3hhu%% [%02hhX %02hhX] %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX\n",
z, base_weapon_type_names[z], this->base_weapon_type_prob_table[z],
this->subtype_base_table[z], this->subtype_area_length_table[z],
floor_to_class[0], floor_to_class[1], floor_to_class[2], floor_to_class[3], floor_to_class[4],
floor_to_class[5], floor_to_class[6], floor_to_class[7], floor_to_class[8], floor_to_class[9]);
}
return this->parsed_enemy_meseta_ranges;
}
const parray<uint8_t, 0x64>& CommonItemSet::Table::enemy_type_drop_probs() const {
return this->r.pget<parray<uint8_t, 0x64>>(this->offsets.enemy_type_drop_probs_offset);
}
const parray<uint8_t, 0x64>& CommonItemSet::Table::enemy_item_classes() const {
return this->r.pget<parray<uint8_t, 0x64>>(this->offsets.enemy_item_classes_offset);
}
const parray<CommonItemSet::Table::Range<uint16_t>, 0x0A>& CommonItemSet::Table::box_meseta_ranges() const {
if (!this->parsed_box_meseta_ranges_populated) {
if (this->is_big_endian) {
const auto& data = r.pget<parray<Range<be_uint16_t>, 0x0A>>(this->offsets.box_meseta_ranges_offset);
for (size_t z = 0; z < data.size(); z++) {
this->parsed_box_meseta_ranges[z] = Range<uint16_t>{data[z].min, data[z].max};
}
} else {
const auto& data = r.pget<parray<Range<le_uint16_t>, 0x0A>>(this->offsets.box_meseta_ranges_offset);
for (size_t z = 0; z < data.size(); z++) {
this->parsed_box_meseta_ranges[z] = Range<uint16_t>{data[z].min, data[z].max};
fprintf(stream, "Box configuration:\n");
fprintf(stream, " AR $LOW $HIGH WEP%% ARM%% SHD%% UNI%% TL%% MST%% NO%%\n");
for (size_t z = 0; z < 10; z++) {
fprintf(stream, " %02zX %5hu %5hu %3hhu%% %3hhu%% %3hhu%% %3hhu%% %3hhu%% %3hhu%% %3hhu%%\n",
z, this->box_meseta_ranges[z].min, this->box_meseta_ranges[z].max,
this->box_item_class_prob_table[0][z],
this->box_item_class_prob_table[1][z],
this->box_item_class_prob_table[2][z],
this->box_item_class_prob_table[3][z],
this->box_item_class_prob_table[4][z],
this->box_item_class_prob_table[5][z],
this->box_item_class_prob_table[6][z]);
}
fprintf(stream, "Weapon drops:\n");
fprintf(stream, " Grinds:\n");
fprintf(stream, " GD AR0%% AR1%% AR2%% AR3%%\n");
for (size_t z = 0; z < 9; z++) {
fprintf(stream, " +%zu %3hhd%% %3hhd%% %3hhd%% %3hhd%%\n", z,
this->grind_prob_table[z][0], this->grind_prob_table[z][1],
this->grind_prob_table[z][2], this->grind_prob_table[z][3]);
}
fprintf(stream, " Bonus value table:\n");
fprintf(stream, " ID");
for (int8_t v = -10; v <= 100; v += 5) {
fprintf(stream, " %5hhd%%", v);
}
fputc('\n', stream);
for (size_t z = 0; z < (this->has_rare_bonus_value_prob_table ? 6 : 5); z++) {
fprintf(stream, " %02zX", z);
for (size_t x = 0; x < 0x17; x++) {
fprintf(stream, " %5hu#", this->bonus_value_prob_table[x][z]);
}
fputc('\n', stream);
}
fprintf(stream, " Area config tables:\n");
fprintf(stream, " AR BONUS SP NO%% NTV%% AB%% MAC%% DRK%% HIT%% SM SPC%%\n");
for (size_t z = 0; z < 10; z++) {
fprintf(stream, " %02zX %02hhX %02hhX %02hhX %3hhu%% %3hhu%% %3hhu%% %3hhu%% %3hhu%% %3hhu%% %02hhX %3hhu%%\n",
z, this->nonrare_bonus_prob_spec[0][z], this->nonrare_bonus_prob_spec[1][z], this->nonrare_bonus_prob_spec[2][z],
this->bonus_type_prob_table[0][z], this->bonus_type_prob_table[1][z], this->bonus_type_prob_table[2][z],
this->bonus_type_prob_table[3][z], this->bonus_type_prob_table[4][z], this->bonus_type_prob_table[5][z],
this->special_mult[z], this->special_percent[z]);
}
fprintf(stream, " Tool class table:\n");
fprintf(stream, " CS A1 A2 A3 A4 A5 A6 A7 A8 A9 A10\n");
for (size_t tool_class = 0; tool_class < this->tool_class_prob_table.size(); tool_class++) {
fprintf(stream, " %02zX", tool_class);
for (size_t area_norm = 0; area_norm < 10; area_norm++) {
fprintf(stream, " %5hu", this->tool_class_prob_table[tool_class][area_norm]);
}
fputc('\n', stream);
}
static const array<const char*, 19> technique_names = {
"FOIE ",
"GIFOIE ",
"RAFOIE ",
"BARTA ",
"GIBARTA ",
"RABARTA ",
"ZONDE ",
"GIZONDE ",
"RAZONDE ",
"GRANTS ",
"DEBAND ",
"JELLEN ",
"ZALURE ",
"SHIFTA ",
"RYUKER ",
"RESTA ",
"ANTI ",
"REVERSER",
"MEGID ",
};
fprintf(stream, " Technique table:\n");
fprintf(stream, " TECH A1 A2 A3 A4 A5 A6 A7 A8 A9 A10\n");
for (size_t tech_num = 0; tech_num < this->technique_index_prob_table.size(); tech_num++) {
fprintf(stream, " %02zX:%s", tech_num, technique_names[tech_num]);
for (size_t area_norm = 0; area_norm < 10; area_norm++) {
uint16_t prob = this->technique_index_prob_table[tech_num][area_norm];
if (prob) {
const auto& level_range = this->technique_level_ranges[tech_num][area_norm];
size_t min_level = level_range.min + 1;
size_t max_level = level_range.max + 1;
fprintf(stream, " %5hu[%2zu-%2zu]", prob, min_level, max_level);
} else {
fprintf(stream, " 0[-----]");
}
}
this->parsed_box_meseta_ranges_populated = true;
fputc('\n', stream);
}
fprintf(stream, " Armor/shield type bias: %hhu\n", this->armor_or_shield_type_bias);
fprintf(stream, " Armor/shield type index table:\n");
fprintf(stream, " TY PROB\n");
for (size_t z = 0; z < 5; z++) {
fprintf(stream, " %02zX %3hhu%%\n", z, this->armor_shield_type_index_prob_table[z]);
}
fprintf(stream, " Armor/shield slot count table:\n");
fprintf(stream, " #S PROB\n");
for (size_t z = 0; z < 5; z++) {
fprintf(stream, " %02zX %3hhu%%\n", z, this->armor_slot_count_prob_table[z]);
}
fprintf(stream, " Unit maximum stars table:\n");
fprintf(stream, " AR #*\n");
for (size_t z = 0; z < 10; z++) {
fprintf(stream, " %02zX %3hhu\n", z, this->unit_max_stars_table[z]);
}
return this->parsed_box_meseta_ranges;
}
bool CommonItemSet::Table::has_rare_bonus_value_prob_table() const {
return this->is_v3;
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) {
for (auto type : enemy_types_for_rare_table_index(episode, z)) {
string name = string_printf("%s:%s", abbreviation_for_episode(episode), name_for_enum(type));
enemy_meseta_ranges_json.emplace(name, to_json(this->enemy_meseta_ranges[z]));
enemy_type_drop_probs_json.emplace(name, this->enemy_type_drop_probs[z]);
enemy_item_classes_json.emplace(name, this->enemy_item_classes[z]);
}
}
}
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)},
});
}
const parray<parray<uint16_t, 6>, 0x17>& CommonItemSet::Table::bonus_value_prob_table() const {
if (!this->parsed_bonus_value_prob_table_populated) {
if (!this->is_v3) { // V2
const auto& data = r.pget<parray<parray<uint8_t, 5>, 0x17>>(this->offsets.bonus_value_prob_table_offset);
for (size_t z = 0; z < data.size(); z++) {
for (size_t x = 0; x < data[z].size(); x++) {
this->parsed_bonus_value_prob_table[z][x] = data[z][x];
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));
}
} else if (this->is_big_endian) { // BE V3
const auto& data = r.pget<parray<parray<be_uint16_t, 6>, 0x17>>(this->offsets.bonus_value_prob_table_offset);
for (size_t z = 0; z < data.size(); z++) {
for (size_t x = 0; x < data[z].size(); x++) {
this->parsed_bonus_value_prob_table[z][x] = data[z][x];
}
}
} else { // LE V3
const auto& data = r.pget<parray<parray<le_uint16_t, 6>, 0x17>>(this->offsets.bonus_value_prob_table_offset);
for (size_t z = 0; z < data.size(); z++) {
for (size_t x = 0; x < data[z].size(); x++) {
this->parsed_bonus_value_prob_table[z][x] = data[z][x];
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;
}
void CommonItemSet::print(FILE* stream) const {
static const array<GameMode, 4> modes = {GameMode::NORMAL, GameMode::BATTLE, GameMode::CHALLENGE, GameMode::SOLO};
for (const auto& mode : modes) {
static const array<Episode, 3> episodes = {Episode::EP1, Episode::EP2, Episode::EP4};
for (const auto& episode : episodes) {
for (uint8_t difficulty = 0; difficulty < 4; difficulty++) {
for (uint8_t section_id = 0; section_id < 10; section_id++) {
try {
auto table = this->get_table(episode, mode, difficulty, section_id);
fprintf(stream, "============ %s %s %s %s\n",
name_for_mode(mode), name_for_episode(episode), name_for_difficulty(difficulty), name_for_section_id(section_id));
table->print(stream);
} catch (const runtime_error&) {
}
}
}
}
this->parsed_bonus_value_prob_table_populated = true;
}
return this->parsed_bonus_value_prob_table;
}
const parray<parray<uint8_t, 10>, 3>& CommonItemSet::Table::nonrare_bonus_prob_spec() const {
return this->r.pget<parray<parray<uint8_t, 10>, 3>>(this->offsets.nonrare_bonus_prob_spec_offset);
CommonItemSet::Table::Table(const StringReader& r, bool is_big_endian, bool is_v3, Episode episode)
: episode(episode) {
if (is_big_endian) {
this->parse_itempt_t<true>(r, is_v3);
} else {
this->parse_itempt_t<false>(r, is_v3);
}
}
const parray<parray<uint8_t, 10>, 6>& CommonItemSet::Table::bonus_type_prob_table() const {
return this->r.pget<parray<parray<uint8_t, 10>, 6>>(this->offsets.bonus_type_prob_table_offset);
}
const parray<uint8_t, 0x0A>& CommonItemSet::Table::special_mult() const {
return this->r.pget<parray<uint8_t, 0x0A>>(this->offsets.special_mult_offset);
}
const parray<uint8_t, 0x0A>& CommonItemSet::Table::special_percent() const {
return this->r.pget<parray<uint8_t, 0x0A>>(this->offsets.special_percent_offset);
}
const parray<parray<uint16_t, 0x0A>, 0x1C>& CommonItemSet::Table::tool_class_prob_table() const {
if (!this->parsed_tool_class_prob_table_populated) {
if (this->is_big_endian) {
const auto& data = r.pget<parray<parray<be_uint16_t, 0x0A>, 0x1C>>(this->offsets.tool_class_prob_table_offset);
for (size_t z = 0; z < data.size(); z++) {
for (size_t x = 0; x < data[z].size(); x++) {
this->parsed_tool_class_prob_table[z][x] = data[z][x];
}
}
} else {
const auto& data = r.pget<parray<parray<le_uint16_t, 0x0A>, 0x1C>>(this->offsets.tool_class_prob_table_offset);
for (size_t z = 0; z < data.size(); z++) {
for (size_t x = 0; x < data[z].size(); x++) {
this->parsed_tool_class_prob_table[z][x] = data[z][x];
}
template <bool IsBigEndian>
void CommonItemSet::Table::parse_itempt_t(const StringReader& r, bool is_v3) {
using U16T = typename std::conditional<IsBigEndian, be_uint16_t, le_uint16_t>::type;
using U32T = typename std::conditional<IsBigEndian, be_uint32_t, le_uint32_t>::type;
const auto& offsets = r.pget<OffsetsT<IsBigEndian>>(r.pget<U32T>(r.size() - 0x10));
this->base_weapon_type_prob_table = r.pget<parray<uint8_t, 0x0C>>(offsets.base_weapon_type_prob_table_offset);
this->subtype_base_table = r.pget<parray<int8_t, 0x0C>>(offsets.subtype_base_table_offset);
this->subtype_area_length_table = r.pget<parray<uint8_t, 0x0C>>(offsets.subtype_area_length_table_offset);
this->grind_prob_table = r.pget<parray<parray<uint8_t, 4>, 9>>(offsets.grind_prob_table_offset);
this->armor_shield_type_index_prob_table = r.pget<parray<uint8_t, 0x05>>(offsets.armor_shield_type_index_prob_table_offset);
this->armor_slot_count_prob_table = r.pget<parray<uint8_t, 0x05>>(offsets.armor_slot_count_prob_table_offset);
const auto& data = r.pget<parray<Range<U16T>, 0x64>>(offsets.enemy_meseta_ranges_offset);
for (size_t z = 0; z < data.size(); z++) {
this->enemy_meseta_ranges[z] = Range<uint16_t>{data[z].min, data[z].max};
}
this->enemy_type_drop_probs = r.pget<parray<uint8_t, 0x64>>(offsets.enemy_type_drop_probs_offset);
this->enemy_item_classes = r.pget<parray<uint8_t, 0x64>>(offsets.enemy_item_classes_offset);
{
const auto& data = r.pget<parray<Range<U16T>, 0x0A>>(offsets.box_meseta_ranges_offset);
for (size_t z = 0; z < data.size(); z++) {
this->box_meseta_ranges[z] = Range<uint16_t>{data[z].min, data[z].max};
}
}
this->has_rare_bonus_value_prob_table = is_v3;
if (!this->has_rare_bonus_value_prob_table) { // V2
const auto& data = r.pget<parray<parray<uint8_t, 5>, 0x17>>(offsets.bonus_value_prob_table_offset);
for (size_t z = 0; z < data.size(); z++) {
for (size_t x = 0; x < data[z].size(); x++) {
this->bonus_value_prob_table[z][x] = data[z][x];
}
}
} else { // V3
const auto& data = r.pget<parray<parray<U16T, 6>, 0x17>>(offsets.bonus_value_prob_table_offset);
for (size_t z = 0; z < data.size(); z++) {
for (size_t x = 0; x < data[z].size(); x++) {
this->bonus_value_prob_table[z][x] = data[z][x];
}
}
this->parsed_tool_class_prob_table_populated = true;
}
return this->parsed_tool_class_prob_table;
}
const parray<parray<uint8_t, 0x0A>, 0x13>& CommonItemSet::Table::technique_index_prob_table() const {
return this->r.pget<parray<parray<uint8_t, 0x0A>, 0x13>>(this->offsets.technique_index_prob_table_offset);
}
const parray<parray<CommonItemSet::Table::Range<uint8_t>, 0x0A>, 0x13>& CommonItemSet::Table::technique_level_ranges() const {
return this->r.pget<parray<parray<Range<uint8_t>, 0x0A>, 0x13>>(this->offsets.technique_level_ranges_offset);
}
uint8_t CommonItemSet::Table::armor_or_shield_type_bias() const {
return this->offsets.armor_or_shield_type_bias;
}
const parray<uint8_t, 0x0A>& CommonItemSet::Table::unit_max_stars_table() const {
return this->r.pget<parray<uint8_t, 0x0A>>(this->offsets.unit_max_stars_offset);
}
const parray<parray<uint8_t, 10>, 7>& CommonItemSet::Table::box_item_class_prob_table() const {
return this->r.pget<parray<parray<uint8_t, 10>, 7>>(this->offsets.box_item_class_prob_table_offset);
this->nonrare_bonus_prob_spec = r.pget<parray<parray<uint8_t, 10>, 3>>(offsets.nonrare_bonus_prob_spec_offset);
this->bonus_type_prob_table = r.pget<parray<parray<uint8_t, 10>, 6>>(offsets.bonus_type_prob_table_offset);
this->special_mult = r.pget<parray<uint8_t, 0x0A>>(offsets.special_mult_offset);
this->special_percent = r.pget<parray<uint8_t, 0x0A>>(offsets.special_percent_offset);
{
const auto& data = r.pget<parray<parray<U16T, 0x0A>, 0x1C>>(offsets.tool_class_prob_table_offset);
for (size_t z = 0; z < data.size(); z++) {
for (size_t x = 0; x < data[z].size(); x++) {
this->tool_class_prob_table[z][x] = data[z][x];
}
}
}
this->technique_index_prob_table = r.pget<parray<parray<uint8_t, 0x0A>, 0x13>>(offsets.technique_index_prob_table_offset);
this->technique_level_ranges = r.pget<parray<parray<Range<uint8_t>, 0x0A>, 0x13>>(offsets.technique_level_ranges_offset);
this->armor_or_shield_type_bias = offsets.armor_or_shield_type_bias;
this->unit_max_stars_table = r.pget<parray<uint8_t, 0x0A>>(offsets.unit_max_stars_offset);
this->box_item_class_prob_table = r.pget<parray<parray<uint8_t, 10>, 7>>(offsets.box_item_class_prob_table_offset);
}
uint16_t CommonItemSet::key_for_table(Episode episode, GameMode mode, uint8_t difficulty, uint8_t secid) {
@@ -205,7 +519,7 @@ AFSV2CommonItemSet::AFSV2CommonItemSet(
for (size_t section_id = 0; section_id < 10; section_id++) {
auto entry = pt_afs.get(difficulty * 10 + section_id);
StringReader r(entry.first, entry.second);
shared_ptr<Table> table(new Table(pt_afs_data, r, false, false));
auto table = make_shared<Table>(r, false, false, Episode::EP1);
this->tables.emplace(this->key_for_table(Episode::EP1, GameMode::NORMAL, difficulty, section_id), table);
this->tables.emplace(this->key_for_table(Episode::EP1, GameMode::BATTLE, difficulty, section_id), table);
this->tables.emplace(this->key_for_table(Episode::EP1, GameMode::SOLO, difficulty, section_id), table);
@@ -217,48 +531,99 @@ AFSV2CommonItemSet::AFSV2CommonItemSet(
AFSArchive ct_afs(ct_afs_data);
for (size_t difficulty = 0; difficulty < 4; difficulty++) {
auto r = ct_afs.get_reader(difficulty * 10);
shared_ptr<Table> table(new Table(ct_afs_data, r, false, false));
auto table = make_shared<Table>(r, false, false, Episode::EP1);
for (size_t section_id = 0; section_id < 10; section_id++) {
this->tables.emplace(this->key_for_table(Episode::EP1, GameMode::CHALLENGE, difficulty, section_id), table);
}
}
}
GSLV3CommonItemSet::GSLV3CommonItemSet(std::shared_ptr<const std::string> gsl_data, bool is_big_endian) {
GSLV3V4CommonItemSet::GSLV3V4CommonItemSet(std::shared_ptr<const std::string> gsl_data, bool is_big_endian) {
GSLArchive gsl(gsl_data, is_big_endian);
vector<Episode> episodes = {Episode::EP1, Episode::EP2};
auto filename_for_table = +[](Episode episode, uint8_t difficulty, uint8_t section_id, bool is_challenge) -> string {
const char* episode_token = "";
switch (episode) {
case Episode::EP1:
episode_token = "";
break;
case Episode::EP2:
episode_token = "l";
break;
case Episode::EP4:
episode_token = "s";
break;
default:
throw runtime_error("invalid episode");
}
return string_printf(
"ItemPT%s%s%c%1hhu.rel",
is_challenge ? "c" : "",
episode_token,
tolower(abbreviation_for_difficulty(difficulty)),
section_id);
};
vector<Episode> episodes = {Episode::EP1, Episode::EP2, Episode::EP4};
for (Episode episode : episodes) {
for (size_t difficulty = 0; difficulty < 4; difficulty++) {
for (size_t section_id = 0; section_id < 10; section_id++) {
string filename = string_printf(
"ItemPT%s%c%1zu.rel",
((episode == Episode::EP2) ? "l" : ""),
tolower(abbreviation_for_difficulty(difficulty)),
section_id);
auto r = gsl.get_reader(filename);
shared_ptr<Table> table(new Table(gsl_data, r, is_big_endian, true));
StringReader r;
try {
r = gsl.get_reader(filename_for_table(episode, difficulty, section_id, false));
} catch (const exception&) {
// Fall back to Episode 1 if Episode 4 data is missing
if (episode == Episode::EP4) {
auto ep1_table = this->tables.at(this->key_for_table(Episode::EP1, GameMode::NORMAL, difficulty, section_id));
this->tables.emplace(this->key_for_table(episode, GameMode::NORMAL, difficulty, section_id), ep1_table);
this->tables.emplace(this->key_for_table(episode, GameMode::BATTLE, difficulty, section_id), ep1_table);
this->tables.emplace(this->key_for_table(episode, GameMode::SOLO, difficulty, section_id), ep1_table);
continue;
} else {
throw;
}
}
auto table = make_shared<Table>(r, is_big_endian, true, episode);
this->tables.emplace(this->key_for_table(episode, GameMode::NORMAL, difficulty, section_id), table);
this->tables.emplace(this->key_for_table(episode, GameMode::BATTLE, difficulty, section_id), table);
this->tables.emplace(this->key_for_table(episode, GameMode::SOLO, difficulty, section_id), table);
// TODO: These tables don't exist for Episode 4, and the GC version is
// the closest we have, so we use the Ep1 data from GC for Ep4.
if (episode == Episode::EP1) {
this->tables.emplace(this->key_for_table(Episode::EP4, GameMode::NORMAL, difficulty, section_id), table);
this->tables.emplace(this->key_for_table(Episode::EP4, GameMode::BATTLE, difficulty, section_id), table);
this->tables.emplace(this->key_for_table(Episode::EP4, GameMode::SOLO, difficulty, section_id), table);
}
}
if (episode != Episode::EP4) {
for (size_t difficulty = 0; difficulty < 4; difficulty++) {
auto r = gsl.get_reader(filename_for_table(episode, difficulty, 0, true));
auto table = make_shared<Table>(r, is_big_endian, true, episode);
for (size_t section_id = 0; section_id < 10; section_id++) {
this->tables.emplace(this->key_for_table(episode, GameMode::CHALLENGE, difficulty, section_id), table);
}
}
}
for (size_t difficulty = 0; difficulty < 4; difficulty++) {
string filename = string_printf(
"ItemPTc%s%c0.rel",
((episode == Episode::EP2) ? "l" : ""),
tolower(abbreviation_for_difficulty(difficulty)));
auto r = gsl.get_reader(filename);
shared_ptr<Table> table(new Table(gsl_data, r, is_big_endian, true));
for (size_t section_id = 0; section_id < 10; section_id++) {
this->tables.emplace(this->key_for_table(episode, GameMode::CHALLENGE, difficulty, section_id), table);
}
}
JSONCommonItemSet::JSONCommonItemSet(const JSON& json) {
for (const auto& mode_it : json.as_dict()) {
static const unordered_map<string, GameMode> mode_keys(
{{"Normal", GameMode::NORMAL}, {"Battle", GameMode::BATTLE}, {"Challenge", GameMode::CHALLENGE}, {"Solo", GameMode::SOLO}});
GameMode mode = mode_keys.at(mode_it.first);
for (const auto& episode_it : mode_it.second->as_dict()) {
static const unordered_map<string, Episode> episode_keys(
{{"Episode1", Episode::EP1}, {"Episode2", Episode::EP2}, {"Episode4", Episode::EP4}});
Episode episode = episode_keys.at(episode_it.first);
for (const auto& difficulty_it : episode_it.second->as_dict()) {
static const unordered_map<string, uint8_t> difficulty_keys(
{{"Normal", 0}, {"Hard", 1}, {"VeryHard", 2}, {"Ultimate", 3}});
uint8_t difficulty = difficulty_keys.at(difficulty_it.first);
for (const auto& section_id_it : difficulty_it.second->as_dict()) {
uint8_t section_id = section_id_for_name(section_id_it.first);
this->tables.emplace(
this->key_for_table(episode, mode, difficulty, section_id),
make_shared<Table>(*section_id_it.second, episode));
}
}
}
}
+62 -56
View File
@@ -2,6 +2,7 @@
#include <array>
#include <phosg/Encoding.hh>
#include <phosg/JSON.hh>
#include "GSLArchive.hh"
#include "PSOEncryption.hh"
@@ -13,40 +14,48 @@ public:
class Table {
public:
Table() = delete;
Table(std::shared_ptr<const std::string> owned_data, const StringReader& r, bool big_endian, bool is_v3);
Table(const JSON& json, Episode episode);
Table(const StringReader& r, bool big_endian, bool is_v3, Episode episode);
template <typename IntT>
struct Range {
IntT min;
IntT max;
} __attribute__((packed));
} __packed__;
const parray<uint8_t, 0x0C>& base_weapon_type_prob_table() const;
const parray<int8_t, 0x0C>& subtype_base_table() const;
const parray<uint8_t, 0x0C>& subtype_area_length_table() const;
const parray<parray<uint8_t, 4>, 9>& grind_prob_table() const;
const parray<uint8_t, 0x05>& armor_shield_type_index_prob_table() const;
const parray<uint8_t, 0x05>& armor_slot_count_prob_table() const;
const parray<Range<uint16_t>, 0x64>& enemy_meseta_ranges() const;
const parray<uint8_t, 0x64>& enemy_type_drop_probs() const;
const parray<uint8_t, 0x64>& enemy_item_classes() const;
const parray<Range<uint16_t>, 0x0A>& box_meseta_ranges() const;
bool has_rare_bonus_value_prob_table() const;
const parray<parray<uint16_t, 6>, 0x17>& bonus_value_prob_table() const;
const parray<parray<uint8_t, 10>, 3>& nonrare_bonus_prob_spec() const;
const parray<parray<uint8_t, 10>, 6>& bonus_type_prob_table() const;
const parray<uint8_t, 0x0A>& special_mult() const;
const parray<uint8_t, 0x0A>& special_percent() const;
const parray<parray<uint16_t, 0x0A>, 0x1C>& tool_class_prob_table() const;
const parray<parray<uint8_t, 0x0A>, 0x13>& technique_index_prob_table() const;
const parray<parray<Range<uint8_t>, 0x0A>, 0x13>& technique_level_ranges() const;
uint8_t armor_or_shield_type_bias() const;
const parray<uint8_t, 0x0A>& unit_max_stars_table() const;
const parray<parray<uint8_t, 10>, 7>& box_item_class_prob_table() const;
Episode episode;
parray<uint8_t, 0x0C> base_weapon_type_prob_table;
parray<int8_t, 0x0C> subtype_base_table;
parray<uint8_t, 0x0C> subtype_area_length_table;
parray<parray<uint8_t, 4>, 9> grind_prob_table;
parray<uint8_t, 0x05> armor_shield_type_index_prob_table;
parray<uint8_t, 0x05> armor_slot_count_prob_table;
parray<Range<uint16_t>, 0x64> enemy_meseta_ranges;
parray<uint8_t, 0x64> enemy_type_drop_probs;
parray<uint8_t, 0x64> enemy_item_classes;
parray<Range<uint16_t>, 0x0A> box_meseta_ranges;
bool has_rare_bonus_value_prob_table;
parray<parray<uint16_t, 6>, 0x17> bonus_value_prob_table;
parray<parray<uint8_t, 10>, 3> nonrare_bonus_prob_spec;
parray<parray<uint8_t, 10>, 6> bonus_type_prob_table;
parray<uint8_t, 0x0A> special_mult;
parray<uint8_t, 0x0A> special_percent;
parray<parray<uint16_t, 0x0A>, 0x1C> tool_class_prob_table;
parray<parray<uint8_t, 0x0A>, 0x13> technique_index_prob_table;
parray<parray<Range<uint8_t>, 0x0A>, 0x13> technique_level_ranges;
uint8_t armor_or_shield_type_bias;
parray<uint8_t, 0x0A> unit_max_stars_table;
parray<parray<uint8_t, 10>, 7> box_item_class_prob_table;
JSON json() const;
void print(FILE* stream) const;
private:
template <bool IsBigEndian>
struct Offsets {
void parse_itempt_t(const StringReader& r, bool is_v3);
template <bool IsBigEndian>
struct OffsetsT {
using U16T = typename std::conditional<IsBigEndian, be_uint16_t, le_uint16_t>::type;
using U32T = typename std::conditional<IsBigEndian, be_uint32_t, le_uint32_t>::type;
@@ -247,26 +256,16 @@ public:
/* 50 */ U32T box_item_class_prob_table_offset;
// There are several unused fields here.
} __attribute__((packed));
std::shared_ptr<const std::string> owned_data;
StringReader r;
bool is_big_endian;
bool is_v3;
Offsets<false> offsets;
mutable parray<Range<uint16_t>, 0x64> parsed_enemy_meseta_ranges;
mutable bool parsed_enemy_meseta_ranges_populated = false;
mutable parray<Range<uint16_t>, 0x0A> parsed_box_meseta_ranges;
mutable bool parsed_box_meseta_ranges_populated = false;
mutable parray<parray<uint16_t, 6>, 0x17> parsed_bonus_value_prob_table;
mutable bool parsed_bonus_value_prob_table_populated = false;
mutable parray<parray<uint16_t, 0x0A>, 0x1C> parsed_tool_class_prob_table;
mutable bool parsed_tool_class_prob_table_populated = false;
} __packed__;
using Offsets = OffsetsT<false>;
using OffsetsBE = OffsetsT<true>;
check_struct_size(Offsets, 0x54);
check_struct_size(OffsetsBE, 0x54);
};
std::shared_ptr<const Table> get_table(Episode episode, GameMode mode, uint8_t difficulty, uint8_t secid) const;
JSON json() const;
void print(FILE* stream) const;
protected:
CommonItemSet() = default;
@@ -281,9 +280,14 @@ public:
AFSV2CommonItemSet(std::shared_ptr<const std::string> pt_afs_data, std::shared_ptr<const std::string> ct_afs_data);
};
class GSLV3CommonItemSet : public CommonItemSet {
class GSLV3V4CommonItemSet : public CommonItemSet {
public:
GSLV3CommonItemSet(std::shared_ptr<const std::string> gsl_data, bool is_big_endian);
GSLV3V4CommonItemSet(std::shared_ptr<const std::string> gsl_data, bool is_big_endian);
};
class JSONCommonItemSet : public CommonItemSet {
public:
explicit JSONCommonItemSet(const JSON& json);
};
// Note: There are clearly better ways of doing this, but this implementation
@@ -309,22 +313,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];
}
}
};
@@ -335,10 +339,12 @@ public:
struct WeightTableEntry {
ValueT value;
WeightT weight;
} __attribute__((packed));
} __packed__;
using WeightTableEntry8 = WeightTableEntry<uint8_t>;
using WeightTableEntry32 = WeightTableEntry<be_uint32_t>;
check_struct_size(WeightTableEntry8, 2);
check_struct_size(WeightTableEntry32, 8);
protected:
std::shared_ptr<const std::string> data;
@@ -348,7 +354,7 @@ protected:
be_uint32_t offset;
uint8_t entries_per_table;
parray<uint8_t, 3> unused;
} __attribute__((packed));
} __packed_ws__(TableSpec, 8);
RELFileSet(std::shared_ptr<const std::string> data);
@@ -389,7 +395,7 @@ public:
Mode mode;
uint8_t player_level_divisor_or_min_level;
uint8_t max_level;
} __attribute__((packed));
} __packed_ws__(TechDiskLevelEntry, 3);
std::pair<const uint8_t*, size_t> get_common_recovery_table(size_t index) const;
std::pair<const WeightTableEntry8*, size_t> get_rare_recovery_table(size_t index) const;
@@ -411,7 +417,7 @@ public:
struct RangeTableEntry {
be_uint32_t min;
be_uint32_t max;
} __attribute__((packed));
} __packed_ws__(RangeTableEntry, 8);
std::pair<const WeightTableEntry8*, size_t> get_weapon_type_table(size_t index) const;
const parray<WeightTableEntry32, 6>* get_bonus_type_table(size_t which, size_t index) const;
@@ -430,7 +436,7 @@ private:
be_uint32_t special_mode_table; // [[{u32 value, u32 weight}](3)](8)
be_uint32_t standard_grind_range_table; // [{u32 min, u32 max}](6)
be_uint32_t favored_grind_range_table; // [{u32 min, u32 max}](6)
} __attribute__((packed));
} __packed_ws__(Offsets, 0x20);
const Offsets* offsets;
};
@@ -463,11 +469,11 @@ private:
uint8_t delta_index;
uint8_t count_default;
uint8_t count_favored;
} __attribute__((packed));
} __packed_ws__(DeltaProbabilityEntry, 3);
struct LuckTableEntry {
uint8_t delta_index;
int8_t luck;
} __attribute__((packed));
} __packed_ws__(LuckTableEntry, 2);
struct Offsets {
// Each section ID's favored weapon class has different probabilities than
@@ -573,7 +579,7 @@ private:
// In PSO V3, the bonus delta luck table is:
// +10 => +15, +5 => +8, 0 => 0, -5 => -8, -10 => -15
be_uint32_t bonus_delta_luck_offset; // LuckTableEntry[...]; ending with FF FF
} __attribute__((packed));
} __packed_ws__(Offsets, 0x18);
const Offsets* offsets;
+1357 -1311
View File
File diff suppressed because it is too large Load Diff
+226 -222
View File
@@ -1,222 +1,226 @@
#pragma once
#include <stddef.h>
#include <array>
#include <deque>
#include <functional>
#include <phosg/Tools.hh>
#include <string>
#include "Text.hh"
enum class CompressPhase {
INDEX = 0,
CONSTRUCT_PATHS,
BACKTRACE_OPTIMAL_PATH,
GENERATE_RESULT,
};
template <>
const char* name_for_enum<CompressPhase>(CompressPhase v);
typedef std::function<void(CompressPhase phase, size_t input_progress, size_t input_size, size_t output_size)> ProgressCallback;
////////////////////////////////////////////////////////////////////////////////
// PRS compression
////////////////////////////////////////////////////////////////////////////////
// Use this class if you need to compress from multiple input buffers, or need
// to compress multiple chunks and don't want to copy their contents
// unnecessarily. (For most common use cases, use prs_compress, below, instead.)
// To use this class, instantiate it, then call .add() one or more times, then
// call .close() and use the returned string as the compressed result.
class PRSCompressor {
public:
// compression_level specifies how aggressively to search for alternate paths:
// -1: Don't perform any compression at all, but produce output that can be
// understood by prs_decompress. The output will be about 9/8 the size
// of the input.
// 0: Greedily search for the longest backreference at every point. Don't
// consider any alternate paths. Generally offers a good balance between
// speed and output size.
// 1: Consider two paths at each point when a backreference is found: using
// the backreference or ignoring it.
// 2+: Consider further chains of paths at each point. Using values 2 or
// greater for compression_level generally yields diminishing returns.
explicit PRSCompressor(ssize_t compression_level = 0, ProgressCallback progress_fn = nullptr);
~PRSCompressor() = default;
// Adds more input data to be compressed, which logically comes after all
// previous data provided via add() calls. Cannot be called after close() is
// called.
void add(const void* data, size_t size);
void add(const std::string& data);
// Ends compression and returns the complete compressed result. It's OK to
// std::move() from the returned string reference.
std::string& close();
// Returns the total number of bytes passed to add() calls so far.
inline size_t input_size() const {
return this->input_bytes;
}
private:
template <size_t Size>
struct WrappedLog {
parray<uint8_t, Size> data;
WrappedLog() : data(0) {}
~WrappedLog() = default;
inline uint8_t at(size_t offset) const {
return this->data[offset % this->data.size()];
}
inline uint8_t& at(size_t offset) {
return this->data[offset % this->data.size()];
}
};
template <size_t Size>
struct IndexedLog : WrappedLog<Size> {
size_t offset;
size_t size;
std::array<std::deque<size_t>, 0x100> index;
IndexedLog()
: WrappedLog<Size>(),
offset(0),
size(0) {}
~IndexedLog() = default;
inline size_t end_offset() const {
return this->offset + this->size;
}
void push_back(uint8_t v) {
if (this->size == Size) {
this->pop_front();
}
size_t write_offset = this->offset + this->size;
this->at(write_offset) = v;
this->index[v].push_back(write_offset);
this->size++;
}
uint8_t pop_back() {
if (!this->size) {
throw std::logic_error("pop_back called on empty IndexedLog");
}
this->size--;
size_t offset = this->offset + this->size;
uint8_t v = this->at(offset);
this->index[v].pop_back();
return v;
}
uint8_t pop_front() {
uint8_t v = this->at(this->offset);
this->index[v].pop_front();
this->offset++;
this->size--;
return v;
}
const std::deque<size_t>& find(uint8_t v) {
return this->index[v];
}
};
void add_byte(uint8_t v);
void advance();
void move_forward_data_to_reverse_log(size_t size);
void advance_literal();
void advance_short_copy(ssize_t offset, size_t size);
void advance_long_copy(ssize_t offset, size_t size);
void advance_extended_copy(ssize_t offset, size_t size);
void write_control(bool z);
void flush_control();
ssize_t compression_level;
ProgressCallback progress_fn;
bool closed;
size_t control_byte_offset;
uint16_t pending_control_bits;
size_t input_bytes;
WrappedLog<0x101> forward_log;
IndexedLog<0x2000> reverse_log;
StringWriter output;
};
// These functions use PRSCompressor to compress a buffer of data. This is
// essentially a shortcut for constructing a PRSCompressor, calling .add() on
// it once, then calling .close().
std::string prs_compress(
const void* vdata,
size_t size,
ssize_t compression_level = 0,
ProgressCallback progress_fn = nullptr);
std::string prs_compress(
const std::string& data,
ssize_t compression_level = 0,
ProgressCallback progress_fn = nullptr);
// A faster form of prs_compress that doesn't have a tunable compression level.
std::string prs_compress_indexed(
const void* vdata,
size_t size,
ProgressCallback progress_fn = nullptr);
std::string prs_compress_indexed(
const std::string& data,
ProgressCallback progress_fn = nullptr);
// Compresses data using PRS to the smallest possible output size. This function
// is slow, but produces results significantly smaller than even Sega's original
// compressor.
std::string prs_compress_optimal(const void* vdata, size_t size, ProgressCallback progress_fn = nullptr);
std::string prs_compress_optimal(const std::string& data, ProgressCallback progress_fn = nullptr);
// Decompresses PRS-compressed data.
struct PRSDecompressResult {
std::string data;
size_t input_bytes_used;
};
PRSDecompressResult prs_decompress_with_meta(const void* data, size_t size, size_t max_output_size = 0, bool allow_unterminated = false);
PRSDecompressResult prs_decompress_with_meta(const std::string& data, size_t max_output_size = 0, bool allow_unterminated = false);
std::string prs_decompress(const void* data, size_t size, size_t max_output_size = 0, bool allow_unterminated = false);
std::string prs_decompress(const std::string& data, size_t max_output_size = 0, bool allow_unterminated = false);
// Returns the decompressed size of PRS-compressed data, without actually
// decompressing it.
size_t prs_decompress_size(const void* data, size_t size, size_t max_output_size = 0, bool allow_unterminated = false);
size_t prs_decompress_size(const std::string& data, size_t max_output_size = 0, bool allow_unterminated = false);
// Prints the command stream from a PRS-compressed buffer.
void prs_disassemble(FILE* stream, const void* data, size_t size);
void prs_disassemble(FILE* stream, const std::string& data);
////////////////////////////////////////////////////////////////////////////////
// BC0 compression
////////////////////////////////////////////////////////////////////////////////
// Compresses data using the BC0 algorithm. Like with PRS, the optimal variant
// is slow, but produces the smallest possible output.
std::string bc0_compress_optimal(
const void* in_data_v,
size_t in_size,
ProgressCallback progress_fn = nullptr);
std::string bc0_compress(const std::string& data, ProgressCallback progress_fn = nullptr);
std::string bc0_compress(const void* in_data_v, size_t in_size, ProgressCallback progress_fn = nullptr);
// Encodes data in a BC0-compatible format without compression (similar to using
// compression_level=-1 with prs_compress).
std::string bc0_encode(const void* in_data_v, size_t in_size);
// Decompresses BC0-compressed data.
std::string bc0_decompress(const std::string& data);
std::string bc0_decompress(const void* data, size_t size);
// Prints the command stream from a BC0-compressed buffer.
void bc0_disassemble(FILE* stream, const std::string& data);
void bc0_disassemble(FILE* stream, const void* data, size_t size);
#pragma once
#include <stddef.h>
#include <array>
#include <deque>
#include <functional>
#include <phosg/Tools.hh>
#include <string>
#include "Text.hh"
enum class CompressPhase {
INDEX = 0,
CONSTRUCT_PATHS,
BACKTRACE_OPTIMAL_PATH,
GENERATE_RESULT,
};
template <>
const char* name_for_enum<CompressPhase>(CompressPhase v);
typedef std::function<void(CompressPhase phase, size_t input_progress, size_t input_size, size_t output_size)> ProgressCallback;
////////////////////////////////////////////////////////////////////////////////
// PRS compression
////////////////////////////////////////////////////////////////////////////////
// Use this class if you need to compress from multiple input buffers, or need
// to compress multiple chunks and don't want to copy their contents
// unnecessarily. (For most common use cases, use prs_compress, below, instead.)
// To use this class, instantiate it, then call .add() one or more times, then
// call .close() and use the returned string as the compressed result.
class PRSCompressor {
public:
// compression_level specifies how aggressively to search for alternate paths:
// -1: Don't perform any compression at all, but produce output that can be
// understood by prs_decompress. The output will be about 9/8 the size
// of the input.
// 0: Greedily search for the longest backreference at every point. Don't
// consider any alternate paths. Generally offers a good balance between
// speed and output size.
// 1: Consider two paths at each point when a backreference is found: using
// the backreference or ignoring it.
// 2+: Consider further chains of paths at each point. Using values 2 or
// greater for compression_level generally yields diminishing returns.
explicit PRSCompressor(ssize_t compression_level = 0, ProgressCallback progress_fn = nullptr);
~PRSCompressor() = default;
// Adds more input data to be compressed, which logically comes after all
// previous data provided via add() calls. Cannot be called after close() is
// called.
void add(const void* data, size_t size);
void add(const std::string& data);
// Ends compression and returns the complete compressed result. It's OK to
// std::move() from the returned string reference.
std::string& close();
// Returns the total number of bytes passed to add() calls so far.
inline size_t input_size() const {
return this->input_bytes;
}
private:
template <size_t Size>
struct WrappedLog {
parray<uint8_t, Size> data;
WrappedLog() : data(0) {}
~WrappedLog() = default;
inline uint8_t at(size_t offset) const {
return this->data[offset % this->data.size()];
}
inline uint8_t& at(size_t offset) {
return this->data[offset % this->data.size()];
}
};
template <size_t Size>
struct IndexedLog : WrappedLog<Size> {
size_t offset;
size_t size;
std::array<std::deque<size_t>, 0x100> index;
IndexedLog()
: WrappedLog<Size>(),
offset(0),
size(0) {}
~IndexedLog() = default;
inline size_t end_offset() const {
return this->offset + this->size;
}
void push_back(uint8_t v) {
if (this->size == Size) {
this->pop_front();
}
size_t write_offset = this->offset + this->size;
this->at(write_offset) = v;
this->index[v].push_back(write_offset);
this->size++;
}
uint8_t pop_back() {
if (!this->size) {
throw std::logic_error("pop_back called on empty IndexedLog");
}
this->size--;
size_t offset = this->offset + this->size;
uint8_t v = this->at(offset);
this->index[v].pop_back();
return v;
}
uint8_t pop_front() {
uint8_t v = this->at(this->offset);
this->index[v].pop_front();
this->offset++;
this->size--;
return v;
}
const std::deque<size_t>& find(uint8_t v) {
return this->index[v];
}
};
void add_byte(uint8_t v);
void advance();
void move_forward_data_to_reverse_log(size_t size);
void advance_literal();
void advance_short_copy(ssize_t offset, size_t size);
void advance_long_copy(ssize_t offset, size_t size);
void advance_extended_copy(ssize_t offset, size_t size);
void write_control(bool z);
void flush_control();
ssize_t compression_level;
ProgressCallback progress_fn;
bool closed;
size_t control_byte_offset;
uint16_t pending_control_bits;
size_t input_bytes;
WrappedLog<0x101> forward_log;
IndexedLog<0x2000> reverse_log;
StringWriter output;
};
// These functions use PRSCompressor to compress a buffer of data. This is
// essentially a shortcut for constructing a PRSCompressor, calling .add() on
// it once, then calling .close().
std::string prs_compress(
const void* vdata,
size_t size,
ssize_t compression_level = 0,
ProgressCallback progress_fn = nullptr);
std::string prs_compress(
const std::string& data,
ssize_t compression_level = 0,
ProgressCallback progress_fn = nullptr);
// A faster form of prs_compress that doesn't have a tunable compression level.
std::string prs_compress_indexed(
const void* vdata,
size_t size,
ProgressCallback progress_fn = nullptr);
std::string prs_compress_indexed(
const std::string& data,
ProgressCallback progress_fn = nullptr);
// Compresses data using PRS to the smallest possible output size. This function
// is slow, but produces results significantly smaller than even Sega's original
// compressor.
std::string prs_compress_optimal(const void* vdata, size_t size, ProgressCallback progress_fn = nullptr);
std::string prs_compress_optimal(const std::string& data, ProgressCallback progress_fn = nullptr);
// Compresses data using PRS to the LARGEST possible output size. There is no
// practical use for this function except for amusement.
std::string prs_compress_pessimal(const void* vdata, size_t size);
// Decompresses PRS-compressed data.
struct PRSDecompressResult {
std::string data;
size_t input_bytes_used;
};
PRSDecompressResult prs_decompress_with_meta(const void* data, size_t size, size_t max_output_size = 0, bool allow_unterminated = false);
PRSDecompressResult prs_decompress_with_meta(const std::string& data, size_t max_output_size = 0, bool allow_unterminated = false);
std::string prs_decompress(const void* data, size_t size, size_t max_output_size = 0, bool allow_unterminated = false);
std::string prs_decompress(const std::string& data, size_t max_output_size = 0, bool allow_unterminated = false);
// Returns the decompressed size of PRS-compressed data, without actually
// decompressing it.
size_t prs_decompress_size(const void* data, size_t size, size_t max_output_size = 0, bool allow_unterminated = false);
size_t prs_decompress_size(const std::string& data, size_t max_output_size = 0, bool allow_unterminated = false);
// Prints the command stream from a PRS-compressed buffer.
void prs_disassemble(FILE* stream, const void* data, size_t size);
void prs_disassemble(FILE* stream, const std::string& data);
////////////////////////////////////////////////////////////////////////////////
// BC0 compression
////////////////////////////////////////////////////////////////////////////////
// Compresses data using the BC0 algorithm. Like with PRS, the optimal variant
// is slow, but produces the smallest possible output.
std::string bc0_compress_optimal(
const void* in_data_v,
size_t in_size,
ProgressCallback progress_fn = nullptr);
std::string bc0_compress(const std::string& data, ProgressCallback progress_fn = nullptr);
std::string bc0_compress(const void* in_data_v, size_t in_size, ProgressCallback progress_fn = nullptr);
// Encodes data in a BC0-compatible format without compression (similar to using
// compression_level=-1 with prs_compress).
std::string bc0_encode(const void* in_data_v, size_t in_size);
// Decompresses BC0-compressed data.
std::string bc0_decompress(const std::string& data);
std::string bc0_decompress(const void* data, size_t size);
// Prints the command stream from a BC0-compressed buffer.
void bc0_disassemble(FILE* stream, const std::string& data);
void bc0_disassemble(FILE* stream, const void* data, size_t size);
+71
View File
@@ -1386,3 +1386,74 @@ void dc_serial_number_speed_test(uint64_t seed) {
fprintf(stderr, "Fast vs. slow speedup: %zux\n", static_cast<size_t>(time_slow / time_fast));
fprintf(stderr, "Disagreements: %zu\n", num_disagreements);
}
string decrypt_dp_address_jpn(
const string& executable,
const string& values,
const string& indexes) {
StringReader values_r(values);
StringReader indexes_r(indexes);
size_t fixup_values_offset = values_r.pget_u32l(0x3FFC) - 0x8C004000;
size_t fixup_steps_offset = indexes_r.pget_u32l(0x3BFC) - 0x8C008400;
StringReader fixup_values_r = values_r.sub(fixup_values_offset);
StringReader fixup_steps_r = indexes_r.sub(fixup_steps_offset);
auto decrypted = decrypt_pr2_data<false>(executable);
size_t fixup_offset = 0;
while (fixup_steps_r.get_u8(false)) {
fixup_offset += (fixup_steps_r.get_u8() << 2);
fixup_steps_r.skip(1);
if (fixup_offset + 4 > decrypted.compressed_data.size()) {
throw runtime_error("fixup beyond end of compressed data");
}
*reinterpret_cast<le_uint32_t*>(decrypted.compressed_data.data() + fixup_offset) = fixup_values_r.get_u32l();
}
return prs_decompress(decrypted.compressed_data);
}
EncryptedDCv2Executables encrypt_dp_address_jpn(const string& executable, const string& indexes) {
EncryptedDCv2Executables ret;
string compressed = prs_compress(executable);
ret.executable = encrypt_pr2_data<false>(compressed, executable.size(), random_object<uint32_t>() & 0x7FFFFF7F);
StringReader indexes_r(indexes);
size_t fixup_steps_offset = indexes_r.pget_u32l(0x3BFC) - 0x8C008400;
ret.indexes = indexes;
ret.indexes.at(fixup_steps_offset) = 0;
return ret;
}
std::string crypt_dp_address_jpn_simple(const std::string& data, int64_t mask_key) {
if (data.size() & 3) {
throw runtime_error("size is not a multiple of 4");
}
StringReader r(data);
if (mask_key < 0) {
unordered_map<uint32_t, size_t> key_freq;
while (!r.eof()) {
key_freq[r.get_u32l()] += 1;
}
size_t max_v = 0;
for (const auto& it : key_freq) {
if (it.second > max_v) {
max_v = it.second;
mask_key = it.first;
}
}
if (mask_key < 0) {
throw runtime_error("cannot determine mask key");
}
log_info("Determined %08" PRIX64 " to be the most likely mask key", mask_key);
r.go(0);
}
StringWriter w;
while (!r.eof()) {
w.put_u32l(r.get_u32l() ^ mask_key);
}
return std::move(w.str());
}
+13
View File
@@ -21,3 +21,16 @@ std::string generate_dc_serial_number(uint8_t domain, uint8_t subdomain = 0xFF);
std::unordered_map<uint32_t, std::string> generate_all_dc_serial_numbers(uint8_t domain = 0xFF, uint8_t subdomain = 0xFF);
void dc_serial_number_speed_test(uint64_t seed = 0xFFFFFFFFFFFFFFFF);
struct EncryptedDCv2Executables {
std::string executable;
std::string indexes;
};
std::string decrypt_dp_address_jpn(
const std::string& dp_address_jpn_data,
const std::string& iwashi_sea_data,
const std::string& katsuo_sea_data);
EncryptedDCv2Executables encrypt_dp_address_jpn(const std::string& executable, const std::string& indexes);
std::string crypt_dp_address_jpn_simple(const std::string& data, int64_t seed = -1);
+121 -118
View File
@@ -1,118 +1,121 @@
#include "DNSServer.hh"
#include <netinet/in.h>
#include <poll.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <phosg/Encoding.hh>
#include <phosg/Network.hh>
#include <phosg/Strings.hh>
#include <string>
#include <vector>
#include "Loggers.hh"
#include "NetworkAddresses.hh"
using namespace std;
DNSServer::DNSServer(
shared_ptr<struct event_base> base,
uint32_t local_connect_address, uint32_t external_connect_address)
: base(base),
local_connect_address(local_connect_address),
external_connect_address(external_connect_address) {}
DNSServer::~DNSServer() {
for (const auto& it : this->fd_to_receive_event) {
close(it.first);
}
}
void DNSServer::listen(const std::string& socket_path) {
this->add_socket(::listen(socket_path, 0, 0));
}
void DNSServer::listen(const std::string& addr, int port) {
this->add_socket(::listen(addr, port, 0));
}
void DNSServer::listen(int port) {
this->add_socket(::listen("", port, 0));
}
void DNSServer::add_socket(int fd) {
unique_ptr<struct event, void (*)(struct event*)> e(
event_new(this->base.get(), fd, EV_READ | EV_PERSIST, &DNSServer::dispatch_on_receive_message, this),
event_free);
event_add(e.get(), nullptr);
this->fd_to_receive_event.emplace(fd, std::move(e));
}
void DNSServer::dispatch_on_receive_message(evutil_socket_t fd,
short events, void* ctx) {
reinterpret_cast<DNSServer*>(ctx)->on_receive_message(fd, events);
}
string DNSServer::response_for_query(
const void* vdata, size_t size, uint32_t resolved_address) {
if (size < 0x0C) {
throw invalid_argument("query too small");
}
const char* data = reinterpret_cast<const char*>(vdata);
size_t name_len = strlen(&data[12]) + 1;
be_uint32_t be_resolved_address = resolved_address;
string response;
response.append(data, 2);
response.append("\x81\x80\x00\x01\x00\x01\x00\x00\x00\x00", 10);
response.append(&data[12], name_len);
response.append("\x00\x01\x00\x01\xC0\x0C\x00\x01\x00\x01\x00\x00\x00\x3C\x00\x04", 16);
response.append(reinterpret_cast<const char*>(&be_resolved_address), 4);
return response;
}
string DNSServer::response_for_query(
const string& query, uint32_t resolved_address) {
return DNSServer::response_for_query(query.data(), query.size(), resolved_address);
}
void DNSServer::on_receive_message(int fd, short) {
for (;;) {
sockaddr_in remote;
socklen_t remote_size = sizeof(sockaddr_in);
memset(&remote, 0, remote_size);
string input(2048, 0);
ssize_t bytes = recvfrom(fd, const_cast<char*>(input.data()), input.size(),
0, reinterpret_cast<sockaddr*>(&remote), &remote_size);
if (bytes < 0) {
if (errno != EAGAIN) {
dns_server_log.error("input error %d", errno);
throw runtime_error("cannot read from udp socket");
}
break;
} else if (bytes == 0) {
break;
} else if (bytes < 0x0C) {
dns_server_log.warning("input query too small");
print_data(stderr, input.data(), bytes);
} else {
input.resize(bytes);
uint32_t remote_address = ntohl(remote.sin_addr.s_addr);
uint32_t connect_address = is_local_address(remote_address)
? this->local_connect_address
: this->external_connect_address;
string response = this->response_for_query(input, connect_address);
sendto(fd, response.data(), response.size(), 0,
reinterpret_cast<const sockaddr*>(&remote), remote_size);
}
}
}
#include "DNSServer.hh"
#include <netinet/in.h>
#include <poll.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <phosg/Encoding.hh>
#include <phosg/Network.hh>
#include <phosg/Strings.hh>
#include <string>
#include <vector>
#include "Loggers.hh"
#include "NetworkAddresses.hh"
using namespace std;
DNSServer::DNSServer(
shared_ptr<struct event_base> base,
uint32_t local_connect_address,
uint32_t external_connect_address,
shared_ptr<const IPV4RangeSet> banned_ipv4_ranges)
: base(base),
local_connect_address(local_connect_address),
external_connect_address(external_connect_address),
banned_ipv4_ranges(banned_ipv4_ranges) {}
DNSServer::~DNSServer() {
for (const auto& it : this->fd_to_receive_event) {
close(it.first);
}
}
void DNSServer::listen(const std::string& socket_path) {
this->add_socket(::listen(socket_path, 0, 0));
}
void DNSServer::listen(const std::string& addr, int port) {
this->add_socket(::listen(addr, port, 0));
}
void DNSServer::listen(int port) {
this->add_socket(::listen("", port, 0));
}
void DNSServer::add_socket(int fd) {
unique_ptr<struct event, void (*)(struct event*)> e(
event_new(this->base.get(), fd, EV_READ | EV_PERSIST, &DNSServer::dispatch_on_receive_message, this),
event_free);
event_add(e.get(), nullptr);
this->fd_to_receive_event.emplace(fd, std::move(e));
}
void DNSServer::dispatch_on_receive_message(evutil_socket_t fd,
short events, void* ctx) {
reinterpret_cast<DNSServer*>(ctx)->on_receive_message(fd, events);
}
string DNSServer::response_for_query(const void* vdata, size_t size, uint32_t resolved_address) {
if (size < 0x0C) {
throw invalid_argument("query too small");
}
const char* data = reinterpret_cast<const char*>(vdata);
size_t name_len = strlen(&data[12]) + 1;
be_uint32_t be_resolved_address = resolved_address;
string response;
response.append(data, 2);
response.append("\x81\x80\x00\x01\x00\x01\x00\x00\x00\x00", 10);
response.append(&data[12], name_len);
response.append("\x00\x01\x00\x01\xC0\x0C\x00\x01\x00\x01\x00\x00\x00\x3C\x00\x04", 16);
response.append(reinterpret_cast<const char*>(&be_resolved_address), 4);
return response;
}
string DNSServer::response_for_query(
const string& query, uint32_t resolved_address) {
return DNSServer::response_for_query(query.data(), query.size(), resolved_address);
}
void DNSServer::on_receive_message(int fd, short) {
for (;;) {
struct sockaddr_storage remote;
socklen_t remote_size = sizeof(sockaddr_in);
memset(&remote, 0, remote_size);
string input(2048, 0);
ssize_t bytes = recvfrom(fd, const_cast<char*>(input.data()), input.size(),
0, reinterpret_cast<sockaddr*>(&remote), &remote_size);
if (bytes < 0) {
if (errno != EAGAIN) {
dns_server_log.error("input error %d", errno);
throw runtime_error("cannot read from udp socket");
}
break;
} else if (bytes == 0) {
break;
} else if (bytes < 0x0C) {
dns_server_log.warning("input query too small");
print_data(stderr, input.data(), bytes);
} else if (!this->banned_ipv4_ranges->check(remote)) {
input.resize(bytes);
const sockaddr_in* remote_sin = reinterpret_cast<const sockaddr_in*>(&remote);
uint32_t remote_address = ntohl(remote_sin->sin_addr.s_addr);
uint32_t connect_address = is_local_address(remote_address)
? this->local_connect_address
: this->external_connect_address;
string response = this->response_for_query(input, connect_address);
sendto(fd, response.data(), response.size(), 0,
reinterpret_cast<const sockaddr*>(&remote), remote_size);
}
}
}
+44 -37
View File
@@ -1,37 +1,44 @@
#pragma once
#include <event2/event.h>
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
class DNSServer {
public:
DNSServer(std::shared_ptr<struct event_base> base,
uint32_t local_connect_address, uint32_t external_connect_address);
DNSServer(const DNSServer&) = delete;
DNSServer(DNSServer&&) = delete;
virtual ~DNSServer();
void listen(const std::string& socket_path);
void listen(const std::string& addr, int port);
void listen(int port);
void add_socket(int fd);
static std::string response_for_query(
const void* vdata, size_t size, uint32_t resolved_address);
static std::string response_for_query(
const std::string& query, uint32_t resolved_address);
private:
std::shared_ptr<struct event_base> base;
std::unordered_map<int, std::unique_ptr<struct event, void (*)(struct event*)>> fd_to_receive_event;
uint32_t local_connect_address;
uint32_t external_connect_address;
static void dispatch_on_receive_message(evutil_socket_t fd, short events,
void* ctx);
void on_receive_message(int fd, short event);
};
#pragma once
#include <event2/event.h>
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include "IPV4RangeSet.hh"
class DNSServer {
public:
DNSServer(
std::shared_ptr<struct event_base> base,
uint32_t local_connect_address,
uint32_t external_connect_address,
std::shared_ptr<const IPV4RangeSet> banned_ipv4_ranges);
DNSServer(const DNSServer&) = delete;
DNSServer(DNSServer&&) = delete;
virtual ~DNSServer();
inline void set_banned_ipv4_ranges(std::shared_ptr<const IPV4RangeSet> banned_ipv4_ranges) {
this->banned_ipv4_ranges = banned_ipv4_ranges;
}
void listen(const std::string& socket_path);
void listen(const std::string& addr, int port);
void listen(int port);
void add_socket(int fd);
static std::string response_for_query(const void* vdata, size_t size, uint32_t resolved_address);
static std::string response_for_query(const std::string& query, uint32_t resolved_address);
private:
std::shared_ptr<struct event_base> base;
std::unordered_map<int, std::unique_ptr<struct event, void (*)(struct event*)>> fd_to_receive_event;
uint32_t local_connect_address;
uint32_t external_connect_address;
std::shared_ptr<const IPV4RangeSet> banned_ipv4_ranges;
static void dispatch_on_receive_message(evutil_socket_t fd, short events, void* ctx);
void on_receive_message(int fd, short event);
};
+1120 -1090
View File
File diff suppressed because it is too large Load Diff
+149 -147
View File
@@ -1,147 +1,149 @@
#pragma once
#include <inttypes.h>
#include <phosg/Tools.hh>
#include "StaticGameData.hh"
enum class EnemyType {
UNKNOWN = -1,
NONE = 0,
NON_ENEMY_NPC,
AL_RAPPY,
ASTARK,
BA_BOOTA,
BARBA_RAY,
BARBAROUS_WOLF,
BEE_L,
BEE_R,
BOOMA,
BOOTA,
BULCLAW,
CANADINE,
CANADINE_GROUP,
CANANE,
CHAOS_BRINGER,
CHAOS_SORCERER,
CLAW,
DARK_BELRA,
DARK_FALZ_1,
DARK_FALZ_2,
DARK_FALZ_3,
DARK_GUNNER,
DARVANT,
DARVANT_ULTIMATE,
DE_ROL_LE,
DE_ROL_LE_BODY,
DE_ROL_LE_MINE,
DEATH_GUNNER,
DEL_LILY,
DEL_RAPPY,
DEL_RAPPY_ALT,
DELBITER,
DELDEPTH,
DELSABER,
DIMENIAN,
DOLMDARL,
DOLMOLM,
DORPHON,
DORPHON_ECLAIR,
DRAGON,
DUBCHIC,
DUBWITCH, // Has no entry in battle params
EGG_RAPPY,
EPSIGUARD,
EPSILON,
EVIL_SHARK,
GAEL,
GAL_GRYPHON,
GARANZ,
GEE,
GI_GUE,
GIBBLES,
GIGOBOOMA,
GILLCHIC,
GIRTABLULU,
GOBOOMA,
GOL_DRAGON,
GORAN,
GORAN_DETONATOR,
GRASS_ASSASSIN,
GUIL_SHARK,
HALLO_RAPPY,
HIDOOM,
HILDEBEAR,
HILDEBLUE,
ILL_GILL,
KONDRIEU,
LA_DIMENIAN,
LOVE_RAPPY,
MERICAROL,
MERICUS,
MERIKLE,
MERILLIA,
MERILTAS,
MERISSA_A,
MERISSA_AA,
MIGIUM,
MONEST,
MORFOS,
MOTHMANT,
NANO_DRAGON,
NAR_LILY,
OLGA_FLOW_1,
OLGA_FLOW_2,
PAL_SHARK,
PAN_ARMS,
PAZUZU,
PAZUZU_ALT,
PIG_RAY,
POFUILLY_SLIME,
POUILLY_SLIME,
POISON_LILY,
PYRO_GORAN,
RAG_RAPPY,
RECOBOX,
RECON,
SAINT_MILLION,
SAINT_RAPPY,
SAND_RAPPY,
SAND_RAPPY_ALT,
SATELLITE_LIZARD,
SATELLITE_LIZARD_ALT,
SAVAGE_WOLF,
SHAMBERTIN,
SINOW_BEAT,
SINOW_BERILL,
SINOW_GOLD,
SINOW_SPIGELL,
SINOW_ZELE,
SINOW_ZOA,
SO_DIMENIAN,
UL_GIBBON,
VOL_OPT_1,
VOL_OPT_2,
VOL_OPT_AMP,
VOL_OPT_CORE,
VOL_OPT_MONITOR,
VOL_OPT_PILLAR,
YOWIE,
YOWIE_ALT,
ZE_BOOTA,
ZOL_GIBBON,
ZU,
ZU_ALT,
MAX_ENEMY_TYPE,
};
template <>
const char* name_for_enum<EnemyType>(EnemyType type);
template <>
EnemyType enum_for_name<EnemyType>(const char* name);
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);
#pragma once
#include <inttypes.h>
#include <phosg/Tools.hh>
#include "StaticGameData.hh"
enum class EnemyType {
UNKNOWN = -1,
NONE = 0,
NON_ENEMY_NPC,
AL_RAPPY,
ASTARK,
BA_BOOTA,
BARBA_RAY,
BARBAROUS_WOLF,
BEE_L,
BEE_R,
BOOMA,
BOOTA,
BULCLAW,
BULK,
CANADINE,
CANADINE_GROUP,
CANANE,
CHAOS_BRINGER,
CHAOS_SORCERER,
CLAW,
DARK_BELRA,
DARK_FALZ_1,
DARK_FALZ_2,
DARK_FALZ_3,
DARK_GUNNER,
DARVANT,
DARVANT_ULTIMATE,
DE_ROL_LE,
DE_ROL_LE_BODY,
DE_ROL_LE_MINE,
DEATH_GUNNER,
DEL_LILY,
DEL_RAPPY,
DEL_RAPPY_ALT,
DELBITER,
DELDEPTH,
DELSABER,
DIMENIAN,
DOLMDARL,
DOLMOLM,
DORPHON,
DORPHON_ECLAIR,
DRAGON,
DUBCHIC,
DUBWITCH, // Has no entry in battle params
EGG_RAPPY,
EPSIGUARD,
EPSILON,
EVIL_SHARK,
GAEL,
GAL_GRYPHON,
GARANZ,
GEE,
GI_GUE,
GIBBLES,
GIGOBOOMA,
GILLCHIC,
GIRTABLULU,
GOBOOMA,
GOL_DRAGON,
GORAN,
GORAN_DETONATOR,
GRASS_ASSASSIN,
GUIL_SHARK,
HALLO_RAPPY,
HIDOOM,
HILDEBEAR,
HILDEBLUE,
ILL_GILL,
KONDRIEU,
LA_DIMENIAN,
LOVE_RAPPY,
MERICAROL,
MERICUS,
MERIKLE,
MERILLIA,
MERILTAS,
MERISSA_A,
MERISSA_AA,
MIGIUM,
MONEST,
MORFOS,
MOTHMANT,
NANO_DRAGON,
NAR_LILY,
OLGA_FLOW_1,
OLGA_FLOW_2,
PAL_SHARK,
PAN_ARMS,
PAZUZU,
PAZUZU_ALT,
PIG_RAY,
POFUILLY_SLIME,
POUILLY_SLIME,
POISON_LILY,
PYRO_GORAN,
RAG_RAPPY,
RECOBOX,
RECON,
SAINT_MILLION,
SAINT_RAPPY,
SAND_RAPPY,
SAND_RAPPY_ALT,
SATELLITE_LIZARD,
SATELLITE_LIZARD_ALT,
SAVAGE_WOLF,
SHAMBERTIN,
SINOW_BEAT,
SINOW_BERILL,
SINOW_GOLD,
SINOW_SPIGELL,
SINOW_ZELE,
SINOW_ZOA,
SO_DIMENIAN,
UL_GIBBON,
VOL_OPT_1,
VOL_OPT_2,
VOL_OPT_AMP,
VOL_OPT_CORE,
VOL_OPT_MONITOR,
VOL_OPT_PILLAR,
YOWIE,
YOWIE_ALT,
ZE_BOOTA,
ZOL_GIBBON,
ZU,
ZU_ALT,
MAX_ENEMY_TYPE,
};
template <>
const char* name_for_enum<EnemyType>(EnemyType type);
template <>
EnemyType enum_for_name<EnemyType>(const char* name);
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
+110 -5
View File
@@ -9,6 +9,12 @@ using namespace std;
namespace Episode3 {
void BattleRecord::PlayerEntry::print(FILE* stream) const {
// TODO: Format this nicely somehow. Maybe factor out the functions in
// QuestScript that format some of these structures
print_data(stream, this, sizeof(*this), 0, nullptr, PrintDataFlags::PRINT_ASCII | PrintDataFlags::DISABLE_COLOR | PrintDataFlags::OFFSET_16_BITS);
}
BattleRecord::Event::Event(StringReader& r) {
this->type = r.get<Event::Type>();
this->timestamp = r.get_u64l();
@@ -32,6 +38,7 @@ BattleRecord::Event::Event(StringReader& r) {
case Event::Type::GAME_COMMAND:
case Event::Type::BATTLE_COMMAND:
case Event::Type::EP3_GAME_COMMAND:
case Event::Type::SERVER_DATA_COMMAND:
this->data = r.read(r.get_u16l());
break;
default:
@@ -64,6 +71,7 @@ void BattleRecord::Event::serialize(StringWriter& w) const {
case Event::Type::GAME_COMMAND:
case Event::Type::BATTLE_COMMAND:
case Event::Type::EP3_GAME_COMMAND:
case Event::Type::SERVER_DATA_COMMAND:
w.put_u16l(this->data.size());
w.write(this->data);
break;
@@ -72,6 +80,52 @@ void BattleRecord::Event::serialize(StringWriter& w) const {
}
}
void BattleRecord::Event::print(FILE* stream) const {
string time_str = format_time(this->timestamp);
fprintf(stream, "Event @%016" PRIX64 " (%s) ", this->timestamp, time_str.c_str());
switch (this->type) {
case Type::PLAYER_JOIN:
fprintf(stream, "PLAYER_JOIN %02" PRIX32 "\n", this->players[0].lobby_data.client_id.load());
this->players[0].print(stream);
break;
case Type::PLAYER_LEAVE:
fprintf(stream, "PLAYER_LEAVE %02hhu\n", this->leaving_client_id);
break;
case Type::SET_INITIAL_PLAYERS:
fprintf(stream, "SET_INITIAL_PLAYERS");
for (const auto& player : this->players) {
fprintf(stream, " %02" PRIX32, player.lobby_data.client_id.load());
}
fputc('\n', stream);
for (const auto& player : this->players) {
player.print(stream);
}
break;
case Type::BATTLE_COMMAND:
fprintf(stream, "BATTLE_COMMAND\n");
print_data(stream, this->data, 0, nullptr, PrintDataFlags::PRINT_ASCII | PrintDataFlags::DISABLE_COLOR | PrintDataFlags::OFFSET_16_BITS);
break;
case Type::GAME_COMMAND:
fprintf(stream, "GAME_COMMAND\n");
print_data(stream, this->data, 0, nullptr, PrintDataFlags::PRINT_ASCII | PrintDataFlags::DISABLE_COLOR | PrintDataFlags::OFFSET_16_BITS);
break;
case Type::EP3_GAME_COMMAND:
fprintf(stream, "EP3_GAME_COMMAND\n");
print_data(stream, this->data, 0, nullptr, PrintDataFlags::PRINT_ASCII | PrintDataFlags::DISABLE_COLOR | PrintDataFlags::OFFSET_16_BITS);
break;
case Type::CHAT_MESSAGE:
fprintf(stream, "CHAT_MESSAGE %08" PRIX32 "\n", this->guild_card_number);
print_data(stream, this->data, 0, nullptr, PrintDataFlags::PRINT_ASCII | PrintDataFlags::DISABLE_COLOR | PrintDataFlags::OFFSET_16_BITS);
break;
case Type::SERVER_DATA_COMMAND:
fprintf(stream, "SERVER_DATA_COMMAND\n");
print_data(stream, this->data, 0, nullptr, PrintDataFlags::PRINT_ASCII | PrintDataFlags::DISABLE_COLOR | PrintDataFlags::OFFSET_16_BITS);
break;
default:
throw runtime_error("unknown event type in battle record");
}
}
BattleRecord::BattleRecord(uint32_t behavior_flags)
: is_writable(true),
behavior_flags(behavior_flags),
@@ -84,14 +138,23 @@ BattleRecord::BattleRecord(const string& data)
battle_start_timestamp(0),
battle_end_timestamp(0) {
StringReader r(data);
uint64_t signature = r.get_u64l();
if (signature != this->SIGNATURE) {
bool has_random_stream;
if (signature == this->SIGNATURE_V1) {
has_random_stream = false;
} else if (signature == this->SIGNATURE_V2) {
has_random_stream = true;
} else {
throw runtime_error("incorrect battle record signature");
}
this->battle_start_timestamp = r.get_u64l();
this->battle_end_timestamp = r.get_u64l();
this->behavior_flags = r.get_u32l();
if (has_random_stream) {
this->random_stream = r.read(r.get_u32l());
}
while (!r.eof()) {
this->events.emplace_back(r);
}
@@ -99,10 +162,12 @@ BattleRecord::BattleRecord(const string& data)
string BattleRecord::serialize() const {
StringWriter w;
w.put_u64l(this->SIGNATURE);
w.put_u64l(this->SIGNATURE_V2);
w.put_u64l(this->battle_start_timestamp);
w.put_u64l(this->battle_end_timestamp);
w.put_u32l(this->behavior_flags);
w.put_u32l(this->random_stream.size());
w.write(this->random_stream);
for (const auto& ev : this->events) {
ev.serialize(w);
}
@@ -187,11 +252,29 @@ void BattleRecord::add_chat_message(
ev.data = std::move(data);
}
void BattleRecord::add_random_data(const void* data, size_t size) {
this->random_stream.append(reinterpret_cast<const char*>(data), size);
}
vector<string> BattleRecord::get_all_server_data_commands() const {
vector<string> ret;
for (const auto& event : this->events) {
if (event.type == Event::Type::SERVER_DATA_COMMAND) {
ret.emplace_back(event.data);
}
}
return ret;
}
const string& BattleRecord::get_random_stream() const {
return this->random_stream;
}
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;
}
@@ -263,17 +346,35 @@ void BattleRecord::set_battle_start_timestamp() {
}
}
for (; it != this->events.end(); it++) {
if (it->type == Event::Type::BATTLE_COMMAND) {
if ((it->type == Event::Type::BATTLE_COMMAND) || (it->type == Event::Type::SERVER_DATA_COMMAND)) {
new_events.emplace_back(std::move(*it));
}
}
this->events = std::move(new_events);
// Clear any existing random data (there shouldn't be any)
this->random_stream.clear();
}
void BattleRecord::set_battle_end_timestamp() {
this->battle_end_timestamp = now();
}
void BattleRecord::print(FILE* stream) const {
string start_str = format_time(this->battle_start_timestamp);
string end_str = format_time(this->battle_end_timestamp);
fprintf(stream, "BattleRecord %s behavior_flags=%08" PRIX32 " start=%016" PRIX64 " (%s) end=%016" PRIX64 " (%s); %zu events\n",
this->is_writable ? "writable" : "read-only",
this->behavior_flags,
this->battle_start_timestamp,
start_str.c_str(),
this->battle_end_timestamp,
end_str.c_str(), this->events.size());
for (const auto& event : this->events) {
event.print(stream);
}
}
BattleRecordPlayer::BattleRecordPlayer(
shared_ptr<const BattleRecord> rec,
shared_ptr<struct event_base> base)
@@ -287,7 +388,7 @@ shared_ptr<const BattleRecord> BattleRecordPlayer::get_record() const {
return this->record;
}
void BattleRecordPlayer::set_lobby(std::shared_ptr<Lobby> l) {
void BattleRecordPlayer::set_lobby(shared_ptr<Lobby> l) {
this->lobby = l;
}
@@ -356,6 +457,10 @@ void BattleRecordPlayer::schedule_events() {
case BattleRecord::Event::Type::CHAT_MESSAGE:
send_prepared_chat_message(l, ev.guild_card_number, ev.data);
break;
case BattleRecord::Event::Type::SERVER_DATA_COMMAND:
// These are not replayed, since the battle record also contains
// the results of these commands.
break;
}
this->event_it++;
+17 -6
View File
@@ -9,7 +9,7 @@
#include <string>
#include <variant>
#include "../Player.hh"
#include "../PlayerSubordinates.hh"
struct Lobby;
@@ -24,7 +24,9 @@ public:
PlayerInventory inventory;
PlayerDispDataDCPCV3 disp;
le_uint32_t level;
} __attribute__((packed));
void print(FILE* stream) const;
} __packed_ws__(PlayerEntry, 0x440);
struct Event {
enum class Type : uint8_t {
@@ -35,6 +37,7 @@ public:
GAME_COMMAND = 4,
EP3_GAME_COMMAND = 5,
CHAT_MESSAGE = 6,
SERVER_DATA_COMMAND = 7,
};
// Fields used for all events
@@ -52,6 +55,7 @@ public:
Event() = default;
explicit Event(StringReader& r);
void serialize(StringWriter& w) const;
void print(FILE* stream) const;
};
explicit BattleRecord(uint32_t behavior_flags);
@@ -72,6 +76,7 @@ public:
void add_command(Event::Type type, const void* data, size_t size);
void add_command(Event::Type type, std::string&& data);
void add_chat_message(uint32_t guild_card_number, std::string&& data);
void add_random_data(const void* data, size_t size);
// This function collapses all the existing player join/leave events into a
// single SET_INITIAL_PLAYERS event, and deletes all events before the latest
// BATTLE_COMMAND command that specifies the battle map. This should provide a
@@ -79,8 +84,14 @@ public:
void set_battle_start_timestamp();
void set_battle_end_timestamp();
void print(FILE* stream) const;
std::vector<std::string> get_all_server_data_commands() const;
const std::string& get_random_stream() const;
private:
static constexpr uint64_t SIGNATURE = 0x14C946D56D1DAC50;
static constexpr uint64_t SIGNATURE_V1 = 0x14C946D56D1DAC50;
static constexpr uint64_t SIGNATURE_V2 = 0xD01E5EC12853C377;
static bool is_map_definition_event(const Event& ev);
@@ -90,15 +101,14 @@ private:
uint64_t battle_start_timestamp;
uint64_t battle_end_timestamp;
std::deque<Event> events;
std::string random_stream;
friend class BattleRecordPlayer;
};
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;
@@ -116,6 +126,7 @@ private:
std::shared_ptr<struct event_base> base;
std::weak_ptr<Lobby> lobby;
std::shared_ptr<struct event> next_command_ev;
StringReader random_r;
};
} // namespace Episode3
+576 -312
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);
+1082 -727
View File
File diff suppressed because it is too large Load Diff
+69 -64
View File
@@ -6,6 +6,7 @@
#include "../Text.hh"
#include "DataIndexes.hh"
#include "Server.hh"
namespace Episode3 {
@@ -45,52 +46,56 @@ 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 final_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();
void print(FILE* stream) const;
uint32_t at(size_t index) const;
} __attribute__((packed));
} __packed_ws__(AttackEnvStats, 0x9C);
CardSpecial(std::shared_ptr<Server> server);
std::shared_ptr<Server> server();
@@ -101,7 +106,7 @@ public:
void adjust_dice_boost_if_team_has_condition_52(
uint8_t team_id, uint8_t* inout_dice_boost, std::shared_ptr<const Card> card);
void apply_action_conditions(
uint8_t when,
EffectWhen when,
std::shared_ptr<const Card> attacker_card,
std::shared_ptr<Card> defender_card,
uint32_t flags,
@@ -113,7 +118,7 @@ public:
uint16_t condition_giver_card_ref,
uint16_t attacker_card_ref);
bool apply_defense_condition(
uint8_t when,
EffectWhen when,
Condition* defender_cond,
uint8_t cond_index,
const ActionState& defense_state,
@@ -122,7 +127,7 @@ public:
bool unknown_p8);
bool apply_defense_conditions(
const ActionState& as,
uint8_t when,
EffectWhen when,
std::shared_ptr<Card> defender_card,
uint32_t flags);
bool apply_stat_deltas_to_all_cards_from_all_conditions_with_card_ref(
@@ -159,8 +164,8 @@ 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);
bool condition_has_when_20_or_21(const Condition& cond) const;
void compute_team_dice_bonus(uint8_t team_id);
bool condition_applies_on_sc_or_item_attack(const Condition& cond) const;
size_t count_action_cards_with_condition_for_all_current_attacks(
ConditionType cond_type, uint16_t card_ref) const;
size_t count_action_cards_with_condition_for_current_attack(
@@ -184,7 +189,7 @@ public:
uint16_t set_card_ref,
uint16_t sc_card_ref,
uint8_t random_percent,
uint8_t when) const;
EffectWhen when) const;
int32_t evaluate_effect_expr(
const AttackEnvStats& ast,
const char* expr,
@@ -271,13 +276,13 @@ public:
size_t* out_damage_count) const;
void update_condition_orders(std::shared_ptr<Card> card);
int16_t max_all_attack_bonuses(size_t* out_count) const;
void unknown_80244AA8(std::shared_ptr<Card> card);
void apply_effects_after_card_move(std::shared_ptr<Card> card);
void check_for_defense_interference(
std::shared_ptr<const Card> attacker_card,
std::shared_ptr<Card> target_card,
int16_t* inout_unknown_p4);
void evaluate_and_apply_effects(
uint8_t when,
EffectWhen when,
uint16_t set_card_ref,
const ActionState& as,
uint16_t sc_card_ref,
@@ -308,23 +313,26 @@ public:
std::shared_ptr<const Card> card1,
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);
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_after_attack_target_resolution(const ActionState& as);
void move_phase_before_for_card(std::shared_ptr<Card> unknown_p2);
void dice_phase_before_for_card(std::shared_ptr<Card> card);
template <EffectWhen When1, EffectWhen When2>
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);
void check_for_attack_interference(std::shared_ptr<Card> unknown_p2);
template <uint8_t When1, uint8_t When2, uint8_t When3, uint8_t When4>
void unknown_t2(std::shared_ptr<Card> unknown_p2);
void unknown_8024997C(std::shared_ptr<Card> card);
void unknown_8024A394(std::shared_ptr<Card> card);
template <
EffectWhen WhenAllCards,
EffectWhen WhenAttackerAndActionCards,
EffectWhen WhenAttackerOrHunterSCCard,
EffectWhen WhenTargetsAndActionCards>
void apply_effects_before_or_after_attack(std::shared_ptr<Card> unknown_p2);
void apply_effects_before_attack(std::shared_ptr<Card> card);
void apply_effects_after_attack(std::shared_ptr<Card> card);
bool client_has_atk_dice_boost_condition(uint8_t client_id);
void unknown_8024A6DC(
std::shared_ptr<Card> unknown_p2, std::shared_ptr<Card> unknown_p3);
@@ -333,9 +341,6 @@ public:
private:
std::weak_ptr<Server> w_server;
ActionState unknown_action_state_a1;
ActionState action_state;
uint16_t unknown_a2;
};
} // namespace Episode3

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