This commit is contained in:
Rick Gibbed 2013-05-26 22:46:45 -07:00
parent 9f06645e75
commit fe9cb1cddb
4 changed files with 189 additions and 0 deletions

View File

@ -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 <xenia/kernel/modules/xam/xam_video.h>
#include <xenia/kernel/shim_utils.h>
#include <xenia/kernel/modules/xam/xam_private.h>
#include <xenia/kernel/modules/xam/xam_state.h>
#include <xenia/kernel/modules/modules.h>
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);
}

View File

@ -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 <xenia/common.h>
#include <xenia/core.h>
#include <xenia/kernel/xbox.h>
namespace xe {
namespace kernel {
namespace xam {
} // namespace xam
} // namespace kernel
} // namespace xe
#endif // XENIA_KERNEL_MODULES_XAM_VIDEO_H_

View File

@ -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 <xenia/kernel/modules/xboxkrnl/xboxkrnl_video.h>
#include <xenia/kernel/shim_utils.h>
#include <xenia/kernel/modules/xboxkrnl/kernel_state.h>
#include <xenia/kernel/modules/xboxkrnl/xboxkrnl_private.h>
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);
}

View File

@ -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 <xenia/common.h>
#include <xenia/core.h>
#include <xenia/kernel/xbox.h>
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_