mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
commit
60b8be65c2
@ -26,7 +26,9 @@ OBJ = retroarch.o \
|
||||
gfx/scaler/scaler.o \
|
||||
gfx/scaler/pixconv.o \
|
||||
gfx/scaler/scaler_int.o \
|
||||
gfx/scaler/filter.o
|
||||
gfx/scaler/filter.o \
|
||||
gfx/state_tracker.o \
|
||||
gfx/image.o
|
||||
|
||||
JOBJ := conf/config_file.o \
|
||||
tools/retroarch-joyconfig.o \
|
||||
@ -139,7 +141,7 @@ ifeq ($(HAVE_RSOUND), 1)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_XML), 1)
|
||||
OBJ += gfx/shader_glsl.o gfx/image.o gfx/state_tracker.o cheats.o
|
||||
OBJ += gfx/shader_glsl.o cheats.o
|
||||
DEFINES += -Ilibxml2 -DHAVE_XML -DHAVE_GLSL
|
||||
LIBS += -lxml2 -liconv
|
||||
endif
|
||||
|
@ -42,17 +42,25 @@ namespace Monitor
|
||||
static HMONITOR last_hm;
|
||||
static HMONITOR all_hms[MAX_MONITORS];
|
||||
static unsigned num_mons;
|
||||
static unsigned cur_mon_id;
|
||||
}
|
||||
|
||||
namespace Callback
|
||||
{
|
||||
static bool quit = false;
|
||||
static D3DVideo *curD3D = nullptr;
|
||||
|
||||
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
LPCREATESTRUCT p_cs;
|
||||
p_cs = (LPCREATESTRUCT)lParam;
|
||||
curD3D = (D3DVideo *)p_cs->lpCreateParams;
|
||||
break;
|
||||
|
||||
case WM_SYSKEYDOWN:
|
||||
switch (wParam)
|
||||
{
|
||||
@ -66,6 +74,13 @@ namespace Callback
|
||||
quit = true;
|
||||
return 0;
|
||||
|
||||
case WM_SIZE:
|
||||
unsigned new_width, new_height;
|
||||
new_width = LOWORD(lParam);
|
||||
new_height = HIWORD(lParam);
|
||||
curD3D->resize(new_width, new_height);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
@ -83,7 +98,7 @@ void D3DVideo::init_base(const video_info_t &info)
|
||||
throw std::runtime_error("Failed to create D3D9 interface!");
|
||||
|
||||
if (FAILED(g_pD3D->CreateDevice(
|
||||
D3DADAPTER_DEFAULT,
|
||||
Monitor::cur_mon_id,
|
||||
D3DDEVTYPE_HAL,
|
||||
hWnd,
|
||||
D3DCREATE_HARDWARE_VERTEXPROCESSING,
|
||||
@ -98,7 +113,7 @@ void D3DVideo::make_d3dpp(const video_info_t &info, D3DPRESENT_PARAMETERS &d3dpp
|
||||
{
|
||||
std::memset(&d3dpp, 0, sizeof(d3dpp));
|
||||
|
||||
d3dpp.Windowed = true;
|
||||
d3dpp.Windowed = g_settings.video.windowed_fullscreen || !info.fullscreen;
|
||||
|
||||
d3dpp.PresentationInterval = info.vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
@ -282,7 +297,21 @@ RECT D3DVideo::monitor_rect()
|
||||
|
||||
unsigned fs_monitor = g_settings.video.monitor_index;
|
||||
if (fs_monitor && fs_monitor <= Monitor::num_mons && Monitor::all_hms[fs_monitor - 1])
|
||||
{
|
||||
hm_to_use = Monitor::all_hms[fs_monitor - 1];
|
||||
Monitor::cur_mon_id = fs_monitor - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(unsigned i=0;i<Monitor::num_mons;i++)
|
||||
{
|
||||
if(Monitor::all_hms[i]==hm_to_use)
|
||||
{
|
||||
Monitor::cur_mon_id = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MONITORINFOEX current_mon;
|
||||
std::memset(¤t_mon, 0, sizeof(current_mon));
|
||||
@ -293,7 +322,7 @@ RECT D3DVideo::monitor_rect()
|
||||
}
|
||||
|
||||
D3DVideo::D3DVideo(const video_info_t *info) :
|
||||
g_pD3D(nullptr), dev(nullptr), rotation(0), needs_restore(false)
|
||||
g_pD3D(nullptr), dev(nullptr), font(nullptr), rotation(0), needs_restore(false), cgCtx(nullptr)
|
||||
{
|
||||
gfx_set_dwm();
|
||||
|
||||
@ -312,9 +341,11 @@ D3DVideo::D3DVideo(const video_info_t *info) :
|
||||
RegisterClassEx(&windowClass);
|
||||
RECT mon_rect = monitor_rect();
|
||||
|
||||
unsigned full_x = info->width == 0 ? (mon_rect.right - mon_rect.left) : info->width;
|
||||
unsigned full_y = info->height == 0 ? (mon_rect.bottom - mon_rect.top) : info->height;
|
||||
RARCH_LOG("[D3D9]: Monitor size: %dx%d.\n", (int)mon_rect.right, (int)mon_rect.bottom);
|
||||
bool windowed_full = g_settings.video.windowed_fullscreen;
|
||||
|
||||
unsigned full_x = (windowed_full || info->width == 0) ? (mon_rect.right - mon_rect.left) : info->width;
|
||||
unsigned full_y = (windowed_full || info->height == 0) ? (mon_rect.bottom - mon_rect.top) : info->height;
|
||||
RARCH_LOG("[D3D9]: Monitor size: %dx%d.\n", (int)(mon_rect.right - mon_rect.left), (int)(mon_rect.bottom - mon_rect.top));
|
||||
|
||||
screen_width = info->fullscreen ? full_x : info->width;
|
||||
screen_height = info->fullscreen ? full_y : info->height;
|
||||
@ -327,7 +358,7 @@ D3DVideo::D3DVideo(const video_info_t *info) :
|
||||
RECT rect = {0};
|
||||
rect.right = screen_width;
|
||||
rect.bottom = screen_height;
|
||||
AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW & ~(WS_MAXIMIZEBOX | WS_THICKFRAME), FALSE);
|
||||
AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
|
||||
win_width = rect.right - rect.left;
|
||||
win_height = rect.bottom - rect.top;
|
||||
}
|
||||
@ -340,11 +371,11 @@ D3DVideo::D3DVideo(const video_info_t *info) :
|
||||
|
||||
hWnd = CreateWindowEx(0, "RetroArch", title.c_str(),
|
||||
info->fullscreen ?
|
||||
(WS_EX_TOPMOST | WS_POPUP) : WS_OVERLAPPEDWINDOW & ~(WS_MAXIMIZEBOX | WS_THICKFRAME),
|
||||
(WS_EX_TOPMOST | WS_POPUP) : WS_OVERLAPPEDWINDOW,
|
||||
info->fullscreen ? mon_rect.left : CW_USEDEFAULT,
|
||||
info->fullscreen ? mon_rect.top : CW_USEDEFAULT,
|
||||
win_width, win_height,
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
nullptr, nullptr, nullptr, this);
|
||||
|
||||
driver.display_type = RARCH_DISPLAY_WIN32;
|
||||
driver.video_display = 0;
|
||||
@ -965,6 +996,19 @@ void D3DVideo::update_title()
|
||||
}
|
||||
}
|
||||
|
||||
void D3DVideo::resize(unsigned new_width, unsigned new_height)
|
||||
{
|
||||
if(!dev)
|
||||
return;
|
||||
|
||||
if(new_width != video_info.width || new_height != video_info.height)
|
||||
{
|
||||
video_info.width = screen_width = new_width;
|
||||
video_info.height = screen_height = new_height;
|
||||
restore();
|
||||
}
|
||||
}
|
||||
|
||||
static void *d3d9_init(const video_info_t *info, const input_driver_t **input,
|
||||
void **input_data)
|
||||
{
|
||||
|
@ -46,6 +46,7 @@ class D3DVideo
|
||||
void set_rotation(unsigned rot);
|
||||
void viewport_info(rarch_viewport &vp);
|
||||
bool read_viewport(uint8_t *buffer);
|
||||
void resize(unsigned new_width, unsigned new_height);
|
||||
|
||||
private:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user