mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 08:30:16 +00:00
(360) Added screen orientation options - might want to refactor
this later on
This commit is contained in:
parent
a3351e17f1
commit
8823b47a05
17
360/main.c
17
360/main.c
@ -166,6 +166,7 @@ static void set_default_settings (void)
|
||||
g_console.initialize_ssnes_enable = false;
|
||||
g_console.emulator_initialized = 0;
|
||||
g_console.mode_switch = MODE_MENU;
|
||||
g_console.screen_orientation = ORIENTATION_NORMAL;
|
||||
strlcpy(g_console.default_rom_startup_dir, "game:", sizeof(g_console.default_rom_startup_dir));
|
||||
|
||||
//g_extern
|
||||
@ -313,6 +314,7 @@ static void init_settings (bool load_libsnes_path)
|
||||
// g_console
|
||||
CONFIG_GET_BOOL_CONSOLE(throttle_enable, "throttle_enable");
|
||||
CONFIG_GET_STRING_CONSOLE(default_rom_startup_dir, "default_rom_startup_dir");
|
||||
CONFIG_GET_INT_CONSOLE(screen_orientation, "screen_orientation");
|
||||
|
||||
// g_extern
|
||||
CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
|
||||
@ -342,6 +344,7 @@ static void save_settings (void)
|
||||
// g_console
|
||||
config_set_string(conf, "default_rom_startup_dir", g_console.default_rom_startup_dir);
|
||||
config_set_bool(conf, "throttle_enable", g_console.throttle_enable);
|
||||
config_set_int(conf, "screen_orientation", g_console.screen_orientation);
|
||||
|
||||
// g_extern
|
||||
config_set_int(conf, "state_slot", g_extern.state_slot);
|
||||
@ -355,6 +358,8 @@ static void save_settings (void)
|
||||
|
||||
static void get_environment_settings (void)
|
||||
{
|
||||
DWORD ret;
|
||||
|
||||
//for devkits only, we will need to mount all partitions for retail
|
||||
//in a different way
|
||||
//DmMapDevkitDrive();
|
||||
@ -371,14 +376,20 @@ static void get_environment_settings (void)
|
||||
Mounted[DEVICE_MEMORY_ONBOARD] = Mount(DEVICE_MEMORY_ONBOARD,"OnBoardMU:");
|
||||
Mounted[DEVICE_CDROM0] = Mount(DEVICE_CDROM0,"Dvd:");
|
||||
|
||||
int result_filecache = XSetFileCacheSize(0x100000);
|
||||
ret = XSetFileCacheSize(0x100000);
|
||||
|
||||
if(result_filecache != TRUE)
|
||||
if(ret != TRUE)
|
||||
{
|
||||
SSNES_ERR("Couldn't change number of bytes reserved for file system cache.\n");
|
||||
}
|
||||
|
||||
XFileCacheInit(XFILECACHE_CLEAR_ALL, 0x100000, XFILECACHE_DEFAULT_THREAD, 0, 1);
|
||||
ret = XFileCacheInit(XFILECACHE_CLEAR_ALL, 0x100000, XFILECACHE_DEFAULT_THREAD, 0, 1);
|
||||
|
||||
if(ret != ERROR_SUCCESS)
|
||||
{
|
||||
SSNES_ERR("File cache could not be initialized.\n");
|
||||
}
|
||||
|
||||
XFlushUtilityDrive();
|
||||
//unsigned long result = XMountUtilityDriveEx(XMOUNTUTILITYDRIVE_FORMAT0,8192, 0);
|
||||
|
||||
|
38
360/menu.cpp
38
360/menu.cpp
@ -147,6 +147,21 @@ HRESULT CSSNESQuickMenu::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
|
||||
GetChildById(L"XuiBackButton", &m_back);
|
||||
|
||||
m_quickmenulist.SetText(MENU_ITEM_HARDWARE_FILTERING, set_filter_element(g_settings.video.smooth));
|
||||
switch(g_console.screen_orientation)
|
||||
{
|
||||
case ORIENTATION_NORMAL:
|
||||
m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, L"Orientation: Normal");
|
||||
break;
|
||||
case ORIENTATION_VERTICAL:
|
||||
m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, L"Orientation: Vertical");
|
||||
break;
|
||||
case ORIENTATION_FLIPPED:
|
||||
m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, L"Orientation: Flipped");
|
||||
break;
|
||||
case ORIENTATION_FLIPPED_ROTATED:
|
||||
m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, L"Orientation: Flipped Rotated");
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@ -183,6 +198,29 @@ HRESULT CSSNESQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled )
|
||||
case MENU_ITEM_OVERSCAN_AMOUNT:
|
||||
break;
|
||||
case MENU_ITEM_ORIENTATION:
|
||||
switch(g_console.screen_orientation)
|
||||
{
|
||||
case ORIENTATION_NORMAL:
|
||||
g_console.screen_orientation = ORIENTATION_VERTICAL;
|
||||
m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, L"Orientation: Vertical");
|
||||
g_console.force_resize_enable = true;
|
||||
break;
|
||||
case ORIENTATION_VERTICAL:
|
||||
g_console.screen_orientation = ORIENTATION_FLIPPED;
|
||||
m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, L"Orientation: Flipped");
|
||||
g_console.force_resize_enable = true;
|
||||
break;
|
||||
case ORIENTATION_FLIPPED:
|
||||
g_console.screen_orientation = ORIENTATION_FLIPPED_ROTATED;
|
||||
m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, L"Orientation: Flipped Rotated");
|
||||
g_console.force_resize_enable = true;
|
||||
break;
|
||||
case ORIENTATION_FLIPPED_ROTATED:
|
||||
g_console.screen_orientation = ORIENTATION_NORMAL;
|
||||
m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, L"Orientation: Normal");
|
||||
g_console.force_resize_enable = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MENU_ITEM_RESIZE_MODE:
|
||||
break;
|
||||
|
@ -32,6 +32,15 @@ enum
|
||||
MODE_EXIT
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ORIENTATION_NORMAL,
|
||||
ORIENTATION_VERTICAL,
|
||||
ORIENTATION_FLIPPED,
|
||||
ORIENTATION_FLIPPED_ROTATED,
|
||||
ORIENTATION_END
|
||||
};
|
||||
|
||||
enum {
|
||||
MENU_ITEM_LOAD_STATE = 0,
|
||||
MENU_ITEM_SAVE_STATE,
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "xdk360_video.h"
|
||||
#include "../general.h"
|
||||
#include "../message.h"
|
||||
#include "shared.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
@ -62,12 +63,6 @@ static const char* g_strVertexShaderProgram =
|
||||
" return output; "
|
||||
" } ";
|
||||
|
||||
typedef struct DrawVerticeFormats
|
||||
{
|
||||
float x, y;
|
||||
float u, v;
|
||||
} DrawVerticeFormats;
|
||||
|
||||
static bool g_quitting;
|
||||
static bool g_first_msg;
|
||||
unsigned g_frame_count;
|
||||
@ -227,7 +222,7 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
|
||||
vid->xdk360_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
0xff000000, 1.0f, 0);
|
||||
|
||||
if (vid->last_width != width || vid->last_height != height)
|
||||
if (vid->last_width != width || vid->last_height != height || g_console.force_resize_enable)
|
||||
{
|
||||
D3DLOCKED_RECT d3dlr;
|
||||
if (SUCCEEDED(vid->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK)))
|
||||
@ -238,20 +233,61 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
|
||||
|
||||
float tex_w = width / 512.0f;
|
||||
float tex_h = height / 512.0f;
|
||||
const DrawVerticeFormats verts[] = {
|
||||
{ -1.0f, -1.0f, 0.0f, tex_h },
|
||||
{ 1.0f, -1.0f, tex_w, tex_h },
|
||||
{ -1.0f, 1.0f, 0.0f, 0.0f },
|
||||
{ 1.0f, 1.0f, tex_w, 0.0f },
|
||||
|
||||
//normal
|
||||
const DrawVerticeFormats vertexes_normal[] = {
|
||||
{ -1.0f, -1.0f, 0.0f, tex_h },
|
||||
{ 1.0f, -1.0f, tex_w, tex_h },
|
||||
{ -1.0f, 1.0f, 0.0f, 0.0f },
|
||||
{ 1.0f, 1.0f, tex_w, 0.0f },
|
||||
};
|
||||
|
||||
//vertical
|
||||
const DrawVerticeFormats vertexes_vertical[] = {
|
||||
{ 1.0f, -1.0f, tex_w, 0.0f },
|
||||
{ 1.0f, 1.0f, 0.0f, 0.0f },
|
||||
{ -1.0f, -1.0f, tex_w, tex_h },
|
||||
{ -1.0f, 1.0f, 0.0f, tex_h },
|
||||
};
|
||||
|
||||
//flipped
|
||||
const DrawVerticeFormats vertexes_flipped[] = {
|
||||
{ -1.0f, 1.0f, 0.0f, tex_h },
|
||||
{ 1.0f, 1.0f, tex_w, tex_h },
|
||||
{ -1.0f, -1.0f, 0.0f, 0.0f },
|
||||
{ 1.0f, -1.0f, tex_w, 0.0f },
|
||||
};
|
||||
|
||||
// flipped vertical
|
||||
const DrawVerticeFormats vertexes_flipped_vertical[] = {
|
||||
{ -1.0f, -1.0f, 0.0f, 0.0f },
|
||||
{ -1.0f, 1.0f, tex_w, 0.0f },
|
||||
{ 1.0f, -1.0f, 0.0f, tex_h },
|
||||
{ 1.0f, 1.0f, tex_w, tex_h },
|
||||
};
|
||||
|
||||
void *verts_ptr;
|
||||
vid->vertex_buf->Lock(0, 0, &verts_ptr, 0);
|
||||
memcpy(verts_ptr, verts, sizeof(verts));
|
||||
switch(g_console.screen_orientation)
|
||||
{
|
||||
case ORIENTATION_NORMAL:
|
||||
memcpy(verts_ptr, vertexes_normal, sizeof(vertexes_normal));
|
||||
break;
|
||||
case ORIENTATION_VERTICAL:
|
||||
memcpy(verts_ptr, vertexes_vertical, sizeof(vertexes_vertical));
|
||||
break;
|
||||
case ORIENTATION_FLIPPED:
|
||||
memcpy(verts_ptr, vertexes_flipped, sizeof(vertexes_flipped));
|
||||
break;
|
||||
case ORIENTATION_FLIPPED_ROTATED:
|
||||
memcpy(verts_ptr, vertexes_flipped_vertical, sizeof(vertexes_flipped_vertical));
|
||||
break;
|
||||
}
|
||||
vid->vertex_buf->Unlock();
|
||||
|
||||
vid->last_width = width;
|
||||
vid->last_height = height;
|
||||
g_console.force_resize_enable = false;
|
||||
}
|
||||
|
||||
D3DLOCKED_RECT d3dlr;
|
||||
|
@ -33,6 +33,12 @@ typedef struct {
|
||||
#define DFONT_MAX 4096
|
||||
#define PRIM_FVF (D3DFVF_XYZRHW | D3DFVF_TEX1)
|
||||
|
||||
typedef struct DrawVerticeFormats
|
||||
{
|
||||
float x, y;
|
||||
float u, v;
|
||||
} DrawVerticeFormats;
|
||||
|
||||
typedef struct xdk360_video
|
||||
{
|
||||
bool block_swap;
|
||||
|
Loading…
Reference in New Issue
Block a user