diff --git a/libmupen64plus/mupen64plus-sln/projects/msvc11/mupen64plus.sln b/libmupen64plus/mupen64plus-sln/projects/msvc11/mupen64plus.sln index 5c3079d363..63716e1ffd 100644 --- a/libmupen64plus/mupen64plus-sln/projects/msvc11/mupen64plus.sln +++ b/libmupen64plus/mupen64plus-sln/projects/msvc11/mupen64plus.sln @@ -12,6 +12,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-audio-bkm", ".. EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-input-bkm", "..\..\..\mupen64plus-input-bkm\mupen64plus-input-bkm\mupen64plus-input-bkm.vcxproj", "{3D8BD211-6002-4698-B5C1-A0F3146B6ACF}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mupen64plus-video-jabo", "..\..\..\mupen64plus-video-jabo\mupen64plus-video-jabo\mupen64plus-video-jabo.vcxproj", "{0C220B26-3D4D-431D-B829-CADE6508A771}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -42,6 +44,10 @@ Global {3D8BD211-6002-4698-B5C1-A0F3146B6ACF}.Debug|Win32.Build.0 = Debug|Win32 {3D8BD211-6002-4698-B5C1-A0F3146B6ACF}.Release|Win32.ActiveCfg = Release|Win32 {3D8BD211-6002-4698-B5C1-A0F3146B6ACF}.Release|Win32.Build.0 = Release|Win32 + {0C220B26-3D4D-431D-B829-CADE6508A771}.Debug|Win32.ActiveCfg = Debug|Win32 + {0C220B26-3D4D-431D-B829-CADE6508A771}.Debug|Win32.Build.0 = Debug|Win32 + {0C220B26-3D4D-431D-B829-CADE6508A771}.Release|Win32.ActiveCfg = Release|Win32 + {0C220B26-3D4D-431D-B829-CADE6508A771}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/libmupen64plus/mupen64plus-video-jabo/jabo_api.h b/libmupen64plus/mupen64plus-video-jabo/jabo_api.h new file mode 100644 index 0000000000..d8655e9f29 --- /dev/null +++ b/libmupen64plus/mupen64plus-video-jabo/jabo_api.h @@ -0,0 +1,301 @@ +/********************************************************************************** +Common gfx plugin spec, version #1.3 maintained by zilmar (zilmar@emulation64.com) +MODIFIED: Turned function prototypes into function pointer typedefs + +All questions or suggestions should go through the mailing list. +http://www.egroups.com/group/Plugin64-Dev +*********************************************************************************** + +Notes: +------ + +Setting the approprate bits in the MI_INTR_REG and calling CheckInterrupts which +are both passed to the DLL in InitiateGFX will generate an Interrupt from with in +the plugin. + +The Setting of the RSP flags and generating an SP interrupt should not be done in +the plugin + +**********************************************************************************/ +#ifndef _GFX_H_INCLUDED__ +#define _GFX_H_INCLUDED__ + +#if defined(__cplusplus) +extern "C" { +#endif + +/* Plugin types */ +#define PLUGIN_TYPE_GFX 2 + +//#define EXPORT __declspec(dllexport) +//#define CALL _cdecl + +/***** Structures *****/ +typedef struct { + WORD Version; /* Set to 0x0103 */ + WORD Type; /* Set to PLUGIN_TYPE_GFX */ + char Name[100]; /* Name of the DLL */ + + /* If DLL supports memory these memory options then set them to TRUE or FALSE + if it does not support it */ + BOOL NormalMemory; /* a normal BYTE array */ + BOOL MemoryBswaped; /* a normal BYTE array where the memory has been pre + bswap on a dword (32 bits) boundry */ +} PLUGIN_INFO; + +typedef struct { + HWND hWnd; /* Render window */ + HWND hStatusBar; /* if render window does not have a status bar then this is NULL */ + + BOOL MemoryBswaped; // If this is set to TRUE, then the memory has been pre + // bswap on a dword (32 bits) boundry + // eg. the first 8 bytes are stored like this: + // 4 3 2 1 8 7 6 5 + + BYTE * HEADER; // This is the rom header (first 40h bytes of the rom + // This will be in the same memory format as the rest of the memory. + BYTE * RDRAM; + BYTE * DMEM; + BYTE * IMEM; + + DWORD * MI_INTR_REG; + + DWORD * DPC_START_REG; + DWORD * DPC_END_REG; + DWORD * DPC_CURRENT_REG; + DWORD * DPC_STATUS_REG; + DWORD * DPC_CLOCK_REG; + DWORD * DPC_BUFBUSY_REG; + DWORD * DPC_PIPEBUSY_REG; + DWORD * DPC_TMEM_REG; + + DWORD * VI_STATUS_REG; + DWORD * VI_ORIGIN_REG; + DWORD * VI_WIDTH_REG; + DWORD * VI_INTR_REG; + DWORD * VI_V_CURRENT_LINE_REG; + DWORD * VI_TIMING_REG; + DWORD * VI_V_SYNC_REG; + DWORD * VI_H_SYNC_REG; + DWORD * VI_LEAP_REG; + DWORD * VI_H_START_REG; + DWORD * VI_V_START_REG; + DWORD * VI_V_BURST_REG; + DWORD * VI_X_SCALE_REG; + DWORD * VI_Y_SCALE_REG; + + void (*CheckInterrupts)( void ); +} GFX_INFO; + +/****************************************************************** + Function: CaptureScreen + Purpose: This function dumps the current frame to a file + input: pointer to the directory to save the file to + output: none +*******************************************************************/ +//EXPORT void CALL CaptureScreen ( char * Directory ); +typedef void (*ptr_CaptureScreen)(char *); + +/****************************************************************** + Function: ChangeWindow + Purpose: to change the window between fullscreen and window + mode. If the window was in fullscreen this should + change the screen to window mode and vice vesa. + input: none + output: none +*******************************************************************/ +//EXPORT void CALL ChangeWindow (void); +typedef void (*ptr_ChangeWindow)(void); + +/****************************************************************** + Function: CloseDLL + Purpose: This function is called when the emulator is closing + down allowing the dll to de-initialise. + input: none + output: none +*******************************************************************/ +//EXPORT void CALL CloseDLL (void); +typedef void (*ptr_CloseDLL)(void); + +/****************************************************************** + Function: DllAbout + Purpose: This function is optional function that is provided + to give further information about the DLL. + input: a handle to the window that calls this function + output: none +*******************************************************************/ +//EXPORT void CALL DllAbout ( HWND hParent ); +typedef void (*ptr_DllAbout)(HWND hParent); + +/****************************************************************** + Function: DllConfig + Purpose: This function is optional function that is provided + to allow the user to configure the dll + input: a handle to the window that calls this function + output: none +*******************************************************************/ +//EXPORT void CALL DllConfig ( HWND hParent ); +typedef void (*ptr_DllConfig)(HWND hParent); + +/****************************************************************** + Function: DllTest + Purpose: This function is optional function that is provided + to allow the user to test the dll + input: a handle to the window that calls this function + output: none +*******************************************************************/ +// IGNORE +//EXPORT void CALL DllTest ( HWND hParent ); + +/****************************************************************** + Function: DrawScreen + Purpose: This function is called when the emulator receives a + WM_PAINT message. This allows the gfx to fit in when + it is being used in the desktop. + input: none + output: none +*******************************************************************/ +//EXPORT void CALL DrawScreen (void); +typedef void (*ptr_DrawScreen)(void); + +/****************************************************************** + Function: GetDllInfo + Purpose: This function allows the emulator to gather information + about the dll by filling in the PluginInfo structure. + input: a pointer to a PLUGIN_INFO stucture that needs to be + filled by the function. (see def above) + output: none +*******************************************************************/ +//EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo ); +typedef void (*ptr_GetDllInfo)(PLUGIN_INFO * PluginInfo); + +/****************************************************************** + Function: InitiateGFX + Purpose: This function is called when the DLL is started to give + information from the emulator that the n64 graphics + uses. This is not called from the emulation thread. + Input: Gfx_Info is passed to this function which is defined + above. + Output: TRUE on success + FALSE on failure to initialise + + ** note on interrupts **: + To generate an interrupt set the appropriate bit in MI_INTR_REG + and then call the function CheckInterrupts to tell the emulator + that there is a waiting interrupt. +*******************************************************************/ +//EXPORT BOOL CALL InitiateGFX (GFX_INFO Gfx_Info); +typedef void (*ptr_InitiateGFX)(GFX_INFO Gfx_Info); + +/****************************************************************** + Function: MoveScreen + Purpose: This function is called in response to the emulator + receiving a WM_MOVE passing the xpos and ypos passed + from that message. + input: xpos - the x-coordinate of the upper-left corner of the + client area of the window. + ypos - y-coordinate of the upper-left corner of the + client area of the window. + output: none +*******************************************************************/ +// INGORE +//EXPORT void CALL MoveScreen (int xpos, int ypos); +typedef void (*ptr_MoveScreen)(int xpos, int ypos); + +/****************************************************************** + Function: ProcessDList + Purpose: This function is called when there is a Dlist to be + processed. (High level GFX list) + input: none + output: none +*******************************************************************/ +//EXPORT void CALL ProcessDList(void); +typedef void (*ptr_ProcessDList)(void); + +/****************************************************************** + Function: ProcessRDPList + Purpose: This function is called when there is a Dlist to be + processed. (Low level GFX list) + input: none + output: none +*******************************************************************/ +//EXPORT void CALL ProcessRDPList(void); +typedef void (*ptr_ProcessRDPList)(void); + +/****************************************************************** + Function: RomClosed + Purpose: This function is called when a rom is closed. + input: none + output: none +*******************************************************************/ +//EXPORT void CALL RomClosed (void); +typedef void (*ptr_RomClosed)(void); + +/****************************************************************** + Function: RomOpen + Purpose: This function is called when a rom is open. (from the + emulation thread) + input: none + output: none +*******************************************************************/ +//EXPORT void CALL RomOpen (void); +typedef void (*ptr_RomOpen)(void); + +/****************************************************************** + Function: ShowCFB + Purpose: Useally once Dlists are started being displayed, cfb is + ignored. This function tells the dll to start displaying + them again. + input: none + output: none +*******************************************************************/ +//EXPORT void CALL ShowCFB (void); +typedef void (*ptr_ShowCFB)(void); + +/****************************************************************** + Function: UpdateScreen + Purpose: This function is called in response to a vsync of the + screen were the VI bit in MI_INTR_REG has already been + set + input: none + output: none +*******************************************************************/ +//EXPORT void CALL UpdateScreen (void); +typedef void (*ptr_UpdateScreen)(void); + +/****************************************************************** + Function: ViStatusChanged + Purpose: This function is called to notify the dll that the + ViStatus registers value has been changed. + input: none + output: none +*******************************************************************/ +//EXPORT void CALL ViStatusChanged (void); +typedef void (*ptr_ViStatusChanged)(void); + +/****************************************************************** + Function: ViWidthChanged + Purpose: This function is called to notify the dll that the + ViWidth registers value has been changed. + input: none + output: none +*******************************************************************/ +//EXPORT void CALL ViWidthChanged (void); +typedef void (*ptr_ViWidthChanged)(void); + +/****************************************************************** + Function: ReadScreen + Purpose: Capture the current screen + Input: none + Output: dest - 24-bit RGB data + width - width of image + height - height of image + ******************************************************************/ +//EXPORT void CALL ReadScreen (void **dest, long *width, long *height); +typedef void (*ptr_ReadScreen)(void **dest, long *width, long *height); + +#if defined(__cplusplus) +} + +#endif +#endif diff --git a/libmupen64plus/mupen64plus-video-jabo/main.cpp b/libmupen64plus/mupen64plus-video-jabo/main.cpp new file mode 100644 index 0000000000..9b54d6cded --- /dev/null +++ b/libmupen64plus/mupen64plus-video-jabo/main.cpp @@ -0,0 +1,399 @@ +/* Mupen64plus-video-jabo */ + +#include +#include +#include +#include +#include + +#define M64P_PLUGIN_PROTOTYPES 1 +#include "m64p_types.h" +#include "m64p_plugin.h" +#include "m64p_common.h" +#include "m64p_config.h" + +#include "main.h" +#include "typedefs.h" + +#define LOG(x) { std::ofstream myfile; myfile.open ("jabo_wrapper_log.txt", std::ios::app); myfile << x << "\n"; myfile.close(); } + +namespace OldAPI +{ + #include "jabo_api.h" + ptr_InitiateGFX InitiateGFX = NULL; + ptr_ProcessDList ProcessDList = NULL; + ptr_ProcessRDPList ProcessRDPList = NULL; + ptr_ShowCFB ShowCFB = NULL; + ptr_ViStatusChanged ViStatusChanged = NULL; + ptr_ViWidthChanged ViWidthChanged = NULL; + ptr_RomOpen RomOpen = NULL; + ptr_RomClosed RomClosed = NULL; + ptr_CloseDLL CloseDLL = NULL; + + ptr_DrawScreen DrawScreen = NULL; + ptr_MoveScreen MoveScreen = NULL; + ptr_UpdateScreen UpdateScreen = NULL; + ptr_DllConfig DllConfig = NULL; + ptr_GetDllInfo GetDllInfo = NULL; +} + +/* local variables */ +static void (*l_DebugCallback)(void *, int, const char *) = NULL; +static void *l_DebugCallContext = NULL; +static int l_PluginInit = 0; + +HMODULE JaboDLL; +HWND hWnd_jabo; + +void setup_jabo_functions() +{ + JaboDLL = LoadLibrary("Jabotard_Direct3D8.dll"); + + if (JaboDLL != NULL) + { + OldAPI::InitiateGFX = (OldAPI::ptr_InitiateGFX)GetProcAddress(JaboDLL,"InitiateGFX"); + OldAPI::ProcessDList = (OldAPI::ptr_ProcessDList)GetProcAddress(JaboDLL,"ProcessDList"); + OldAPI::ProcessRDPList = (OldAPI::ptr_ProcessRDPList)GetProcAddress(JaboDLL,"ProcessRDPList"); + OldAPI::ShowCFB = (OldAPI::ptr_ShowCFB)GetProcAddress(JaboDLL,"ShowCFB"); + OldAPI::ViStatusChanged = (OldAPI::ptr_ViStatusChanged)GetProcAddress(JaboDLL,"ViStatusChanged"); + OldAPI::ViWidthChanged = (OldAPI::ptr_ViWidthChanged)GetProcAddress(JaboDLL,"ViWidthChanged"); + OldAPI::RomOpen = (OldAPI::ptr_RomOpen)GetProcAddress(JaboDLL,"RomOpen"); + OldAPI::RomClosed = (OldAPI::ptr_RomClosed)GetProcAddress(JaboDLL,"RomClosed"); + OldAPI::CloseDLL = (OldAPI::ptr_CloseDLL)GetProcAddress(JaboDLL,"CloseDLL"); + + OldAPI::DrawScreen = (OldAPI::ptr_DrawScreen)GetProcAddress(JaboDLL,"DrawScreen"); + OldAPI::MoveScreen = (OldAPI::ptr_MoveScreen)GetProcAddress(JaboDLL,"MoveScreen"); + OldAPI::UpdateScreen = (OldAPI::ptr_UpdateScreen)GetProcAddress(JaboDLL,"UpdateScreen"); + OldAPI::DllConfig = (OldAPI::ptr_DllConfig)GetProcAddress(JaboDLL,"DllConfig"); + OldAPI::GetDllInfo = (OldAPI::ptr_GetDllInfo)GetProcAddress(JaboDLL,"GetDllInfo"); + } +} + +/* Global functions */ +static void DebugMessage(int level, const char *message, ...) +{ + char msgbuf[1024]; + va_list args; + + if (l_DebugCallback == NULL) + return; + + va_start(args, message); + vsprintf(msgbuf, message, args); + + (*l_DebugCallback)(l_DebugCallContext, level, msgbuf); + + va_end(args); +} + +#pragma region (De-)Initialization +/* Mupen64Plus plugin functions */ +// TODO +EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Context, + void (*DebugCallback)(void *, int, const char *)) +{ + LOG("API WRAPPER:\t PluginStartup") + setup_jabo_functions(); + + ptr_CoreGetAPIVersions CoreAPIVersionFunc; + + int ConfigAPIVersion, DebugAPIVersion, VidextAPIVersion; + + if (l_PluginInit) + return M64ERR_ALREADY_INIT; + + /* first thing is to set the callback function for debug info */ + l_DebugCallback = DebugCallback; + l_DebugCallContext = Context; + + /* attach and call the CoreGetAPIVersions function, check Config API version for compatibility */ + CoreAPIVersionFunc = (ptr_CoreGetAPIVersions) GetProcAddress(CoreLibHandle, "CoreGetAPIVersions"); + + if (CoreAPIVersionFunc == NULL) + { + DebugMessage(M64MSG_ERROR, "Core emulator broken; no CoreAPIVersionFunc() function found."); + return M64ERR_INCOMPATIBLE; + } + + (*CoreAPIVersionFunc)(&ConfigAPIVersion, &DebugAPIVersion, &VidextAPIVersion, NULL); + if ((ConfigAPIVersion & 0xffff0000) != (CONFIG_API_VERSION & 0xffff0000)) + { + DebugMessage(M64MSG_ERROR, "Emulator core Config API (v%i.%i.%i) incompatible with plugin (v%i.%i.%i)", + VERSION_PRINTF_SPLIT(ConfigAPIVersion), VERSION_PRINTF_SPLIT(CONFIG_API_VERSION)); + return M64ERR_INCOMPATIBLE; + } + + l_PluginInit = 1; + return M64ERR_SUCCESS; +} + +// TODO +EXPORT m64p_error CALL PluginShutdown(void) +{ + LOG("API WRAPPER:\t PluginShutdown") + OldAPI::CloseDLL(); + + if (!l_PluginInit) + return M64ERR_NOT_INIT; + + /* reset some local variables */ + l_DebugCallback = NULL; + l_DebugCallContext = NULL; + + l_PluginInit = 0; + return M64ERR_SUCCESS; +} + +// TODO +EXPORT int CALL RomOpen(void) +{ + LOG("API WRAPPER:\t RomOpen") + OldAPI::RomOpen(); + + if (!l_PluginInit) + return 0; + + return 1; +} + +// TODO +EXPORT void CALL RomClosed( void ) +{ + LOG("API WRAPPER:\t RomClosed") + OldAPI::RomClosed(); + + if (!l_PluginInit) + return; +} + +#pragma endregion + +#pragma region Pluginversion +EXPORT m64p_error CALL PluginGetVersion(m64p_plugin_type *PluginType, int *PluginVersion, int *APIVersion, const char **PluginNamePtr, int *Capabilities) +{ + LOG("API WRAPPER:\t PluginGetVersion") + + OldAPI::PLUGIN_INFO info; + OldAPI::GetDllInfo(&info); + + /* set version info */ + if (PluginType != NULL) + *PluginType = M64PLUGIN_GFX; + + if (PluginVersion != NULL) + *PluginVersion = PLUGIN_VERSION; + + if (APIVersion != NULL) + *APIVersion = VIDEO_PLUGIN_API_VERSION; + + if (PluginNamePtr != NULL) + *PluginNamePtr = PLUGIN_NAME; + + if (Capabilities != NULL) + { + *Capabilities = 0; + } + + return M64ERR_SUCCESS; +} +#pragma endregion + +// IGNORE +EXPORT void CALL ChangeWindow (void) +{ + LOG("API WRAPPER:\t ChangeWindow") +} + +// NOTE: NEW GFX_INFO vs old +EXPORT int CALL InitiateGFX(GFX_INFO Gfx_Info) +{ + LOG("API WRAPPER:\t InitiateGFX") + + OldAPI::GFX_INFO blah; + + blah.hWnd = hWnd_jabo; + blah.hStatusBar = NULL; + blah.MemoryBswaped = true; + + blah.HEADER = Gfx_Info.HEADER; + + blah.RDRAM = Gfx_Info.RDRAM; + blah.DMEM = Gfx_Info.DMEM; + blah.IMEM = Gfx_Info.IMEM; + + blah.MI_INTR_REG = (DWORD *)Gfx_Info.MI_INTR_REG; + + blah.DPC_START_REG = (DWORD *)Gfx_Info.DPC_START_REG; + blah.DPC_END_REG = (DWORD *)Gfx_Info.DPC_END_REG; + blah.DPC_CURRENT_REG = (DWORD *)Gfx_Info.DPC_CURRENT_REG; + blah.DPC_STATUS_REG = (DWORD *)Gfx_Info.DPC_STATUS_REG; + blah.DPC_CLOCK_REG = (DWORD *)Gfx_Info.DPC_CLOCK_REG; + blah.DPC_BUFBUSY_REG = (DWORD *)Gfx_Info.DPC_BUFBUSY_REG; + blah.DPC_PIPEBUSY_REG = (DWORD *)Gfx_Info.DPC_PIPEBUSY_REG; + blah.DPC_TMEM_REG = (DWORD *)Gfx_Info.DPC_TMEM_REG; + + blah.VI_STATUS_REG = (DWORD *)Gfx_Info.VI_STATUS_REG; + blah.VI_ORIGIN_REG = (DWORD *)Gfx_Info.VI_ORIGIN_REG; + blah.VI_WIDTH_REG = (DWORD *)Gfx_Info.VI_WIDTH_REG; + blah.VI_INTR_REG = (DWORD *)Gfx_Info.VI_INTR_REG; + blah.VI_V_CURRENT_LINE_REG = (DWORD *)Gfx_Info.VI_V_CURRENT_LINE_REG; + blah.VI_TIMING_REG = (DWORD *)Gfx_Info.VI_TIMING_REG; + blah.VI_V_SYNC_REG = (DWORD *)Gfx_Info.VI_V_SYNC_REG; + blah.VI_H_SYNC_REG = (DWORD *)Gfx_Info.VI_H_SYNC_REG; + blah.VI_LEAP_REG = (DWORD *)Gfx_Info.VI_LEAP_REG; + blah.VI_H_START_REG = (DWORD *)Gfx_Info.VI_H_START_REG; + blah.VI_V_START_REG = (DWORD *)Gfx_Info.VI_V_START_REG; + blah.VI_V_BURST_REG = (DWORD *)Gfx_Info.VI_V_BURST_REG; + blah.VI_X_SCALE_REG = (DWORD *)Gfx_Info.VI_X_SCALE_REG; + blah.VI_Y_SCALE_REG = (DWORD *)Gfx_Info.VI_Y_SCALE_REG; + + blah.CheckInterrupts = Gfx_Info.CheckInterrupts; + + OldAPI::InitiateGFX(blah); + + return(TRUE); +} + +EXPORT void CALL MoveScreen (int xpos, int ypos) +{ + LOG("API WRAPPER:\t MoveScreen") + OldAPI::MoveScreen(xpos, ypos); +} + +EXPORT void CALL ProcessDList(void) +{ + LOG("API WRAPPER:\t ProcessDList") + OldAPI::ProcessDList(); +} + +EXPORT void CALL ProcessRDPList(void) +{ + LOG("API WRAPPER:\t ProcessRDPList") + OldAPI::ProcessRDPList(); +} + +EXPORT void CALL ShowCFB(void) +{ + LOG("API WRAPPER:\t ShowCFB") + OldAPI::ShowCFB(); +} + +EXPORT void CALL UpdateScreen(void) +{ + LOG("API WRAPPER:\t UpdateScreen") + OldAPI::UpdateScreen(); +} + +EXPORT void CALL ViStatusChanged(void) +{ + LOG("API WRAPPER:\t ViStatusChanged") + OldAPI::ViStatusChanged(); +} + +EXPORT void CALL ViWidthChanged(void) +{ + LOG("API WRAPPER:\t ViWidthChanged") + OldAPI::ViWidthChanged(); +} + +// TODO +EXPORT void CALL ReadScreen2(void *dest, int *width, int *height, int bFront) +{ + LOG("API WRAPPER:\t ReadScreen2") + //*width = 800; + //*height = 600; +} + +// TODO +EXPORT void CALL SetRenderingCallback(void (*callback)(int)) +{ + LOG("API WRAPPER:\t SetRenderingCallback") +} + +// IMPLEMENT LATER? +EXPORT void CALL FBRead(uint32 addr) +{ + LOG("API WRAPPER:\t FBRead") +} + +// IMPLEMENT LATER? +EXPORT void CALL FBWrite(uint32 addr, uint32 size) +{ + LOG("API WRAPPER:\t FBWrite") +} + +// ??? +EXPORT void CALL FBGetFrameBufferInfo(void *p) +{ + LOG("API WRAPPER:\t FBGetFrameBufferInfo") + //FrameBufferInfo * pinfo = (FrameBufferInfo *)p; +} + + + +/* Simple Window code */ + +HINSTANCE inj_hModule; //Injected Modules Handle + +//WndProc for the new window +LRESULT CALLBACK DLLWindowProc (HWND, UINT, WPARAM, LPARAM); + +//Register our windows Class +BOOL RegisterDLLWindowClass(char szClassName[]) +{ + WNDCLASSEX wc; + + ZeroMemory(&wc, sizeof(WNDCLASSEX)); + + wc.cbSize = sizeof (WNDCLASSEX); + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = DLLWindowProc; + wc.hInstance = inj_hModule; + wc.hCursor = LoadCursor (NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH) COLOR_WINDOW; + wc.lpszClassName = szClassName; + + if (!RegisterClassEx (&wc)) + return 0; +} + +//The new thread +DWORD WINAPI ThreadProc( LPVOID lpParam ) +{ + MSG messages; + char *pString = (char *)(lpParam); + RegisterDLLWindowClass("InjectedDLLWindowClass"); + hWnd_jabo = CreateWindowEx (0, "InjectedDLLWindowClass", pString, WS_OVERLAPPEDWINDOW, 300, 300, 400, 300, NULL, NULL,inj_hModule, NULL ); + ShowWindow (hWnd_jabo, SW_SHOWNORMAL); + while (GetMessage (&messages, NULL, 0, 0)) + { + TranslateMessage(&messages); + DispatchMessage(&messages); + } + return 1; +} + +//Our new windows proc +LRESULT CALLBACK DLLWindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_COMMAND: + break; + case WM_DESTROY: + PostQuitMessage (0); + break; + default: + return DefWindowProc (hwnd, message, wParam, lParam); + } + return 0; +} + +BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call,LPVOID lpReserved) +{ + if(ul_reason_for_call==DLL_PROCESS_ATTACH) { + inj_hModule = hModule; + CreateThread(0, NULL, ThreadProc, (LPVOID)"Window Title", NULL, NULL); + } + return TRUE; +} diff --git a/libmupen64plus/mupen64plus-video-jabo/main.h b/libmupen64plus/mupen64plus-video-jabo/main.h new file mode 100644 index 0000000000..7de00f283f --- /dev/null +++ b/libmupen64plus/mupen64plus-video-jabo/main.h @@ -0,0 +1,9 @@ +/* version info */ +#define PLUGIN_NAME "Jabo Direct3D8 wrapper for Mupen64Plus" +#define PLUGIN_VERSION 0x020000 +#define VIDEO_PLUGIN_API_VERSION 0x020200 +#define CONFIG_API_VERSION 0x020000 +#define VIDEXT_API_VERSION 0x030000 +#define CONFIG_PARAM_VERSION 1.00 + +#define VERSION_PRINTF_SPLIT(x) (((x) >> 16) & 0xffff), (((x) >> 8) & 0xff), ((x) & 0xff) \ No newline at end of file diff --git a/libmupen64plus/mupen64plus-video-jabo/mupen64plus-video-jabo/mupen64plus-video-jabo.vcxproj b/libmupen64plus/mupen64plus-video-jabo/mupen64plus-video-jabo/mupen64plus-video-jabo.vcxproj new file mode 100644 index 0000000000..0cd81ba0aa --- /dev/null +++ b/libmupen64plus/mupen64plus-video-jabo/mupen64plus-video-jabo/mupen64plus-video-jabo.vcxproj @@ -0,0 +1,103 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {0C220B26-3D4D-431D-B829-CADE6508A771} + Win32Proj + mupen64plusvideojabo + + + + DynamicLibrary + true + v100 + MultiByte + + + DynamicLibrary + false + v100 + true + MultiByte + + + + + + + + + + + + + false + $(SolutionDir)..\..\..\..\output\dll\ + true + + + $(SolutionDir)..\..\..\..\output\dll\ + true + + + + Level3 + Disabled + true + false + ..\..\mupen64plus-core\src\api;..\..\mupen64plus-win32-deps\SDL-1.2.14\include;%(AdditionalIncludeDirectories) + WIN32;DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + + + true + + + + + + + + + Level3 + MaxSpeed + + + false + ..\..\mupen64plus-core\src\api;..\..\mupen64plus-win32-deps\SDL-1.2.14\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + + true + + + true + true + true + ..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDL.lib;%(AdditionalDependencies) + Windows + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libmupen64plus/mupen64plus-video-jabo/typedefs.h b/libmupen64plus/mupen64plus-video-jabo/typedefs.h new file mode 100644 index 0000000000..c099a71055 --- /dev/null +++ b/libmupen64plus/mupen64plus-video-jabo/typedefs.h @@ -0,0 +1,17 @@ +#ifndef _TYPEDEFS_H_ +#define _TYPEDEFS_H_ + +#define uchar unsigned char +#define uint16 unsigned short +#define uint32 unsigned int +#define uint64 unsigned long long + +typedef unsigned char uint8; + +typedef signed char s8; +typedef int s32; +typedef unsigned int u32; +typedef unsigned char u8; + +#endif +