mirror of
https://github.com/libretro/RetroArch.git
synced 2024-10-07 22:33:27 +00:00
(360) Video gets inited before SSNES starts in preparation for XUI
This commit is contained in:
parent
a4dd8bdf30
commit
e46f09c3b1
@ -17,8 +17,11 @@
|
||||
*/
|
||||
|
||||
#include <xtl.h>
|
||||
#include <xui.h>
|
||||
#include <xuiapp.h>
|
||||
#include <stddef.h>
|
||||
#include <xbdm.h>
|
||||
#include "xdk360_video.h"
|
||||
|
||||
int ssnes_main(int argc, char *argv[]);
|
||||
|
||||
@ -31,6 +34,8 @@ int main(int argc, char *argv[])
|
||||
//in a different way
|
||||
DmMapDevkitDrive();
|
||||
|
||||
xdk360_video_init();
|
||||
|
||||
char arg1[] = "ssnes";
|
||||
char arg2[] = "e:\\roms\\mario.sfc";
|
||||
char arg3[] = "-v";
|
||||
@ -38,5 +43,7 @@ int main(int argc, char *argv[])
|
||||
char arg5[] = "e:\\roms\\ssnes.cfg";
|
||||
char *argv_[] = { arg1, arg2, arg3, arg4, arg5, NULL };
|
||||
return ssnes_main(sizeof(argv_) / sizeof(argv_[0]) - 1, argv_);
|
||||
|
||||
xdk360_video_deinit();
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include <xtl.h>
|
||||
|
||||
#include "../driver.h"
|
||||
|
||||
#include "xdk360_video.h"
|
||||
#include "../general.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -65,6 +67,8 @@ typedef struct DrawVerticeFormats
|
||||
} DrawVerticeFormats;
|
||||
|
||||
static bool g_quitting;
|
||||
unsigned g_frame_count;
|
||||
void *g_d3d;
|
||||
|
||||
typedef struct xdk360_video
|
||||
{
|
||||
@ -75,12 +79,14 @@ typedef struct xdk360_video
|
||||
IDirect3DVertexDeclaration9* pVertexDecl;
|
||||
IDirect3DVertexBuffer9* vertex_buf;
|
||||
IDirect3DTexture9* lpTexture;
|
||||
unsigned frame_count;
|
||||
unsigned last_width, last_height;
|
||||
} xdk360_video_t;
|
||||
|
||||
static void xdk360_gfx_free(void *data)
|
||||
static void xdk360_gfx_free(void * data)
|
||||
{
|
||||
if (g_d3d)
|
||||
return;
|
||||
|
||||
xdk360_video_t *vid = (xdk360_video_t*)data;
|
||||
if (!vid)
|
||||
return;
|
||||
@ -98,6 +104,9 @@ static void xdk360_gfx_free(void *data)
|
||||
|
||||
static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
||||
{
|
||||
if (g_d3d)
|
||||
return g_d3d;
|
||||
|
||||
xdk360_video_t *vid = (xdk360_video_t*)calloc(1, sizeof(xdk360_video_t));
|
||||
if (!vid)
|
||||
return NULL;
|
||||
@ -211,7 +220,7 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
|
||||
unsigned width, unsigned height, unsigned pitch, const char *msg)
|
||||
{
|
||||
xdk360_video_t *vid = (xdk360_video_t*)data;
|
||||
vid->frame_count++;
|
||||
g_frame_count++;
|
||||
|
||||
vid->xdk360_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
0xff000000, 1.0f, 0);
|
||||
@ -291,6 +300,29 @@ static bool xdk360_gfx_focus(void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
// 360 needs a working graphics stack before SSNESeven starts.
|
||||
// To deal with this main.c,
|
||||
// the top level module owns the instance, and is created beforehand.
|
||||
// When SSNES gets around to init it, it is already allocated.
|
||||
// When SSNES wants to free it, it is ignored.
|
||||
void xdk360_video_init(void)
|
||||
{
|
||||
video_info_t video_info = {0};
|
||||
// Might have to supply correct values here.
|
||||
video_info.vsync = true;
|
||||
video_info.force_aspect = false;
|
||||
video_info.smooth = true;
|
||||
video_info.input_scale = 2;
|
||||
g_d3d = xdk360_gfx_init(&video_info, NULL, NULL);
|
||||
}
|
||||
|
||||
void xdk360_video_deinit(void)
|
||||
{
|
||||
void *data = g_d3d;
|
||||
g_d3d = NULL;
|
||||
xdk360_gfx_free(data);
|
||||
}
|
||||
|
||||
const video_driver_t video_xdk360 = {
|
||||
xdk360_gfx_init,
|
||||
xdk360_gfx_frame,
|
||||
|
27
360/xdk360_video.h
Normal file
27
360/xdk360_video.h
Normal file
@ -0,0 +1,27 @@
|
||||
/* SSNES - A Super Nintendo Entertainment System (SNES) Emulator frontend for libsnes.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - Daniel De Matteis
|
||||
*
|
||||
* Some code herein may be based on code found in BSNES.
|
||||
*
|
||||
* SSNES is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* SSNES is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with SSNES.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _XDK360_VIDEO_H
|
||||
#define _XDK360_VIDEO_H
|
||||
|
||||
void xdk360_video_init(void);
|
||||
void xdk360_video_deinit(void);
|
||||
|
||||
extern void *g_d3d;
|
||||
|
||||
#endif
|
@ -112,7 +112,7 @@
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
|
||||
<AdditionalDependencies>xapilibd.lib;d3d9d.lib;d3dx9d.lib;xgraphicsd.lib;xboxkrnl.lib;xnetd.lib;xaudiod2.lib;xactd3.lib;x3daudiod.lib;xmcored.lib;xbdm.lib;vcompd.lib;$(SolutionDir)\Debug\snes9x-next-360-msvc2010.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>xapilibd.lib;d3d9d.lib;d3dx9d.lib;xgraphicsd.lib;xboxkrnl.lib;xnetd.lib;xaudiod2.lib;xactd3.lib;x3daudiod.lib;xmcored.lib;xbdm.lib;vcompd.lib;xuirun.lib;xuirender.lib;$(SolutionDir)\Debug\snes9x-next-360-msvc2010.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<Deploy>
|
||||
<DeploymentType>CopyToHardDrive</DeploymentType>
|
||||
@ -207,7 +207,7 @@
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
|
||||
<SetChecksum>true</SetChecksum>
|
||||
<AdditionalDependencies>xapilib.lib;d3d9.lib;d3dx9.lib;xgraphics.lib;xboxkrnl.lib;xnet.lib;xaudio2.lib;xact3.lib;x3daudio.lib;xmcore.lib;vcomp.lib;xbdm.lib;$(SolutionDir)\Release\snes9x-next-360-msvc2010.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>xapilib.lib;d3d9.lib;d3dx9.lib;xgraphics.lib;xboxkrnl.lib;xnet.lib;xaudio2.lib;xact3.lib;x3daudio.lib;xmcore.lib;vcomp.lib;xbdm.lib;xuirun.lib;xuirender.lib;$(SolutionDir)\Release\snes9x-next-360-msvc2010.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<Deploy>
|
||||
<DeploymentType>CopyToHardDrive</DeploymentType>
|
||||
|
Loading…
Reference in New Issue
Block a user