mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Switch effect and argument fields in BattleMove struct
This commit is contained in:
parent
17e74756cb
commit
d90767c490
114
asmdiff.ps1
114
asmdiff.ps1
@ -1,114 +0,0 @@
|
||||
Param
|
||||
(
|
||||
[Parameter(Position = 0)]
|
||||
[string]$Start,
|
||||
|
||||
[Parameter(Position = 1)]
|
||||
[string]$Offset,
|
||||
|
||||
[Parameter()]
|
||||
[string[]]$DiffTool
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$offset_default_value = "0x100"
|
||||
$diff_tool_default_value = "diff"
|
||||
|
||||
$help = "
|
||||
$($args[0]) [OPTIONS] Start [Offset]
|
||||
|
||||
Performs a diff on the assembly of a function in a rom. 'Start' is the start
|
||||
location of the function, and 'Offset' is the number of bytes to disassemble.
|
||||
The assembly is saved to *.dump files.
|
||||
|
||||
'Offset' is optional, and defaults to $offset_default_value. If this value is
|
||||
very large (0x10000+), objdump may hang / freeze.
|
||||
|
||||
Requirements:
|
||||
- A clean copy of the rom named 'baserom.gba'.
|
||||
- $$ENV:DEVKITARM to point to the installation of devkitpro. By default, it is
|
||||
installed to 'C:\devkitpro\devkitARM'.
|
||||
|
||||
Options:
|
||||
-DiffTool <tool> The tool to use for diffing. Defaults to '$diff_tool_default_value'. For VSCode,
|
||||
you can use -DiffTool 'code --diff'. (Quotes are necessary around 'code --diff')
|
||||
"
|
||||
|
||||
if ((-not (Test-Path variable:Start)) -or [string]::IsNullOrWhiteSpace($Start))
|
||||
{
|
||||
Write-Host $help
|
||||
exit
|
||||
}
|
||||
|
||||
if (-not (Test-Path variable:DiffTool) -or [string]::IsNullOrWhiteSpace($DiffTool))
|
||||
{
|
||||
$DiffTool = $diff_tool_default_value
|
||||
}
|
||||
|
||||
if (-not (Test-Path variable:Offset) -or [string]::IsNullOrWhiteSpace($Offset))
|
||||
{
|
||||
$Offset = $offset_default_value
|
||||
}
|
||||
|
||||
if (-Not (Test-Path env:DEVKITARM))
|
||||
{
|
||||
Write-Host "ENV:DEVKITARM variable not set."
|
||||
Write-Host $help
|
||||
exit
|
||||
}
|
||||
|
||||
if (-Not (Test-Path $env:DEVKITARM))
|
||||
{
|
||||
Write-Host "DEVKITARM path '$env:DEVKITARM' does not exist."
|
||||
Write-Host $help
|
||||
exit
|
||||
}
|
||||
|
||||
if (-Not (Test-Path ".\pokeemerald.gba"))
|
||||
{
|
||||
Write-Host "File 'pokeemerald.gba' not found."
|
||||
Write-Host $help
|
||||
exit
|
||||
}
|
||||
|
||||
if (-Not (Test-Path ".\baserom.gba"))
|
||||
{
|
||||
Write-Host "File 'baserom.gba' not found."
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$start_num = [System.Convert]::ToUInt64($Start, 16)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Host "Error parsing '$start_num' as a hex number."
|
||||
Write-Host $help
|
||||
exit
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$offset_num = [System.Convert]::ToUInt64($Offset, 16)
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Host "Error parsing '$offset_num' as a hex number."
|
||||
Write-Host $help
|
||||
exit
|
||||
}
|
||||
|
||||
if ($start_num -gt 0x1000000)
|
||||
{
|
||||
Write-Host "Warning: Start address is larger than the ROM file. Hint: ignore the leading number in the address."
|
||||
}
|
||||
|
||||
$end_str = [System.Convert]::ToString($start_num + $offset_num, 16)
|
||||
$end_str = "0x$end_str"
|
||||
|
||||
Write-Host "$Start - $end_str"
|
||||
$objdump = Join-Path -Path $env:DEVKITARM -ChildPath "arm-none-eabi\bin\objdump.exe"
|
||||
&$objdump -D -bbinary -marmv4t -Mforce-thumb --start-address="$Start" --stop-address="$end_str" .\baserom.gba > .\baserom.dump
|
||||
&$objdump -D -bbinary -marmv4t -Mforce-thumb --start-address="$Start" --stop-address="$end_str" .\pokeemerald.gba > .\pokeemerald.dump
|
||||
Invoke-Expression "$DiffTool .\baserom.dump .\pokeemerald.dump"
|
@ -336,11 +336,9 @@ struct BaseStats
|
||||
u8 noFlip : 1;
|
||||
};
|
||||
|
||||
// Argument and effect field are temporarily switched till functions referencing gBattleMoves are decompiled.
|
||||
|
||||
struct BattleMove
|
||||
{
|
||||
u8 argument;
|
||||
u16 effect;
|
||||
u8 power;
|
||||
u8 type;
|
||||
u8 accuracy;
|
||||
@ -350,7 +348,7 @@ struct BattleMove
|
||||
s8 priority;
|
||||
u32 flags;
|
||||
u8 split;
|
||||
u16 effect;
|
||||
u8 argument;
|
||||
};
|
||||
|
||||
struct SpindaSpot
|
||||
|
Loading…
Reference in New Issue
Block a user