From fe9cb1cddba189b424076769c88f9cac442e7d5e Mon Sep 17 00:00:00 2001 From: Rick Gibbed Date: Sun, 26 May 2013 22:46:45 -0700 Subject: [PATCH] Oops. --- src/xenia/kernel/modules/xam/xam_video.cc | 44 ++++++++++++ src/xenia/kernel/modules/xam/xam_video.h | 31 +++++++++ .../kernel/modules/xboxkrnl/xboxkrnl_video.cc | 67 +++++++++++++++++++ .../kernel/modules/xboxkrnl/xboxkrnl_video.h | 47 +++++++++++++ 4 files changed, 189 insertions(+) create mode 100644 src/xenia/kernel/modules/xam/xam_video.cc create mode 100644 src/xenia/kernel/modules/xam/xam_video.h create mode 100644 src/xenia/kernel/modules/xboxkrnl/xboxkrnl_video.cc create mode 100644 src/xenia/kernel/modules/xboxkrnl/xboxkrnl_video.h diff --git a/src/xenia/kernel/modules/xam/xam_video.cc b/src/xenia/kernel/modules/xam/xam_video.cc new file mode 100644 index 000000000..fb8365335 --- /dev/null +++ b/src/xenia/kernel/modules/xam/xam_video.cc @@ -0,0 +1,44 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include + +#include +#include +#include + +#include + + +using namespace xe; +using namespace xe::kernel; +using namespace xe::kernel::xam; + + +namespace xe { +namespace kernel { +namespace xam { + + +SHIM_CALL XGetVideoMode_shim( + xe_ppc_state_t* ppc_state, XamState* state) { + xe::kernel::xboxkrnl::X_VIDEO_MODE *video_mode = (xe::kernel::xboxkrnl::X_VIDEO_MODE*)SHIM_MEM_ADDR(SHIM_GET_ARG_32(0)); + xeVdQueryVideoMode(video_mode, true); +} + + +} // namespace xam +} // namespace kernel +} // namespace xe + + +void xe::kernel::xam::RegisterVideoExports( + ExportResolver* export_resolver, XamState* state) { + SHIM_SET_MAPPING("xam.xex", XGetVideoMode, state); +} diff --git a/src/xenia/kernel/modules/xam/xam_video.h b/src/xenia/kernel/modules/xam/xam_video.h new file mode 100644 index 000000000..eaa300d53 --- /dev/null +++ b/src/xenia/kernel/modules/xam/xam_video.h @@ -0,0 +1,31 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_KERNEL_MODULES_XAM_VIDEO_H_ +#define XENIA_KERNEL_MODULES_XAM_VIDEO_H_ + +#include +#include + +#include + + +namespace xe { +namespace kernel { +namespace xam { + + + + +} // namespace xam +} // namespace kernel +} // namespace xe + + +#endif // XENIA_KERNEL_MODULES_XAM_VIDEO_H_ diff --git a/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_video.cc b/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_video.cc new file mode 100644 index 000000000..9dd849629 --- /dev/null +++ b/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_video.cc @@ -0,0 +1,67 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include + +#include +#include +#include + + +using namespace xe; +using namespace xe::kernel; +using namespace xe::kernel::xboxkrnl; + + +namespace xe { +namespace kernel { +namespace xboxkrnl { + + +VOID xeVdQueryVideoMode(X_VIDEO_MODE *video_mode, bool swap) { + if (video_mode == NULL) { + return; + } + + // TODO: get info from actual display + video_mode->display_width = 1280; + video_mode->display_height = 720; + video_mode->is_interlaced = 0; + video_mode->is_widescreen = 1; + video_mode->is_hi_def = 1; + video_mode->refresh_rate = 60.0f; + video_mode->video_standard = 1; + + if (swap) { + video_mode->display_width = XESWAP32BE(video_mode->display_width); + video_mode->display_height = XESWAP32BE(video_mode->display_height); + video_mode->is_interlaced = XESWAP32BE(video_mode->is_interlaced); + video_mode->is_widescreen = XESWAP32BE(video_mode->is_widescreen); + video_mode->is_hi_def = XESWAP32BE(video_mode->is_hi_def); + video_mode->refresh_rate = XESWAPF32BE(video_mode->refresh_rate); + video_mode->video_standard = XESWAP32BE(video_mode->video_standard); + } +} + +SHIM_CALL VdQueryVideoMode_shim( + xe_ppc_state_t* ppc_state, KernelState* state) { + X_VIDEO_MODE *video_mode = (X_VIDEO_MODE*)SHIM_MEM_ADDR(SHIM_GET_ARG_32(0)); + xeVdQueryVideoMode(video_mode, true); +} + + +} // namespace xboxkrnl +} // namespace kernel +} // namespace xe + + +void xe::kernel::xboxkrnl::RegisterVideoExports( + ExportResolver* export_resolver, KernelState* state) { + SHIM_SET_MAPPING("xboxkrnl.exe", VdQueryVideoMode, state); +} diff --git a/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_video.h b/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_video.h new file mode 100644 index 000000000..706197817 --- /dev/null +++ b/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_video.h @@ -0,0 +1,47 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2013 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_KERNEL_MODULES_XBOXKRNL_VIDEO_H_ +#define XENIA_KERNEL_MODULES_XBOXKRNL_VIDEO_H_ + +#include +#include + +#include + + +namespace xe { +namespace kernel { +namespace xboxkrnl { + +// http://ffplay360.googlecode.com/svn/trunk/Common/XTLOnPC.h +#pragma pack(push, 1) +typedef struct { + uint32_t display_width; + uint32_t display_height; + uint32_t is_interlaced; + uint32_t is_widescreen; + uint32_t is_hi_def; + float refresh_rate; + uint32_t video_standard; + uint32_t Reserved[5]; +} +X_VIDEO_MODE; +#pragma pack(pop) + +XEASSERTSTRUCTSIZE(X_VIDEO_MODE, 48); + +VOID xeVdQueryVideoMode(X_VIDEO_MODE *video_mode, bool swap); + +} // namespace xboxkrnl +} // namespace kernel +} // namespace xe + + +#endif // XENIA_KERNEL_MODULES_XBOXKRNL_VIDEO_H_