git subrepo clone --branch=develop https://github.com/m4xw/emummc emummc
subrepo: subdir: "emummc" merged: "a9d569594" upstream: origin: "https://github.com/m4xw/emummc" branch: "develop" commit: "a9d569594" git-subrepo: version: "0.4.1" origin: "???" commit: "???"
This commit is contained in:
52
emummc/tools/fs_ida_nintendo_folder_xref_formatter.au3
vendored
Normal file
52
emummc/tools/fs_ida_nintendo_folder_xref_formatter.au3
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
ParseClipboard()
|
||||
|
||||
Func FormatLineData($sLineData, $sLineDataAdd)
|
||||
Local $lineData = StringReplace($sLineData, @TAB, " ")
|
||||
Local $lineDataADRP, $lineDataADD
|
||||
Local $isADRP = false
|
||||
$lineData = StringReplace($lineData, "Up o sub_71000" , "0x")
|
||||
$isADRP = StringInStr($lineData, "ADRP")
|
||||
|
||||
Local $targetRegister = StringSplit(StringSplit($lineData, "X")[2], ",")[1]
|
||||
$lineData = StringSplit($lineData, " ")[1]
|
||||
$lineDataAddr = StringSplit($lineData, "+")[1]
|
||||
$lineDataAddition = StringSplit($lineData, "+")[2]
|
||||
|
||||
$lineDataAddr = StringReplace($lineDataAddr, "0x" , "")
|
||||
$lineDataAddition = StringReplace($lineDataAddition, "0x" , "")
|
||||
$addrADRP = Dec($lineDataAddr) + Dec($lineDataAddition)
|
||||
|
||||
$lineDataADRP = "0x" & Hex($addrADRP)
|
||||
|
||||
Local $lineDataADD = StringReplace($sLineDataAdd, @TAB, " ")
|
||||
Local $isADD = false
|
||||
$lineDataADD = StringReplace($lineDataADD, "Up o sub_71000" , "0x")
|
||||
$isADD = StringInStr($lineData, "ADD")
|
||||
|
||||
$lineDataADD = StringSplit($lineDataADD, " ")[1]
|
||||
$lineDataAddAddr = StringSplit($lineDataADD, "+")[1]
|
||||
$lineDataAddAddition = StringSplit($lineDataADD, "+")[2]
|
||||
|
||||
$lineDataAddAddr = StringReplace($lineDataAddAddr, "0x" , "")
|
||||
$lineDataAddAddition = StringReplace($lineDataAddAddition, "0x" , "")
|
||||
$addrADD = Dec($lineDataAddAddr) + Dec($lineDataAddAddition)
|
||||
$addrADD = $addrADD - $addrADRP
|
||||
$lineDataADD = "0x" & Hex($addrADD)
|
||||
|
||||
Return @TAB & "{.opcode_reg = " & $targetRegister & ", .adrp_offset = " & $lineDataADRP & ", .add_rel_offset = " & $lineDataADD & "}, \" & @LF
|
||||
EndFunc
|
||||
|
||||
Func ParseClipboard()
|
||||
Local $sData = ClipGet()
|
||||
Local $oData = ""
|
||||
Local $sLineData = StringSplit(StringReplace($sData, @CRLF, @LF), @LF)
|
||||
For $i = 2 to UBound($sLineData) - 2 Step 2
|
||||
Local $lineData = FormatLineData($sLineData[$i], $sLineData[$i+1])
|
||||
;ConsoleWrite($lineData)
|
||||
$oData = $oData & $lineData
|
||||
Next
|
||||
|
||||
$oData = "{ \" & @LF & $oData & @TAB & "{.opcode_reg = 0, .adrp_offset = 0, .add_rel_offset = 0}, \" & @LF & "}" & @LF
|
||||
;ConsoleWrite($oData)
|
||||
ClipPut($oData)
|
||||
EndFunc
|
||||
53
emummc/tools/kip1converter.py
vendored
Normal file
53
emummc/tools/kip1converter.py
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# Modified kip1 conversion script, originally by jakibaki
|
||||
# Used for dev purposes, will be replaced in the future
|
||||
|
||||
from struct import pack, unpack
|
||||
from sys import argv
|
||||
|
||||
f = open(argv[1], "rb")
|
||||
|
||||
header_start = f.read(0x20)
|
||||
|
||||
section_names = [".text", ".rodata", ".data", ".bss"]
|
||||
|
||||
sections = []
|
||||
for i in range(6):
|
||||
section_bytes = f.read(0x10)
|
||||
section = {}
|
||||
|
||||
if i < len(section_names):
|
||||
section["Name"] = section_names[i]
|
||||
|
||||
section["OutOffset"], section["DecompressedSize"], section["CompressedSize"], section["Attribute"] = unpack("IIII", section_bytes)
|
||||
sections.append(section)
|
||||
print(section)
|
||||
|
||||
assert (sections[3]["OutOffset"] + sections[3]["DecompressedSize"]) % 0x1000 == 0
|
||||
|
||||
kernel_caps = []
|
||||
for i in range(0x20):
|
||||
val, = unpack("I", f.read(4))
|
||||
kernel_caps.append(val)
|
||||
|
||||
f.seek(0x100)
|
||||
|
||||
for i in range(3):
|
||||
section = sections[i]
|
||||
section["Buffer"] = f.read(section["DecompressedSize"])
|
||||
print(f.read())
|
||||
|
||||
f.close()
|
||||
|
||||
f = open(argv[2], "wb")
|
||||
|
||||
for i in range(3):
|
||||
section = sections[i]
|
||||
f.seek(section["OutOffset"])
|
||||
f.write(section["Buffer"])
|
||||
|
||||
f.seek(sections[3]["OutOffset"])
|
||||
f.write(b'\0' * sections[3]["DecompressedSize"])
|
||||
|
||||
caps = open("emummc.caps", "wb")
|
||||
for i in range(0x20):
|
||||
caps.write(pack("I", kernel_caps[i]))
|
||||
Reference in New Issue
Block a user