N64 - wire of a disassembler, doesn't look like it works correctly, but at least the plumbing is done
This commit is contained in:
parent
6a81746636
commit
29b056b972
|
@ -392,6 +392,9 @@
|
|||
<Compile Include="Consoles\Nintendo\N64\N64.IDebuggable.cs">
|
||||
<DependentUpon>N64.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Nintendo\N64\N64.IDisassemblable.cs">
|
||||
<DependentUpon>N64.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Nintendo\N64\N64.IInputPollable.cs">
|
||||
<DependentUpon>N64.cs</DependentUpon>
|
||||
</Compile>
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.N64
|
||||
{
|
||||
public partial class N64 : IDisassemblable
|
||||
{
|
||||
public string Cpu
|
||||
{
|
||||
get { return "R4300"; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public IEnumerable<string> AvailableCpus
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return "R4300";
|
||||
}
|
||||
}
|
||||
|
||||
public string PCRegisterName
|
||||
{
|
||||
get { return "PC"; }
|
||||
}
|
||||
|
||||
public string Disassemble(MemoryDomain m, uint addr, out int length)
|
||||
{
|
||||
length = 4; // TODO: is this right?
|
||||
var instruction = m.PeekWord(addr, true);
|
||||
|
||||
var result = api.m64p_decode_op((uint)instruction, (int)addr);
|
||||
var strResult = Marshal.PtrToStringAnsi(result);
|
||||
|
||||
return strResult;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
portedUrl: "https://code.google.com/p/mupen64plus/"
|
||||
)]
|
||||
[ServiceNotApplicable(typeof(IDriveLight))]
|
||||
public partial class N64 : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable,
|
||||
public partial class N64 : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IDisassemblable,
|
||||
ISettable<N64Settings, N64SyncSettings>
|
||||
{
|
||||
private readonly N64Input _inputProvider;
|
||||
|
|
|
@ -265,6 +265,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
|
|||
delegate m64p_error CoreDoCommandRenderCallback(m64p_command Command, int ParamInt, RenderCallback ParamPtr);
|
||||
CoreDoCommandRenderCallback m64pCoreDoCommandRenderCallback;
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate IntPtr biz_r4300_decode_op(uint instr, int counter);
|
||||
public biz_r4300_decode_op m64p_decode_op;
|
||||
|
||||
/// <summary>
|
||||
/// Reads from the "system bus"
|
||||
/// </summary>
|
||||
|
@ -499,6 +503,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64.NativeApi
|
|||
|
||||
m64p_read_memory_8 = (biz_read_memory)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "biz_read_memory"), typeof(biz_read_memory));
|
||||
m64p_write_memory_8 = (biz_write_memory)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "biz_write_memory"), typeof(biz_write_memory));
|
||||
|
||||
m64p_decode_op = (biz_r4300_decode_op)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "biz_r4300_decode_op"), typeof(biz_r4300_decode_op));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -797,6 +797,30 @@ r4k_disassemble_split_quick ( uint32_t instruction,
|
|||
);
|
||||
}
|
||||
|
||||
#include "api/m64p_types.h"
|
||||
|
||||
EXPORT char* CALL biz_r4300_decode_op(uint32 instr, int counter)
|
||||
{
|
||||
char * _final;
|
||||
char * _op, * _args;
|
||||
|
||||
_op = NULL;
|
||||
_args = NULL;
|
||||
_final = NULL;
|
||||
|
||||
r4k_disassemble_split_quick(
|
||||
instr,
|
||||
counter,
|
||||
&_op,
|
||||
&_args
|
||||
);
|
||||
|
||||
|
||||
//free( _op );
|
||||
strcat(_op, " ");
|
||||
strcat(_op, _args);
|
||||
return _op;
|
||||
}
|
||||
|
||||
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=[ DECODE_OP ]=-=-=-=-=-=-=-=-=-=-=-=-=-=-=[//
|
||||
|
||||
|
@ -819,4 +843,3 @@ void r4300_decode_op ( uint32 instr, char * opcode, char * arguments, int counte
|
|||
|
||||
free( _op );
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue