git subrepo clone --branch=develop https://github.com/m4xw/emuMMC emummc

subrepo:
  subdir:   "emummc"
  merged:   "e72e8f1c"
upstream:
  origin:   "https://github.com/m4xw/emuMMC"
  branch:   "develop"
  commit:   "e72e8f1c"
git-subrepo:
  version:  "0.4.0"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "5d6aba9"
This commit is contained in:
Michael Scire
2019-06-15 21:37:41 -07:00
parent 87a1aa17a7
commit b7a370b156
90 changed files with 21714 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
ParseClipboard()
Func FormatLineData($sLineData)
Local $lineData = StringReplace($sLineData, @TAB, " ")
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" , "")
If $isADRP Then
$lineData = "0x" & Hex(Dec($lineDataAddr) + Dec($lineDataAddition))
Else
Return ""
EndIf
Return "{.opcode_reg = " & $targetRegister & ", .adrp_offset = " & $lineData & "}, \" & @LF
EndFunc
Func ParseClipboard()
Local $sData = ClipGet()
Local $oData = ""
Local $sLineData = StringSplit(StringReplace($sData, @CRLF, @LF), @LF)
For $i = 2 to UBound($sLineData) - 2
Local $lineData = FormatLineData($sLineData[$i])
;ConsoleWrite($lineData)
$oData = $oData & $lineData
Next
ClipPut($oData)
EndFunc

View File

@@ -0,0 +1,54 @@
# 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]))