xenia-project/xenia

Convert old-style kernel convention to new-style convention

Open

#631 创建于 2016年11月19日

在 GitHub 查看
 (37 评论) (0 反应) (0 负责人)C++ (7,418 star) (1,077 fork)batch import
good first issuekernel

描述

Just rewrite exports using the old shim convention to the new convention.

xboxkrnl

  • xboxkrnl_audio.cc
  • xboxkrnl_audio_xma.cc
  • xboxkrnl_crypt.cc
  • xboxkrnl_debug.cc
  • xboxkrnl_error.cc
  • xboxkrnl_hal.cc
  • xboxkrnl_io.cc
  • xboxkrnl_memory.cc
  • xboxkrnl_misc.cc
  • xboxkrnl_modules.cc
  • xboxkrnl_ob.cc
  • xboxkrnl_rtl.cc
  • xboxkrnl_strings.cc
  • xboxkrnl_threading.cc
  • xboxkrnl_usbcam.cc
  • xboxkrnl_video.cc

xam

  • xam_avatar.cc
  • xam_content.cc
  • xam_info.cc
  • xam_input.cc
  • xam_msg.cc
  • xam_net.cc
  • xam_notify.cc
  • xam_ui.cc
  • xam_user.cc
  • xam_video.cc
  • xam_voice.cc

E.g. XAudioGetSpeakerConfig

SHIM_CALL XAudioGetSpeakerConfig_shim(PPCContext* ppc_context,
                                      KernelState* kernel_state) {
  uint32_t config_ptr = SHIM_GET_ARG_32(0);

  XELOGD("XAudioGetSpeakerConfig(%.8X)", config_ptr);

  SHIM_SET_MEM_32(config_ptr, 0x00010001);

  SHIM_SET_RETURN_32(X_ERROR_SUCCESS);
}

...

SHIM_SET_MAPPING("xboxkrnl.exe", XAudioGetSpeakerConfig, state);

Becomes

dword_result_t XAudioGetSpeakerConfig(lpdword_t config_ptr) {
  *config_ptr = 0x00010001;
  return X_ERROR_SUCCESS;
}
DECLARE_XBOXKRNL_EXPORT(XAudioGetSpeakerConfig, ExportTag::kImplemented);

// (Call to SHIM_SET_MAPPING removed)

Fairly easy to do, just use others already converted as guidelines if you get lost. Be sure to add appropriate ExportTags and test the exports after conversion to make sure they still work!

Visual Studio can sometimes glitch out and cause you to hit an assert when starting Xenia after you convert an export. If that happens, clean and rebuild xenia-kernel.

Do not remove the Register*Exports functions, even if they become blank. They are still required for proper linkage.

贡献者指南