snes-print messages from libsnes. now you can see which dsp/firmware dependency it detected for the game (it has its own heuristics, not necessarily any need for gamedb yet). still not loading the firmwares though

This commit is contained in:
zeromus 2012-09-27 01:38:27 +00:00
parent 00f9e05d5e
commit 6c8177a08b
6 changed files with 47 additions and 3 deletions

View File

@ -112,6 +112,23 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
[DllImport("libsneshawk.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool snes_unserialize(IntPtr data, int size);
[DllImport("libsneshawk.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int snes_poll_message();
[DllImport("libsneshawk.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void snes_dequeue_message(IntPtr strBuffer);
public static bool HasMessage { get { return snes_poll_message() != -1; } }
public static string DequeueMessage()
{
int len = snes_poll_message();
sbyte* temp = stackalloc sbyte[len + 1];
temp[len] = 0;
snes_dequeue_message(new IntPtr(temp));
return new string(temp);
}
[DllImport("libsneshawk.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void snes_set_layer_enable(int layer, int priority,
[MarshalAs(UnmanagedType.U1)]
@ -482,6 +499,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
timeFrameCounter++;
LibsnesDll.snes_run();
while (LibsnesDll.HasMessage)
Console.WriteLine(LibsnesDll.DequeueMessage());
if (IsLagFrame)
LagCount++;
}

View File

@ -1 +1,2 @@
rm bsnes/obj/*.o
rm -r bsnes/obj
rm -r bsnes/out

View File

@ -1,6 +1,8 @@
cd bsnes
mkdir obj
mkdir out
export BIZWINCFLAGS="-I. -O3 -masm=intel -DLIBCO_IMPORT -DLIBCO_MSVC -static-libgcc -static-libstdc++"
export TARGET_LIBSNES_LIBDEPS="-L ../libco_msvc_win32/release/ -llibco_msvc_win32 -static-libgcc -static-libstdc++"
profile=compatibility platform=win target=libsnes make -e -j
profile=compatibility platform=win target=libsnes make -e
cd ..
cp bsnes/out/snes.dll ../BizHawk.MultiClient/output/libsneshawk.dll

View File

@ -3,6 +3,9 @@
#include <nall/snes/cartridge.hpp>
#include <nall/gameboy/cartridge.hpp>
#include <queue>
using namespace nall;
struct Interface : public SNES::Interface {
@ -18,6 +21,9 @@ struct Interface : public SNES::Interface {
//zero 11-sep-2012
time_t randomSeed() { return 0; }
//zero 26-sep-2012
std::queue<nall::string> messages;
void videoRefresh(const uint32_t *data, bool hires, bool interlace, bool overscan) {
unsigned width = hires ? 512 : 256;
unsigned height = overscan ? 239 : 224;
@ -58,7 +64,7 @@ struct Interface : public SNES::Interface {
}
void message(const string &text) {
print(text, "\n");
messages.push(text);
}
string path(SNES::Cartridge::Slot slot, const string &hint) {
@ -510,3 +516,14 @@ unsigned snes_get_memory_size(unsigned id) {
return size;
}
int snes_poll_message()
{
if(interface.messages.size() == 0) return -1;
return interface.messages.front().length();
}
void snes_dequeue_message(char* buffer)
{
int len = interface.messages.front().length();
memcpy(buffer,(const char*)interface.messages.front(),len);
interface.messages.pop();
}

View File

@ -135,6 +135,10 @@ bool snes_check_cartridge(const uint8_t *rom_data, unsigned rom_size);
void snes_set_layer_enable(int layer, int priority, bool enable);
typedef void (*snes_scanlineStart_t)(int);
void snes_set_scanlineStart(snes_scanlineStart_t);
//returns -1 if no messages, messagelength if there is one
int snes_poll_message();
//give us a buffer of messagelength and we'll dequeue a message into it. you better take care of the null pointer
void snes_dequeue_message(char* buffer);
//$2105
#define SNES_REG_BG_MODE 0