mirror of
https://github.com/libretro/RetroArch
synced 2025-01-26 09:35:21 +00:00
(360) More work on XUI + fixed a bug in input code
This commit is contained in:
parent
6614e4ef92
commit
aa32810151
@ -41,6 +41,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
xdk360_video_init();
|
||||
|
||||
menu_init();
|
||||
//menu_loop();
|
||||
|
||||
char arg1[] = "ssnes";
|
||||
char arg2[] = "d:\\roms\\mario.sfc";
|
||||
char arg3[] = "-v";
|
||||
|
89
360/menu.cpp
89
360/menu.cpp
@ -20,7 +20,8 @@
|
||||
#include "xdk360_video.h"
|
||||
#include "menu.h"
|
||||
|
||||
CSSNES app;
|
||||
CSSNES app;
|
||||
HXUIOBJ hMainScene;
|
||||
|
||||
/* Register custom classes */
|
||||
HRESULT CSSNES::RegisterXuiClasses (void)
|
||||
@ -35,72 +36,13 @@ HRESULT CSSNES::UnregisterXuiClasses (void)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT APIENTRY XuiTextureLoader(IXuiDevice *pDevice, LPCWSTR szFileName, XUIImageInfo *pImageInfo, IDirect3DTexture9 **ppTex)
|
||||
{
|
||||
CONST BYTE *pbTextureData = 0;
|
||||
UINT cbTextureData = 0;
|
||||
HXUIRESOURCE hResource = 0;
|
||||
BOOL bIsMemoryResource = FALSE;
|
||||
HRESULT hr;
|
||||
|
||||
|
||||
hr = XuiResourceOpen(szFileName, &hResource, &bIsMemoryResource);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (bIsMemoryResource)
|
||||
{
|
||||
hr = XuiResourceGetBuffer(hResource, &pbTextureData);
|
||||
if (FAILED(hr))
|
||||
goto cleanup;
|
||||
cbTextureData = XuiResourceGetTotalSize(hResource);
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = XuiResourceRead(hResource, NULL, 0, &cbTextureData);
|
||||
if (FAILED(hr))
|
||||
goto cleanup;
|
||||
|
||||
pbTextureData = (BYTE *)XuiAlloc(cbTextureData);
|
||||
if (pbTextureData == 0)
|
||||
{
|
||||
hr = E_OUTOFMEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
hr = XuiResourceRead(hResource, (BYTE*)pbTextureData, cbTextureData, &cbTextureData);
|
||||
if (FAILED(hr))
|
||||
goto cleanup;
|
||||
|
||||
XuiResourceClose(hResource);
|
||||
hResource = 0;
|
||||
|
||||
}
|
||||
|
||||
//Format specific code should be added here to initialize pImageInfo
|
||||
// and to create an IDirect3DTexture9 interface.
|
||||
|
||||
|
||||
cleanup:
|
||||
|
||||
if (bIsMemoryResource && hResource != 0)
|
||||
XuiResourceReleaseBuffer(hResource, pbTextureData);
|
||||
else
|
||||
XuiFree((LPVOID)pbTextureData);
|
||||
|
||||
if (hResource != 0)
|
||||
XuiResourceClose(hResource);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
int menu_init (void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||
|
||||
hr = app.InitShared(vid->xdk360_render_device, &vid->d3dpp, XuiTextureLoader);
|
||||
hr = app.InitShared(vid->xdk360_render_device, &vid->d3dpp, XuiPNGTextureLoader);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
@ -116,5 +58,30 @@ int menu_init (void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
app.LoadSkin( L"file://game:/media/ssnes.xzp#media\\ssnes_main_skin.xur");
|
||||
XuiSceneCreate( L"file://game:/media/ssnes.xzpmedia\\", L"ssnes_main.xur", NULL, &hMainScene);
|
||||
XuiSceneNavigateFirst( app.GetRootObj(), hMainScene, XUSER_INDEX_FOCUS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menu_loop(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||
|
||||
do
|
||||
{
|
||||
vid->xdk360_render_device->Clear(0, NULL,
|
||||
D3DCLEAR_TARGET | D3DCLEAR_STENCIL | D3DCLEAR_ZBUFFER,
|
||||
D3DCOLOR_ARGB(255, 32, 32, 64), 1.0, 0);
|
||||
|
||||
app.RunFrame(); /* Update XUI */
|
||||
hr = app.Render(); /* Render XUI */
|
||||
hr = XuiTimersRun(); /* Update XUI timers */
|
||||
|
||||
/* Present the frame */
|
||||
vid->xdk360_render_device->Present(NULL, NULL, NULL, NULL);
|
||||
|
||||
}while(1);
|
||||
}
|
@ -16,10 +16,11 @@ protected:
|
||||
class CSSNESMain: public CXuiSceneImpl
|
||||
{
|
||||
public:
|
||||
XUI_IMPLEMENT_CLASS(CSSNESMain, L"CSSNESMain", XUI_CLASS_SCENE)
|
||||
XUI_IMPLEMENT_CLASS(CSSNESMain, L"SSNESMain", XUI_CLASS_SCENE)
|
||||
};
|
||||
|
||||
int menu_init();
|
||||
int menu_init (void);
|
||||
void menu_loop (void);
|
||||
|
||||
extern CSSNES app;
|
||||
|
||||
|
@ -22,14 +22,14 @@
|
||||
#include "../driver.h"
|
||||
#include "../libsnes.hpp"
|
||||
|
||||
static XINPUT_STATE state[5];
|
||||
static XINPUT_STATE state[4];
|
||||
|
||||
static void xdk360_input_poll(void *data)
|
||||
{
|
||||
(void)data;
|
||||
ZeroMemory(&state, sizeof(XINPUT_STATE));
|
||||
|
||||
for (unsigned i = 0; i < 5; i++)
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
XInputGetState(i, &state[i]);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user