Skip to content

Instantly share code, notes, and snippets.

View Andoryuuta's full-sized avatar
🛶
Canoeing across the atlantic

Andrew Gutekanst Andoryuuta

🛶
Canoeing across the atlantic
View GitHub Profile
@Andoryuuta
Andoryuuta / bad_dti_inheritance_mhw_15_20_00.md
Last active October 22, 2023 19:06
# Bad DTI inheritance (MHW 15.20.00)

Bad DTI inheritance (MHW 15.20.00)

These are all classes which have inherited from a DTI class, but which don't implement their own DTI (+don't override the ::GetDTI virtual method)

DTI name index vftable address
CoprocessorObject 0 0x14353a950
CoprocessorObject 1 0x143586060
MtArray 0 0x142f0cff8
MtArray 1 0x142f172a0
Class:MHiAIObject, Hash:0x5E6E97F0
Class:MHiAreaObject, Hash:0x13F84021
Class:MHiArrayObject, Hash:0x4A2F57B0
Class:MHiColladaObject, Hash:0x74A65A09
Class:MHiCollisionObject, Hash:0x3CD665F2
Class:MHiDevelopObject, Hash:0x3E226FCE
Class:MHiEffectObject, Hash:0x6773BC46
Class:MHiGUIObject, Hash:0x3FAF421
Class:MHiGlobalObject, Hash:0x6787E98A
Class:MHiInstancingObject, Hash:0x3EA6B848
a9c13fbe964af9d974101e36d7b82f9b

Rust Pain Points

A personal list of pain-points, rough edges, ambiguities, etc observed while trying to work on Rust projects (+adject tooling, cargo, crates.io, rust-analyzer, etc). This list is for personal reference, of personal experiences, not for "dunking" on the language or for flame wars. Multiple things in this list might be entirely incorrect / just undocumented.

- vs _ in crate names

The most common pattern for crate names is to use hypens. However, hypens are not valid identifiers in Rust. As such, these get implicitly converted to underscores. If you have a crate named foobar-rs, all references to that package in Rust code will need to use foobar_rs.

At some point in the past, this was an explicit implementation detail, requiring the syntax: extern crate "foobar-rs" as foobar_rs;

@Andoryuuta
Andoryuuta / sedbres_parser.py
Last active October 18, 2022 04:09
Dragon Quest X - SEDBRES parser
import struct
import os
from pprint import pprint
# Terribly slow way of reading null-terminated strings. :)
def readcstr(f):
return ''.join(iter(lambda: f.read(1).decode('ascii'), '\x00'))
#with open('fa2271e63a2ba277.rps', 'rb') as f:
with open('0x1e157d10.sedbres', 'rb') as f:
@Andoryuuta
Andoryuuta / MHFZ EM CMD list.h
Created October 9, 2022 13:40
MHFZ EM CMD list
0x1: EM_CMD_KEHAI_CK
0x2: EM_CMD_NINSHIKI_CK
0x3: EM_CMD_AREA_MOVE_CK
0x4: <MISSING, sets some value to 0 then returns.>
0x5: EM_TYPE_ACT_SET
0x6: EM_CMD_TARGET_SET
0x7: EM_CMD_MAIN_JUMP
0x8: EM_CMD_STAND_CK
0x9: EM_CMD_FLY_CK
0xA: EM_CMD_BODY_STATUS_SET
@Andoryuuta
Andoryuuta / csproto_metalib_dump.txt
Created April 17, 2022 01:16
Dump of the csproto metalib from MHO 2.0.11.860
This file has been truncated, but you can view the full file.
Metalib("csproto"): Magic: 2d6 Build: 11 PlatArch=32 ID=-1 ver=1 Metas 1678/1678 Macros:1995/1995
StringBuf<BeginPtr= 1677664 EndPtr= 1975304 FreeSize=3 defaultalign:1
Macro Name ptr:1677664 Name="MAX_NORMAL_PKG_LENGTH" id=210000 Desciption: 没有经过加密处理的消息包最大长度
Macro Name ptr:1677719 Name="MAX_CMD_COUNT" id=256 Desciption: 最大消息个数
Macro Name ptr:1677746 Name="CS_MAX_ROLE_NUM" id=6 Desciption: 每个帐号最多拥有的角色数量
Macro Name ptr:1677789 Name="CS_MAX_ROLE_NAME" id=32 Desciption: 最大角色名字长度
Macro Name ptr:1677823 Name="CS_MAX_TEAM_NAME" id=40 Desciption: 最大队伍名长度
Macro Name ptr:1677855 Name="CS_MAX_LEVEL_NAME" id=32 Desciption: 最大Level名字长度
import frida # py -3 -m pip install frida
import sys
import struct
if __name__ == '__main__':
device = frida.get_local_device()
proc = [p for p in device.enumerate_processes() if p.name == 'MonsterHunterRise.exe']
if len(proc) == 0:
print('Rise not running!')
sys.exit(1)
@Andoryuuta
Andoryuuta / test_mhrise_pak_decrypt.py
Created January 14, 2022 01:05
MH:Rise PC pak (entry header) decryption
import io
import struct
import binascii
def transform_crypto_key(input):
# Pretty sure this is a public hash
# input = binascii.unhexlify('c8399c72d1a39b08a0eb1867b9bf051344a230786a74de6fb6f37b8b05621f1529bf4365a8a2d106accbc6f9fd89bcce87e0cb2891b837a10805f463c17f13416ddb6b74f94326185abb0fbba95816e34c8ce7f477d327368116087e11fdb4f9096a314a30a1b16f4c327ca98adf1ce88606eadc228bdb4e95127042952e3798')
output = binascii.unhexlify('66BF3EAAE9B08286E2DE8F9D21993E78C7AEF6DF069347942E1D0FCAAC817A67')
return output
@Andoryuuta
Andoryuuta / MHS2_blowfish_keygen.cpp
Created July 9, 2021 04:24
Monster Hunter Stories 2 blowfish key generation
#include <iostream>
#include <cstdint>
uint32_t HIDWORD(uint64_t v) {
return v >> 32;
}
class MtRandom {
public: