适用于PS1,PS2,PSP游戏的4K(2160p)分辨率(译文)
By robot-v1.0
本文链接 https://www.kyfws.com/emulation/4k-2160p-resolution-for-ps1-ps2-psp-games-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 42 分钟阅读 - 20723 个词 阅读量 0适用于PS1,PS2,PSP游戏的4K(2160p)分辨率(译文)
原文地址:https://www.codeproject.com/Articles/1251671/4K-2160p-resolution-for-PS1-PS2-PSP-games
原文作者:Evgeny Pereguda
译文由本站 robot-v1.0 翻译
前言
Clone of PCSX/PCSX2/PPSSPP emulator for Windows 10 on WPF/C# with “touch” control
WPF/C#上带有"触摸"控件的Windows 10的PCSX/PCSX2/PPSSPP仿真器的克隆
This article presents my new project for cloning and research of PCSX2 PlayStation 2 emulator for Windows 10 on WPF/C#. The purpose of this project is simplification of the original project for more friendly user interface.
本文介绍了我的新项目,用于在WPF/C#上克隆和研究Windows 10的PCSX2 PlayStation 2模拟器.该项目的目的是简化原始项目,以提供更友好的用户界面.
-
https://github.com/Xirexel/OmegaRed(https://github.com/Xirexel/OmegaRed)
-
脸书链接:(Facebook link:) 欧米茄红(Omega Red)
-
BMC链接:(BMC link:) 欧米茄红(Omega Red)
-
适用于PS1,PS2,PSP游戏的4K(2160p)分辨率(4K (2160p) resolution for PS1, PS2, PSP games)
-
欧米茄红视频指南(Video guide for Omega Red)
-
[刷新帧率(Refresh frame rate)](https://www.codeproject.com#Refresh frame rate)
-
游戏垫配套(Game pad supporting)
-
[新的PS1图形渲染器(New PS1 graphic renderer)](https://www.codeproject.com#New PS1 graphic renderer)
-
[游戏流(YouTube,Facebook,Twitch)(Game play streaming (YouTube, Facebook, Twitch))](https://www.codeproject.com#Game play streaming (YouTube, Facebook, Twitch))
-
[Google云端硬盘和YouTube(GoogleDrive and YouTube)](https://www.codeproject.com#GoogleDrive and YouTube)
-
[欧米茄Red PSP模拟器(Omega Red PSP emulator)](https://www.codeproject.com#PSP emulator)
-
[欧米茄Red PS2模拟器RTSP服务器(Omega Red PS2 emulator RTSP server)](https://www.codeproject.com#Off screen mode)
目录(Table of Contents)
-
[完成结果(Finished Result)](https://www.codeproject.com#Finish result)
- [用户界面(User Interface)](https://www.codeproject.com#User Interface)
- [资源管理(Resource Management)](https://www.codeproject.com#Resource management)
- 垫(PAD)
- 捕获(Capture)
- [常规配置(General config)](https://www.codeproject.com#General config)
- 镶嵌(Tessellation)
- FXAA(FXAA)
- [快速保存(Quick Saving)](https://www.codeproject.com#Quick Saving)
- [音频音量控制(Audio Volume Control)](https://www.codeproject.com#Audio volume control)
- [屏幕外模式(Off Screen Mode)](https://www.codeproject.com#Off screen mode)
- [快速加载图标(Fast Loading Icon)](https://www.codeproject.com#Fast loading icon)
- [PSP仿真器(PSP Emulator)](https://www.codeproject.com#PSP emulator)
- [Google云端硬盘和YouTube(GoogleDrive and YouTube)](https://www.codeproject.com#GoogleDrive and YouTube)
- [游戏播放流(YouTube,Facebook,Twitch)(Game Play Streaming (YouTube, Facebook, Twitch))](https://www.codeproject.com#Game play streaming (YouTube, Facebook, Twitch))
- PS1仿真器(PS1 Emulator)
-
[兴趣点(Points of Interest)](https://www.codeproject.com#Points of Interest)
背景(Background)
该项目的主要目的是重新设计原始的PCSX2,以便为没有复杂控制组件结构的用户提供更加简单友好的用户界面.原始项目为普通用户提供了复杂的用户界面(在我看来).它具有用于创建游戏"补丁"的强大工具,但是作为游戏玩家,我不需要所有这些工具-我只需要几个按钮即可启动我最喜欢的游戏.另一个目的是为Windows 10添加触摸屏控件.(The main purpose of this project is to redesign the original PCSX2 for making more simple and friendly user interface for users without complex structure of control component. The original project has complex user interface for regular users (in my view). It has power tools for creating “patches” for game, but I, as a gamer, do not need all of them - I need only a couple buttons for launching my favorite game. Another purpose is to add a touch screen control for Windows 10.)
PCSX2简介(Brief PCSX2 Review)
Omega Red PS2模拟器是原始PCSX2项目的副本.它的图形用户界面发生了重大变化,但是如果没有原始项目的上下文,可能很难理解所有这些变化.(Omega Red PS2 emulator is a clone of the original PCSX2 project. It has a significant changing in graphic user interface, but it can be difficult to understand all these have made changes without the context of the original project.)
因此,原始项目是PCSX2团队长期工作的结果.它在Windows,Linux和MacOS的x86 CPU上模拟PlayStation 2游戏控制台的硬件部分.它包括Emotion Engine MIPS R5900和I/O处理器MIPS R3000软件转换器,可将这些命令集转换为Intel x86命令集.但是,CPU体系结构之间的差异导致定义了三个主要的执行线程:(So, the original project is a result of the long time working of the PCSX2 team. It emulates hardware part of PlayStation 2 game console on x86 CPU for Windows, Linux and MacOS. It includes Emotion Engine MIPS R5900 and I/O processor MIPS R3000 software translators which convert those sets of commands into Intel x86 set of commands. However, the difference between the CPU architectures leads to defining three main execution threads: “)EE核心(EE Core)“用于执行MIPS R5900和MIPS R3000的主要命令集;"(” for execution main set of MIPS R5900’s and MIPS R3000’s commands; “)音乐电视(MTVU)“用于从VU1命令执行3D矢量操作的集合;"(” for execution set of 3D vector operations from VU1 commands; “)MTGS(MTGS)用于图形合成器处理器的执行命令.此线程模型允许有效地使用三个或更多核心CPU.(” for execution commands of the Graphics Synthesizer processor. This threading model allows use of three or more core CPUs in an effective way.)
在代码级别,PCSX2基于框架(On the level of code, PCSX2 is based on frameworks) wxWidgets
和(and) pthreads4w
.(.) wxWidgets
是用于创建易于移植的GUI的框架.(is a framework for creating easy ported GUI.) pthreads4w
是一个框架,用于在Windows OS中定义Unix线程的接口,以与Unix代码兼容.(is a framework for defining Unix thread’s interface in Windows OS for compatibleness with Unix code.)
最后一刻是应用程序的架构师. PCSX2具有加载插件的主要执行应用程序之一.结果,可以通过以下方式表示模式:(The last moment is an architect of application. PCSX2 has one of the main execution applications with the loading of plugins. As a result, schema can be presented by the next way:)
我对问题的看法(My View of the Problem)
在我看来,原始项目太复杂了.它包括调试代码,创建"补丁”,打印到日志,配置CPU转换器,配置插件等工具.我认为光样式更简单的版本可以使其易于使用.另一刻是通过"触摸"模式控制的-我真的很想带我的Surface Pro并花一些时间在Final Fantasy X或Final Fantasy XII上玩,但是GUI为” Win95"风格并且需要使用外部游戏手柄"杀死游戏"(嵌入式触摸键盘是没有用的).(In my view, the original project is too complex. It includes tools for debugging code, creating “patches”, printout into logs, configuration of CPU translators, configuration of plugins and others. I think that a more simple version in light style can make it easy for using. The other moment is controlling by “touch” schema - I really would like to take my light Surface Pro and spend some time on playing in Final Fantasy X or Final Fantasy XII, but GUI in “Win95” style and the need to use an external game pad “kills game” (embedded touch keyboard is useless).)
我做了什么?(What Have I Done?)
那么,我做了什么?我决定在WPF/C#GUI上编写PCSX2的克隆版本. WPF是一个灵活的框架,并允许编写代码以与"触摸"屏幕正确交互.但是,WPF框架基于托管代码,不能直接在翻译器代码中有效使用.这就引出了下一个解决方案-编写新的C DLL库,其中将包含运行模拟器所需的最少代码.这已经成为一个重大问题-原始的PCSX2项目是具有混合体系结构的应用程序-很难将"业务"逻辑-仿真器核心与"瘦"客户端-用户界面分开.由于原始代码几乎在每个源文件中都使用wxWidgets中的类和结构,因此此问题变得更加严重-它非常紧密地将wxWidgets与PCSX2绑定在一起.从wxWidgets删除依赖关系几乎需要重写所有原始源文件-这对于一个爱好项目来说太多了,在静态链接级别上它将与原始PCSX2项目失去兼容性-对原始代码的任何修改都需要手动复制和修改进入新模拟器中的代码.(So, what have I done? I have decided to write a clone version of PCSX2 on WPF/C# GUI. WPF is a flexible framework and allows to write code for correct interacting with “touch” screens. However, WPF framework is based on managed code and cannot be effective for directly using in translator code. It leads to the next solution - write the new C DLL library which will contain the minimum needed code for working of the emulator. It has become a significant problem - the original PCSX2 project is an application with the mixed architecture - it is very difficult to separate a “business” logic - emulator core from “thin” client - user interface. This problem has become worse because the original code uses classes and structures from wxWidgets in almost each source file - it binds wxWidgets with PCSX2 very tight. Removing dependency from wxWidgets needs rewriting almost all original source files - it is too much for a hobby project and it will lose compatibility with the original PCSX2 project on the level of the static linking - any modification of the original code needs to copy and modify manually into the code in the new emulator.)
存根wxWidget(Stub wxWidget)
在我看来,只有一个合适的决定-编写一个简单的框架,该框架包含与wxWidgets相同的静态链接接口,但是通过C ++ STD代码实现所需的功能.看起来工作量很大,但事实并非如此.从PCSX2删除对wxWidgets的依赖关系允许标记与项目的GUI部分相关的代码,并将其从代码中删除.结果,“框架"仅包含12个源文件.它们大多数是"存根"文件-它们根据wxWidgets的界面定义类,但不包括可执行代码.仿真器核心的代码不受wxWidgets框架的约束.(In my view, there is only one suitable decision - write a simple framework which includes the same static linking interface as wxWidgets, but implements the needed functionality by C++ STD code. It looks like a huge amount of work, but it is not. Removing dependency to wxWidgets from PCSX2 allows to mark code which is related to the GUI part of project, and remove it from the code. As a result, “Framework” includes only 12 source files. Most of them are “stub” files - they define classes according to the interface of wxWidgets, but do not include executable code. The code of the emulator core is UNBOUNDED from wxWidgets framework.)
创建PCSX2Lib(Creating PCSX2Lib)
之前我曾写过,该项目的主要部分是查找原始PCSX2的代码,该代码可以命名为” Core"或" Kernel".经过研究,我发现可以用这种方式命名的文件-这些文件可以在没有GUI和文件系统的特定上下文的情况下工作.(I wrote previously that the main part of this project was finding code of the original PCSX2 which can be named as “Core” or “Kernel”. After some research, I found files which can be named in this way - these files can work without specific context of the GUI and File System.)
当然,这个"(Of course, this “) Core
“不能单独工作(它是DLL),但是可以由可以加载并链接C动态库的任何编程语言的任何框架使用.C#和WPF是用于此目的的合适框架,我面对的问题是定义正确的C接口(” cannot work by itself (it is DLL), but it can be used by any Framework in any programming language which CAN LOAD AND LINK C DYNAMIC LIBRARIES. C# and WPF is a suitable framework for this purpose and I am faced with the problem to define correct C interface for)PCSX2Lib.dll(PCSX2Lib.dll).代号(. Code of)**PCSX2Lib.dll(PCSX2Lib.dll)**理解起来非常困难,我认为对于本文的大多数读者来说,复习该库的C接口并理解每个导出函数的目的会更加有趣.(is very difficult for understanding, and I think that for most readers of this article, it can be more interesting to review C interface of this library and understand the purpose of each of the exported functions.)
LIBRARY "PCSX2Lib"
EXPORTS
; Init functions
DetectCpuAndUserModeFunc
AllocateCoreStuffsFunc
ApplySettingsFunc
; EE Core thread controls
SysThreadBase_ResumeFunc
SysThreadBase_SuspendFunc
SysThreadBase_ResetFunc
SysThreadBase_CancelFunc
; MTGS thread controls
MTGS_ResumeFunc
MTGS_WaitForOpenFunc
MTGS_IsSelfFunc
MTGS_SuspendFunc
MTGS_CancelFunc
MTGS_FreezeFunc
MTGS_WaitGSFunc
; MTVU thread controls
MTVU_CancelFunc
vu1Thread_WaitVUFunc
; Plugin management
openPlugin_SPU2Func
openPlugin_DEV9Func
openPlugin_USBFunc
openPlugin_FWFunc
setPluginsInitCallback
setPluginsCloseCallback
setPluginsShutdownCallback
setPluginsOpenCallback
setPluginsAreLoadedCallback
resetCallbacksFunc
setGS
setPAD
setSPU2
setCDVD
setMcd
setUSB
setFW
setDEV9
; Patches management
setUI_EnableSysActionsCallback
ForgetLoadedPatchesFunc
inifile_commandFunc
setLoadAllPatchesAndStuffCallback
setSioSetGameSerialFunc
getGameStartedFunc
getGameLoadingFunc
getElfCRCFunc
VTLB_Alloc_PpmapFinc
releaseWCHARStringFunc
getSysGetBiosDiscIDFunc
gsUpdateFrequencyCallFunc
getSysGetDiscIDFunc
; BIOS management
setLoadBIOSCallbackCallback
setCDVDNVMCallback
setCDVDGetMechaVerCallback
; Saving management
getFreezeInternalsFunc
getEmotionMemoryFunc
getIopMemoryFunc
getHwRegsFunc
getIopHwRegsFunc
getScratchpadFunc
getVU0memFunc
getVU1memFunc
getVU0progFunc
getVU1progFunc
getFreezeOutFunc
setDoFreezeCallback
; Loading management
setFreezeInFunc
setFreezeInternalsFunc
setEmotionMemoryFunc
setIopMemoryFunc
setHwRegsFunc
setIopHwRegsFunc
setScratchpadFunc
setVU0memFunc
setVU1memFunc
setVU0progFunc
setVU1progFunc
; Elf file management
PCSX2_Hle_SetElfPathFunc
Init
功能:(functions:)
-
DetectCpuAndUserModeFunc
-检测CPU多媒体支持的功能(- Function for detecting of the multimedia support of the CPU) -
AllocateCoreStuffsFunc
-用于分配内存并初始化内部变量和翻译器的功能(- Function for allocating memory and initializing inner variables and translators) -
ApplySettingsFunc
-用于设置内部变量的新值的功能(- Function for setting the new values for inner variables) EE Core线程控件:(EE Core thread controls:) -
SysThreadBase_ResumeFunc
-恢复EE Core线程的功能((- Function for resuming EE Core thread ()init
状态未启动,并且resume命令启动此线程)(state is not started and resume command starts this thread)) -
SysThreadBase_SuspendFunc
-暂停EE Core线程的功能(- Function for suspending EE Core thread) -
SysThreadBase_ResetFunc
-停止EE Core线程并释放相关内存的功能(- Function for stopping EE Core thread and releasing related memory) -
SysThreadBase_CancelFunc
-禁用EE Core线程的功能(- Function for inactivating EE Core thread) MTGS线程控制:(MTGS thread controls:) -
MTGS_ResumeFunc
-恢复图形合成器(GS)线程的功能((- Function for resuming Graphics Synthesizer (GS) thread ()init
状态未启动,并且resume命令启动此线程)(state is not started and resume command starts this thread)) -
MTGS_WaitForOpenFunc
-等待GS图形上下文初始化的功能(- Function for waiting of initializing of the graphic context of GS) -
MTGS_IsSelfFunc
-用于检查GS线程以防止互斥锁死的功能(- Function for checking of the GS thread for preventing of mutex deadlock) -
MTGS_SuspendFunc
-暂停GS线程的功能(- Function for suspending GS thread) -
MTGS_CancelFunc
-取消GS螺纹的功能(- Function for cancelling GS thread) -
MTGS_FreezeFunc
-用于从GS线程保存图形上下文的功能(- Function for saving of the graphic context from GS thread) -
MTGS_WaitGSFunc
-等待完成当前图形上下文的功能(- Function for waiting to finish the current graphic context) MTVU线程控件:(MTVU thread controls:) -
MTVU_CancelFunc
-取消3D向量单位线的功能(- Function for cancelling of the 3D Vector Unit Thread) -
vu1Thread_WaitVUFunc
-等待3D向量单位线程开始的功能(- Function for waiting of the starting of the 3D Vector Unit Thread) 插件管理:(Plugin management:) -
openPlugin_SPU2Func
-开启功能(- Function for opening)AudioOutput
语境(context) -
openPlugin_DEV9Func
-打开DEV9上下文的功能(- Function for opening DEV9 context) -
openPlugin_USBFunc
-打开USB上下文的功能(- Function for opening USB context) -
openPlugin_FWFunc
-打开固件上下文的功能(- Function for opening FW context) -
setPluginsInitCallback
-设定功能(- Function for setting)init
从EE Core线程初始化的回调C函数(callback C function for initializing from EE Core thread) -
setPluginsCloseCallback
-设置关闭回调C函数以从EE Core线程关闭的函数(- Function for setting close callback C function for closing from EE Core thread) -
setPluginsShutdownCallback
-设置释放回调C函数,用于从EE Core线程释放插件资源(- Function for setting release callback C function for releasing plugins' resources from EE Core thread) -
setPluginsOpenCallback
-设置用于从EE Core线程打开的打开回调C函数的函数(- Function for setting open callback C function for opening from EE Core thread) -
setPluginsAreLoadedCallback
-用于设置检查加载状态回调的函数C用于检查EE Core线程状态的函数(- Function for setting check loading status callback C function for checking status from EE Core thread) -
resetCallbacksFunc
-释放所有回调指针的功能(- Function for releasing all callback pointers) -
setGS
-在GS外部模块上设置C指针的功能(- Function for setting of the C pointer on GS external module) -
setPAD
-在PAD外部模块上设置C指针的功能(- Function for setting of the C pointer on PAD external module) -
setSPU2
-用于设置C指针的功能(- Function for setting of the C pointer on)AudioOutput
外部模块(external module) -
setCDVD
-在CDVD外部模块上设置C指针的功能(- Function for setting of the C pointer on CDVD external module) -
setMcd
-用于在存储卡外部模块上设置C指针的功能(- Function for setting of the C pointer on Memory Card external module) -
setUSB
-在USB外部模块上设置C指针的功能(- Function for setting of the C pointer on USB external module) -
setFW
-在FW外部模块上设置C指针的功能(- Function for setting of the C pointer on FW external module) -
setDEV9
-在DEV9外部模块上设置C指针的功能(- Function for setting of the C pointer on DEV9 external module) 补丁管理:(Patches management:) -
setUI_EnableSysActionsCallback
-用于从EE Core线程设置UI更新回调的函数(- Function for setting UI update callback from EE Core thread) -
ForgetLoadedPatchesFunc
-用于发布EE Core中所有当前补丁的功能(- Function for releasing all current patches in EE Core) -
inifile_commandFunc
-用于将文本补丁设置为EE Core的功能(- Function for settings text patches to EE Core) -
setLoadAllPatchesAndStuffCallback
-用于从EE Core线程设置负载补丁回调的功能(- Function for setting load patches callback from EE Core thread) -
setSioSetGameSerialFunc
-设置游戏盘序列号的功能(- Function for setting serial number of the game disk) -
getGameStartedFunc
-获得EE Core游戏状态的功能(- Function for getting of EE Core gaming status) -
getGameLoadingFunc
-获取EE Core游戏加载状态的功能(- Function for getting of EE Core game loading status) -
getElfCRCFunc
-获取功能(- Function for getting of)ElfFile
CRC校验和(CRC check sum) -
VTLB_Alloc_PpmapFinc
-为补丁重新分配内存的功能(- Function for reallocating memory for patches) -
releaseWCHARStringFunc
-用于释放分配的内存的功能(- Function for releasing of the allocated memory for)wchar_t string
-
getSysGetBiosDiscIDFunc
-获取BIOS光盘ID的功能(- Function for getting of the Bios Disc ID) -
gsUpdateFrequencyCallFunc
-修补后更新GS上下文的功能(- Function for updating GS context after patching) -
getSysGetDiscIDFunc
-获取光盘ID的功能(- Function for getting of the Disc ID) BIOS管理:(BIOS management:) -
setLoadBIOSCallbackCallback
-用于设置从EE Core线程加载BIOS回调的功能.(- Function for setting loading BIOS callback from EE Core thread.) -
setCDVDNVMCallback
-用于设置从EE Core线程保存和加载BIOS配置回调的函数.(- Function for setting saving and loading BIOS Configuration callback from EE Core thread.) -
setCDVDGetMechaVerCallback
-用于设置从EE Core线程加载DVD硬件序列号回调的功能.(- Function for setting loading DVD hardware serial number callback from EE Core thread.) 储蓄管理:(Saving management:) -
getFreezeInternalsFunc
-用于将内部变量作为字节数组获取的函数(- Function for getting internal variables as a byte array) -
getEmotionMemoryFunc
-用于将EE Core内存作为字节数组获取的功能(- Function for getting EE Core memory as a byte array) -
getIopMemoryFunc
-用于将I/O处理器内存作为字节数组获取的功能(- Function for getting I/O Processor memory as a byte array) -
getHwRegsFunc
-用于将EE核心硬件寄存器获取为字节数组的功能(- Function for getting EE Core Hardware Registers as a byte array) -
getIopHwRegsFunc
-获取I/O处理器硬件寄存器为字节数组的功能(- Function for getting I/O Processor Hardware Registers as a byte array) -
getScratchpadFunc
-用于将Scratchpad(缓冲区)内存作为字节数组获取的功能(- Function for getting Scratchpad (Buffer) memory as a byte array) -
getVU0memFunc
-用于将向量单元0的内存作为字节数组获取的功能(- Function for getting Vector Unit 0 memory as a byte array) -
getVU1memFunc
-用于将向量单元1的内存作为字节数组获取的功能(- Function for getting Vector Unit 1 memory as a byte array) -
getVU0progFunc
-将向量单位0程序作为字节数组获取的功能(- Function for getting Vector Unit 0 program as a byte array) -
getVU1progFunc
-将向量单元1程序作为字节数组获取的功能(- Function for getting Vector Unit 1 program as a byte array) -
getFreezeOutFunc
-用于将插件内存作为字节数组获取的功能(- Function for getting plugin memory as a byte array) -
setDoFreezeCallback
-设置保存插件内存回调的功能(- Function for setting saving plugin memory callback) 加载管理:(Loading management:) -
setFreezeInFunc
-将插件存储设置为字节数组的功能(- Function for setting plugin memory as a byte array) -
setFreezeInternalsFunc
-将内部变量设置为字节数组的功能(- Function for setting internal variables as a byte array) -
setEmotionMemoryFunc
-将EE Core内存设置为字节数组的功能(- Function for setting EE Core memory as a byte array) -
setIopMemoryFunc
-将I/O处理器内存设置为字节数组的功能(- Function for setting I/O Processor memory as a byte array) -
setHwRegsFunc
-将EE核心硬件寄存器设置为字节数组的功能(- Function for setting EE Core Hardware Registers as a byte array) -
setIopHwRegsFunc
-将I/O处理器硬件寄存器设置为字节数组的功能(- Function for setting I/O Processor Hardware Registers as a byte array) -
setScratchpadFunc
-用于将Scratchpad(缓冲区)存储器设置为字节数组的功能(- Function for setting Scratchpad (Buffer) memory as a byte array) -
setVU0memFunc
-将向量单元0存储器设置为字节数组的功能(- Function for setting Vector Unit 0 memory as a byte array) -
setVU1memFunc
-将向量单元1存储器设置为字节数组的功能(- Function for setting Vector Unit 1 memory as a byte array) -
setVU0progFunc
-将矢量单元0程序设置为字节数组的功能(- Function for setting Vector Unit 0 program as a byte array) -
setVU1progFunc
-将矢量单元1程序设置为字节数组的功能(- Function for setting Vector Unit 1 program as a byte array) 小精灵文件管理:(Elf file management:) -
PCSX2_Hle_SetElfPathFunc
-设置Elf文件的功能(不起作用,但是需要静态链接)(- Function for setting Elf file (unworkable, but it is needed for static linking)) 这些函数具有特定的调用顺序,并且外部框架必须执行它们,并通过特定算法在回调函数中调用代码.(These functions have specific orders of calling and external framework must execute them and invoke code in callback functions by specific algorithms.)
在C#代码中,启动模拟器从初始化开始:(In C# code, launching emulator begin from initializing:)
PCSX2LibNative.Instance.DetectCpuAndUserModeFunc();
PCSX2LibNative.Instance.AllocateCoreStuffsFunc
(PCSX2Controller.Instance.m_Pcsx2Config.serialize());
PCSX2LibNative.Instance.PCSX2_Hle_SetElfPathFunc("");
绑定回调函数:(Binding callback functions:)
private void Bind()
{
foreach (var l_Module in ModuleManager.Instance.Modules)
{
PCSX2LibNative.Instance.setModule(l_Module);
}
PCSX2LibNative.Instance.setPluginsInitCallback = delegate()
{
ModuleControl.Instance.init();
};
PCSX2LibNative.Instance.setPluginsCloseCallback = delegate()
{
ModuleControl.Instance.close();
};
PCSX2LibNative.Instance.setPluginsShutdownCallback = delegate()
{
ModuleControl.Instance.shutdown();
};
PCSX2LibNative.Instance.setPluginsOpenCallback = delegate()
{
ModuleControl.Instance.open();
};
PCSX2LibNative.Instance.setPluginsAreLoadedCallback = delegate()
{
return ModuleControl.Instance.areLoaded();
};
PCSX2LibNative.Instance.setUI_EnableSysActionsCallback = delegate()
{
if (!PCSX2Controller.Instance.innerCall())
LockScreenManager.Instance.hide();
};
PCSX2LibNative.Instance.setLoadAllPatchesAndStuffCallback = delegate(uint a_FirstArg)
{
PatchAndGameFixManager.Instance.LoadAllPatchesAndStuff();
};
PCSX2LibNative.Instance.setLoadBIOSCallbackCallback =
delegate(IntPtr a_FirstArg, Int32 a_SecondArg)
{
Omega_Red.Tools.BiosControl.LoadBIOS(a_FirstArg, a_SecondArg);
};
PCSX2LibNative.Instance.setCDVDNVMCallback =
delegate(IntPtr buffer, Int32 offset, Int32 bytes, Boolean read)
{
Omega_Red.Tools.BiosControl.NVMFile(buffer, offset, bytes, read);
};
PCSX2LibNative.Instance.setCDVDGetMechaVerCallback = delegate(IntPtr buffer)
{
Omega_Red.Tools.BiosControl.CDVDGetMechaVer(buffer);
};
PCSX2LibNative.Instance.setDoFreezeCallback =
delegate(IntPtr a_FirstArg, Int32 a_mode, Int32 a_ModuleCode)
{
return ModuleControl.Instance.doFreeze(a_FirstArg, a_mode, a_ModuleCode);
};
}
并恢复EE Core线程:(And resuming EE Core thread:)
PCSX2LibNative.Instance.SysThreadBase_ResumeFunc();
Omega Red项目非常复杂,对整个代码的审查需要一本真正的书.但是,我认为重要的是要注意编程解决方案的体系结构.(Omega Red project is complex and reviewing of the whole code needs ever a real book. However, I think that it can be important to pay attention to the architecture of the programing solutions.)
模块-插件(Modules - Plugins)
最初的PCSX2项目定义了一组用于与仿真器进行交互的外部插件-视频,音频,游戏手柄,存储卡. Omega Red项目具有与模块相同的解决方案-它们不作为真实的外部文件存在,但作为资源包含在执行文件中.在启动应用程序时,将它们解压缩,并在退出应用程序时将它们删除.另一个时刻是定义模块的界面-每个模块都有自己的一组功能,供以下人员使用(The original PCSX2 project defines a group of external plugins for interacting with emulator - video, audio, game pad, memory card. Omega Red project has the same solutions which are named modules - they DO NOT exist as real external files, but they are contained in execution file as resources. At the moment of launching of the application, they are unpacked, and at the moment of exit from the application, they are deleted. Another moment is defining module’s interface - each module has its own set of functions which are used by) PCSX2Lib
,但对于外部框架来说,它是没有用的-因此,在此项目中,有自己的公共接口与模块进行交互:(, but for an external framework, it is useless - so, in this project, there is own common interface for interacting with modules:)
PCSX2_EXPORT_C_(void*) getAPI()
{
return (void*)&CDVDapi_Iso;
}
PCSX2_EXPORT_C execute(const wchar_t* a_command, wchar_t** a_result)
{
g_CDVD.execute(a_command, a_result);
}
PCSX2_EXPORT_C releaseString(wchar_t* a_string)
{
if (a_string != nullptr)
delete[] a_string;
}
功能(Function) getAPI
返回指针(returns pointer on) PCSX2Lib
API,功能(API, function) execute
从外部框架执行命令并以XML文档,函数的形式返回结果(executes command from an external framework and returns result in the form of the XML document, function) releaseString
释放返回的结果(releases the returned result) string
记忆.(memory.)
视频渲染器(Video Renderer)
Omega Red有一个可用于DirectX11渲染的模块,但是有一个问题-WPF仅支持DirectX9纹理.(Omega Red has a module for rendering by DirectX11, but there is one problem - WPF supports only DirectX9 texture in) D3DImage
.此问题可通过以下方式解决:(. This problem is resolved by the next way:)
- 使用"创建DirectX纹理(Create DirectX texture with the “)
Shared
“句柄-(” handle -)Direct3D9Ex
支持使用DXGI共享处理程序创建DirectX9纹理.(supports creating DirectX9 texture with DXGI shared handler.) - 从DirectX9纹理的DXGI共享处理程序创建共享DirectX11纹理:(Create the shared DirectX11 texture from the DXGI shared handler of the DirectX9 texture:)
// Create shared texture
CComPtr<ID3D11Resource> l_Resource;
hr = m_dev->OpenSharedResource(sharedhandle, IID_PPV_ARGS(&l_Resource));
if (FAILED(hr)) return false;
hr = l_Resource->QueryInterface(IID_PPV_ARGS(&m_SharedTexture));
触控板(Touch Pad)
欧米茄Red具有集成的触摸板:(Omega Red has an integrated touch pad:)
它是根据(It is implemented according to the) XInput
通过定义用于将按钮状态和模拟杆轴复制到本机内存的C#结构来规范:(specification by defining C# structures for copying button status and analog sticks axes into the native memory:)
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct XINPUT_GAMEPAD {
public UInt16 wButtons;
public byte bLeftTrigger;
public byte bRightTrigger;
public Int16 sThumbLX;
public Int16 sThumbLY;
public Int16 sThumbRX;
public Int16 sThumbRY;
};
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct XINPUT_STATE {
public UInt32 dwPacketNumber;
public XINPUT_GAMEPAD Gamepad;
};
屏幕和视频捕获(Screen and Video Capture)
原始PCSX2具有拍摄渲染的游戏图像和录制游戏视频的某些功能,但是这种功能不容易访问,并且没有为此目的进行优化.我决定包括更灵活的解决方案.它使用WPF功能通过以下方式将屏幕捕获为JPEG格式的图像文件-允许将DirectX纹理从后缓冲区复制到C#(The original PCSX2 has some functionality for taking the rendered game image and record gameplay video, but such functionality is not easily accessible and is not optimized for such purpose. I decided to include more flexible solutions. It uses WPF functionality for capturing screen into the JPEG format image file by - it allows copy DirectX texture from back buffer to C#) BitmapSource
并使用编码(and encodes it using) JpegBitmapEncoder
:(:)
public byte[] takeScreenshot()
{
byte[] l_result = null;
var l_D3D9Image = imageSource as D3D9Image;
if(l_D3D9Image != null)
{
BitmapSource l_bitmap = l_D3D9Image.getBackBuffer();
JpegBitmapEncoder l_encoder = new JpegBitmapEncoder();
l_encoder.QualityLevel = 75;
l_encoder.Frames.Add(BitmapFrame.Create(l_bitmap));
using (var outputStream = new MemoryStream())
{
l_encoder.Save(outputStream);
l_result = outputStream.ToArray();
}
}
return l_result;
}
为了捕获游戏视频,我使用了(For capturing of gameplay video, I have used) CaptureManager
SDK-这是一个简单的SDK,可捕获来自许多来源的视频和音频.就本项目而言,(SDK - it is a simple SDK for capturing video and audio from many sources. For the purpose of this project,) CaptureManager
SDK具有以下优点:(SDK has the following advantages:)
- 简单灵活的C#(Simple and flexible C#)
interface
-它允许将视频捕获代码集成到任何WPF/C#项目.(- it allows to integrate video capture code to any WPF/C# project.) - 通过XML文档定义源-捕获的DirectX11纹理上的指针地址以数字形式写为文本格式:(Defining source by XML document - address of pointer on the capture DirectX11 texture is written as numbers in the text format:)
string lPresentationDescriptor = "<?xml version='1.0' encoding='UTF-8'?>" +
"<PresentationDescriptor StreamCount='1'>" +
"<PresentationDescriptor.Attributes Title='Attributes of Presentation'>" +
"<Attribute Name='MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK'
GUID='{58F0AAD8-22BF-4F8A-BB3D-D2C4978C6E2F}' Title='The symbolic link for a
video capture driver.' Description='Contains the unique symbolic link
for a video capture driver.'>" +
"<SingleValue Value='ImageCaptureProcessor' />" +
"</Attribute>" +
"<Attribute Name='MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME'
GUID='{60D0E559-52F8-4FA2-BBCE-ACDB34A8EC01}'
Title='The display name for a device.'
Description='The display name is a human-readable string,
suitable for display in a user interface.'>" +
"<SingleValue Value='Image Capture Processor' />" +
"</Attribute>" +
"</PresentationDescriptor.Attributes>" +
"<StreamDescriptor Index='0' MajorType='MFMediaType_Video'
MajorTypeGUID='{73646976-0000-0010-8000-00AA00389B71}'>" +
"<MediaTypes TypeCount='1'>" +
"<MediaType Index='0'>" +
"<MediaTypeItem Name='MF_MT_FRAME_RATE'
GUID='{C459A2E8-3D2C-4E44-B132-FEE5156C7BB0}' Title='Frame rate.'
Description='Frame rate of a video media type, in frames per second.'>" +
"<RatioValue Value='30.0'>" +
"<Value.ValueParts>" +
"<ValuePart Title='Numerator' Value='30' />" +
"<ValuePart Title='Denominator' Value='1' />" +
"</Value.ValueParts>" +
"</RatioValue>" +
"</MediaTypeItem>" +
"<MediaTypeItem Name='CM_DirectX11_Capture_Texture'
GUID='{179B7A05-496A-4C9F-B8C6-15F04E669595}'>" +
"<SingleValue Value='{Temp_Capture_Texture}' />" +
"</MediaTypeItem>" +
"</MediaType>" +
"</MediaTypes>" +
"</StreamDescriptor>" +
"</PresentationDescriptor>";
哪里(where) {Temp_Capture_Texture}
在DirectX11渲染目标纹理上用作指针的文本表示形式上放置,该纹理用作源.(is preplaced on text representation of pointer on DirectX11 render target texture which is used as source.)
lPresentationDescriptor = lPresentationDescriptor.Replace
("{Temp_Capture_Texture}", a_PtrDirectX11Source.ToInt32().ToString());
音频流通过”(Audio stream is recorded by “)音频回送(Audio Loopback)"-来自内部系统扬声器的输出.(” - from inner system speaker output.)
的(The) CaptureManager
SDK使用不同的视频和音频编码器来录制游戏视频.(SDK uses different video and audio encoders for recording of game play video.)
相依性(Dependency)
Omega Red基于PCSX2代码,为了在编译过程中正确链接原始代码,请将其放置在(Omega Red is based on PCSX2 code and for correct linking of the original code at the process of compiling, it is placed in the)**根(root)**夹:(folder:)
结果二进制可执行文件被放入”(The result binary executable file is placed into the “)箱子(bin)“文件夹:(” folder:)
该项目的源代码存储在GitHub中(The source code of this project is stored in GitHub in) Omega_Red
资料库:(repository:) https://github.com/Xirexel/OmegaRed(https://github.com/Xirexel/OmegaRed) .(.)
完成结果(Finished Result)
结果以一个可执行文件的形式呈现-它以一个文件的形式包含所有需要的代码.因此,该程序专为"触摸"控制而设计,它具有以下功能:(The result is presented in the form of the ONE executable file - it includes all needed code in form of the one file. So, the program is designed for “touch” control and it has the following features:)
- 全屏大小-程序只有一个窗口大小-最大值占用整个屏幕区域(Full screen size - program has only one window size - maximum which takes the whole screen area)
- 最低配置-大多数游戏的默认配置就足够了(Minimum configuration - default configuration is enough for most games)
- 它仅允许一个玩家游戏配置(It allows only one player game configuration) 接下来的小节将结果程序描述为更具信息性,但是全屏图像在小型HTML图像中的质量较差.(The next sub sections describe the result program as more informative, but full screen images have poor quality in small HTML images.)
用户界面(User Interface)
Omega Red是一个使原始PCSX2更加友好和易于使用的项目.这些目标通过具有WPF GUI框架功能的用户界面设计来反映.(Omega Red is a project for making an original PCSX2 more friendly and easy using. These targets are reflected by design of the user interface with the features which can be got from WPF GUI framework.)
" Win95"样式的PCSX2的原始用户界面:(Original user interface of PCSX2 in “Win95” style:)
已在新样式中替换为"触摸-平铺"设计,以最少需要使用经典"鼠标” HID的方式支持屏幕触摸控制:(is replaced on the new style with “Touch - Tile” design for supporting of the screen touch controlling with minimum needs to use classic “mouse” HID:)
资源管理(Resource Management)
为了简化对主要游戏资源的控制和管理,简单模式的设计花费了很多时间:BIOS,ISO游戏光盘,存储卡,PAD,储蓄.(Much time had been spent on design of the simple schema for easy controlling and management of the main game playing resources: BIOSs, ISO game’s discs, Memory cards, PADs, Savings.)
BIOS是仿真器工作过程的重要组成部分. Omega Red支持从二进制文件或ZIP存档中读取数据:(BIOSs are important part of the working process of the emulator. Omega Red supports reading data from binary file or from ZIP archive:)
ISO光盘映像文件是在此模拟器上启动游戏的唯一方法.这些文件已注册在游戏光盘的集合中并被识别-原始PCSX2模拟器在游戏启动时会读取并检查ISO文件,但是此新模拟器会检查映像光盘的类型,并由PS2(游戏光盘的区域)支持无需启动仿真器:(ISO disc image files are the only way for launching game on this emulator. These files are registered in collection of Game Discs and are recognized - the original PCSX2 emulator reads and checks ISO file at the time of launching of the game, but this new emulator checks type of image disc, supporting it by PS2, region of game disc without launching of emulator:)
加载和保存状态已显着更改.原始PCSX2仿真器在每个游戏中的第10个文件插槽都有限制,而没有定义保存日期和游戏进度:(Loading and saving states are significantly changed. The original PCSX2 emulator has limitation in 10-th file-slots on each game, WITHOUT defining date of saving and progress of gameplay:)
Omega Red允许在游戏过程中每个游戏最多创建第100个文件插槽.每个文件插槽都会保存保存日期,当前游戏会话的持续时间以及游戏过程的捕获图像:(Omega Red allows create upto 100-th file-slots on each game at the game process. Each file-slot saves date of saving, duration of the current game session and captured image of the game process:)
此外,在停止模拟器或关闭Omega Red应用程序时,当前的游戏进程将保存到特殊文件"(In addition, at the moment of stopping of the emulator or at the moment of closing of Omega Red application, the current game process is saved into the special file “)自动保存(Autosave)"-如果玩家忘记保存上一个游戏会话,它可以继续游戏.此外,加载已保存状态的顺序已更改-而原始PCSX2需要加载BIOS,加载游戏光盘,对其进行检查,然后才进行需要单击所需的插槽,Omega Red只需单击一下即可加载保存的游戏状态,因此,加载保存的游戏的时间从20秒减少到3-5秒.(” - it allows to continue the game in case gamers forgot to save the last game session. Also, the sequence of loading the saved state has been changed - while the original PCSX2 needs load BIOS, load game disc, check it and only then it needs click on the needed slot, Omega Red loads the saved game state by one click. As a result, the time of loading of the saved game is decreased from 20 seconds to 3-5 seconds.)
该项目允许以更"灵活"的方式管理PS2存储卡:(This project allows manage PS2 memory cards in a more “flexible” way:)
可以在游戏时创建存储卡,并且可以在游戏时将模拟器从一张存储卡切换到另一张存储卡,以在游戏中保存和加载数据.创建的存储卡文件的名称取决于游戏名称和游戏光盘的唯一序列号-它仅允许显示"自己的"游戏存储卡文件.(Memory cards can be created at gameplay time, and emulator can be switched from one memory card to another one at the gameplay for saving and loading data in games. Name of the created memory card files is based on name of the game and unique serial ID of the game disc - it allows display only “own” game memory card files.)
垫(PAD)
Omega Red允许从"(Omega Red allows to switch game control from “)触摸(Touch)” PAD on"(" PAD on “)游戏(Game)背垫:(” Pad and back:)
捕获(Capture)
在原始PCSX2中捕获图像和视频的功能有一些限制,因此需要对配置进行一些研究以找到这些命令.在这个项目中,我重新设计了它,并在显示屏顶部添加了所需的控制按钮:(Functionality for capturing of images and videos in the original PCSX2 has some limitation and it needs to do some research of configuration for finding these commands. In this project, I have redesigned it and have added the needed control buttons on the top of display:)
拍摄图像的质量是固定的(75%). “实时"游戏视频的质量可以在10%到99%的范围内更改.创建的图像和视频文件的名称由游戏的友好名称和当前日期生成.分开的面板允许在暂停时间查看捕获的图像和视频:(Quality of the captured image is fixed (75%). Quality of the “Live” gameplay video can be changed in range from 10% to 99%. Names of the created images and video files are generated by the friendly name of game and current date. The separated panel allows view captured images and videos at the pause time:)
常规配置(General Config)
“(")常规配置(General config)“面板允许更改非游戏配置:"(” panel allows to change non-game configurations: “)显示模式(Display mode)”,"(”, “)控制方式(Control mode)”,"(”, “)设置最高(Set Topmost)”,"(", “)视频压缩质量(Quality of video compression)”,"(", “)关闭宽屏格式(Turn off wide screen format)”,"(", “)当前语言(Current language)”.(".)
“(")显示模式(Display mode)“可将显示区域从全屏切换到区域,然后再切换回来.(” allows to switch displaying area from full screen to region and back.)
“(")控制方式(Control mode)“允许将常规控制从”(” allows to switch general control from “)纽扣(Button)” 至 “(” to “)触摸(Touch)架构并返回.(” schema and back.)
“(")设置最高(Set Topmost)“将应用程序窗口设置在其他应用程序之上."(” sets application window on top other applications. “)视频压缩质量(Quality of video compression)“允许为视频捕获功能设置质量压缩."(” allows to set quality compression for video capturing functionality. “)关闭宽屏格式(Turn off wide screen format)"-默认情况下,Omega Red将可用的补丁程序设置为将屏幕比例更改为16/9,但是此选项允许禁用这些补丁程序."(” - by default, Omega Red sets available patches for changing proportion of screen to 16/9, but this option allows to disable these patches. “)当前语言:(Current language:)“可以更改当前语言.(” allows to change current language.)
“(")当前的配色方案:(Current colour schema:)“可以更改当前的配色方案.(” allows to change current colour schema.)
“(")触摸板秤(Touch pad scale)“允许更改游戏触摸板元素的比例,以适合适当的屏幕尺寸和手指尺寸.(” allows change scale of the game touch pad elements for suitable size of the screen and size of fingers.)
触摸板比例的162%:(162% of the touch pad scale:)
触摸板比例的78%:(78% of the touch pad scale:)
镶嵌(Tessellation)
欧米茄Red使用DirectX 11渲染仿真游戏.该技术支持现代图形卡的许多技术.其中之一是(Omega Red uses DirectX 11 for rendering of emulated game. This technology supports many techniques of the modern graphic cards. One of them is) 镶嵌(Tessellation) -一种在运行时提高网格质量的特殊技术.(- a special technique for uprising quality of the meshes at runtime.)
我已经通过添加特殊配置将镶嵌细分包含在Omega Red中(I have included tessellation into the Omega Red by adding special config)渲染架构(Rendering schema):(:)
结果具有下一个结果:(The result has the next results:)
默认(DEFAULT)
已镶嵌(TESSELLATED)
默认(DEFAULT)
已镶嵌(TESSELLATED)
FXAA(FXAA)
这个选项(This options)启用FXAA(Enable FXAA)允许打开或关闭抗锯齿后处理:(allows turn on or off anti-aliasing postprocessing:)
快速保存(Quick Saving)
Omega Red支持保存和加载当前游戏状态.通过添加快速保存和加载命令,我对其进行了改进:(Omega Red supports saving and loading of the current game state. I have improved it by adding quick saving and loading commands:)
Omega Red具有5个按顺序排列的快速保存插槽-最新的保存位置位于队列的前面,而最旧的保存位置位于队列的尾部.(Omega Red has 5 quick saving slots with queued order - the most new saving is placed in front of the queue and the oldest saving is placed in the tail of the queue.)
实体游戏板扩展了快速保存的其他功能-实体游戏板按钮的特殊组合可实现快速保存和快速加载:(Additional functionality of the quick saving is extended by physical game pad - quick saving and quick LOADING by the special combinations of buttons of the physical game pad:)
快速保存:(Quick saving:)开始+左肩(Start + Left Shoulder)
快速加载:(Quick loading:)开始+右肩(Start + Right Shoulder)
快速加载具有”(Quick loading has “)30秒规则(30 seconds rule)"-这表示如果下一次快速加载的时间少于上一次快速加载的时间,则Omega Red将加载上一个快速保存插槽的时间少于30秒.因此,可以通过单击组合来查看所有当前快速保存以搜索合适的快速保存位置(” - it means if time the next quick loading is less 30 seconds after the last one then Omega Red will load the previous quick saving slot. As a result, it is possible to review all current quick savings for searching the suitable one by clicking combination)开始+右肩(Start + Right Shoulder)一次又一次!(again and again!)
音频音量控制(Audio Volume Control)
Omega Red支持通过特殊的滑块音量和静音按钮控制渲染的音频音量:(Omega Red supports control of the rendered audio volume by special slider volume and mute button:)
该组件仅在本地音频渲染器的上下文中控制音频音量,而无需更改输出扬声器的音量!(This component controls audio volume only in context of the local audio renderer WITHOUT changing of output speakers volume!)
屏幕外模式(Off Screen Mode)
欧米茄Red具有在个人计算机的主桌面屏幕上呈现游戏视频和音频的功能.这是此PS2仿真器的正常模式.但是,经过一些研究,我决定改进模拟器的架构师-添加(Omega Red has a function for rendering of the gaming video and audio on the main desktop screen of personal computer. It is a normal mode of this PS2 emulator. However, after some research, I have decided to improve an architect of the emulator - add)通过RTSP协议通过LAN通过Android TV在远程设备上远程显示渲染游戏的新功能(the new functionality for remote displaying of the rendered game on the remote devices as Android TV via LAN by RTSP protocol).为了防止在使用个人计算机执行不同任务时可能出现的问题,我为Omega Red添加了一种特殊模式:(. For preventing of potential problems with using of personal computer with different tasks, I have added to Omega Red a special mode:)“屏幕外”(“Off screen”)通过参数命令启用(which is enabled by argument command) /OffScreen
.此模式将视频和音频的渲染输出从当前用户上下文重定向到RTSP服务器输入-结果,在本地个人计算机上,Omega Red PS2仿真器以隐藏状态启动并带有控件图标.可以从任务栏图标启动PS2游戏图像.游戏控制由物理游戏板管理.(. This mode redirects video and audio rendered outputs from the current user context into the RTSP server inputs - as a result, on the local personal computer, Omega Red PS2 emulator is launched in hidden state with control icons. PS2 game images can be launched from taskbar icon. Gameplay control is managed by physical game pad.)
快速加载图标(Fast Loading Icon)
Omega Red将参考保存在最后选择的游戏磁盘上,并在下一个应用程序会话中将其选中-在上次保存中很有可能继续进行最后一场游戏-(Omega Red keeps the reference on the last selected game disk and selects it in the next application session - there is high probability for continuing of the last game in the last saving -) Autosaving
.显示自动保存的图标可以通过单击该图标继续游戏.(. Displaying the icon of the autosaving allows to continue game by ONE click on this icon.)
PSP仿真器(PSP Emulator)
大约半年前,我在Steam上获得了” Valkyria Chronicles 4"的参考.我一直对” 4"号码感到困惑-很久以前,我曾在"女武神编年史"中扮演.但是,” Valkyria Chronicles 2"和” Valkyria Chronicles 3"又如何呢?这些游戏在游戏机上发布.对我来说最方便的是通过(About half year ago, I got reference on “Valkyria Chronicles 4” in Steam. I have been puzzled about “4” number - I played in “Valkyria Chronicles” long time ago. However, what about “Valkyria Chronicles 2” and “Valkyria Chronicles 3”? Those games were published on game consoles. The most accessible for me is PSP version via) 聚苯硫醚(PPSSPP) -但我不喜欢该模拟器的触摸控制.而且,我不希望有两个不同的程序来玩游戏并从一个程序切换到另一个程序.因此,我有一个主意-将PPSSPP模拟器添加到Omega Red中并为PS2和PSP游戏创建PLATFORM!我尝试了并且可行:(- but I have done not like touch control of that emulator. Moreover, I would not like to have TWO different programs for play games and switch from one to another. So, I have an idea - add PPSSPP emulator into the Omega Red and create PLATFORM for the PS2 and PSP games! I tried and it is workable:)
Google云端硬盘和YouTube(GoogleDrive and YouTube)
经过一段时间的研究,我决定添加Google帐户"绑定”-它允许包含Google服务的某些功能:GoogleDrive和YouTube-将游戏储蓄存储在"云"中,并轻松将录制的视频上传到您的YouTube帐户中.(After some time of research, I have decided to add Google account “binding” - it allows to include some functionality of the Google service: GoogleDrive and YouTube - storing game savings in the “Cloud” and easy uploading recorded video on your YouTube account.)
单击Google图标后,该应用程序将在当前的默认Internet浏览器中打开您的Google帐户,以将Omega Red与您的Google帐户"绑定":(After clicking on the Google icon, the application will open your Google account in the current default Internet browser for “binding” Omega Red with your Google account:)
在"绑定"后,所有储蓄都将获得用于营销"云"的Google云端硬盘图标,以保存访问权限:(After “binding”, all savings will have got GoogleDrive icon for marking “cloud” saving access:)
此外,您还可以从计算机上的Google云端硬盘下载节省的资源:(Also there is access to download savings from GoogleDrive on your computer:)
与YouTube帐户"绑定"后,特殊的YouTube图标将显示在Omega Red视频播放器中,用于直接在您的帐户中上传当前视频:(After “binding” with YouTube account, the special YouTube icon will be displayed in Omega Red video player for directly uploading the current video on your account:)
游戏播放流(YouTube,Facebook,Twitch)(Game Play Streaming (YouTube, Facebook, Twitch))
是的,这是一个疯狂的主意-将实时视频和音频游戏播放流添加到PS2/PSP仿真器中.(Yes, it is a real mad idea - add live video and audio game play streaming into the PS2/PSP emulator.)
此任务在以下几个方面很有趣:内部捕获视频和音频.常规流应用程序通常从屏幕捕获视频,并从音频扬声器捕获音频.但是,我决定更改概念-在仿真器级别添加流功能,以从Windows OS系统混合器的上下文中隔离视频和音频.(This task is interesting by the next aspects: inner capture video and audio. The regular streaming application usually captures video from screen and audio from audio speaker. However, I have decided to change conception - add streaming functionality on the level of the emulator for ISOLATION of the video and audio from context of the Windows OS system mixers.)
流功能包括两个部分:(Streaming functionality has two parts:)
- 配置视频和音频编码,以及选择用于现场直播的Internet流服务(Configuration video and audio encoding, and selection of the Internet streaming services for live broadcasting)
- 混音器的配置-将现场游戏的视频和音频与其他来源进行混音:麦克风,网络摄像头,JPG/PNG/GIF(动画)文件(Configuration of mixers - mixing live game play video and audio with additional sources: microphone, webcam, JPG/PNG/GIF(animated) files) 配置视频和音频编码:(Configuration video and audio encoding:)
流的配置已从选择捕获模式开始(Configuration of streaming has begun from selection of the capture mode) Streaming
.此模式允许选择流的视频和音频比特率.同样,可以选择目标流服务的地址或TYPE地址.(. This mode allows select video and audio bitrates of the streaming. Also, it is possible to select or TYPE address of the target streaming service.)
重要的是要指出(It is important to mark that)欧米茄红(Omega Red)支持开放和加密(SSL)连接!(supports open and ENCRYPTED (SSL) connection!)
Facebook的流媒体服务已经发布了下一个公告:(Streaming service of Facebook has published the next announcement:)
«正如去年4月宣布的那样,所有实时视频上传都必须在2019年5月1日之前使用RTMPS(通过TLS/SSL连接的RTMP),并且重要的是,开发人员必须花点时间在此日期之前确保其集成符合要求.(«As announced last April, all live video uploads will be required to use RTMPS (RTMP over a TLS/SSL connection) by May 1, 2019, and it’s important that developers take the time to ensure that their integration is compliant before this date.)
我们致力于保护Facebook平台的完整性,作为这项工作的一部分,我们要求实时视频上传使用RTMPS,因为它为视频内容提供了更高级别的安全性».(We’re committed to protecting the integrity of the Facebook platform, and as part of this work, we’re requiring that live video uploads use RTMPS as it provides a greater level of security for the video content».)
我认为对RTMPS的支持是非常有前景的,因此花了一些时间将OpenSSL添加到RTMP库.这是可行的! Facebook在加密连接上接收流!(I had decided that supporting of the RTMPS is very perspective and spent some time on adding OpenSSL to RTMP library. It is WORKABLE!!! Facebook receives streaming on the encrypted connection!)
流媒体已从按下图标开始(Streaming has begun from pressing on icon) Record/Streaming
:(:)
在开始录制/流媒体之后,可以使用调音台的配置:(Configuration of mixers have become available AFTER staring of the recording/streaming:)
媒体来源(Media sources)已在(has become available in)媒体(Media)面板-此扩展器菜单包含用于混合的视频和音频源.另外,可以添加JPG/PNG/GIF(动画)文件进行混合.(panel - this expander menu includes video and audio sources for mixing. In addition, it is possible add JPG/PNG/GIF(animated) files for mixing.)
对于麦克风,可以控制音频混合的比例.麦克风的选择通过单击检查按钮执行,混音由"音量"滑块控制.(For microphones, it is possible to control proportion of the audio mixing. Selection of the microphone is executed by click on check button, mixing is controlled by Volume slider.)
通过单击检查按钮选择网络摄像头,通过单击组合菜单选择网络摄像头视频的分辨率.(Selection of the webcam is executed by click on check button, resolution of the webcam video is selected by click on combo menu.)
混合的不透明度可以通过不透明度滑块控制.(Opacity of mixing can be controlled by Opacity slider.)
混合视频流的位置和大小可以在流传输时更改:(Position and size of the mixed video stream can be changed at streaming time:)
我的测试流:(My test streaming:)
PS1仿真器(PS1 Emulator)
经过一段时间的思考,我决定添加我的PlayStation系列第一个游戏机的项目模拟器.但是,我面临社区停止支持PCSX-Reloaded开源的问题-大约15到20年前就停止了对代码的支持,并且在基于DirectDraw的图形渲染器与WPF和DirectX 11技术方面存在集成问题.我已决定通过快速应对DirectX 11纹理,将渲染的视频从系统内存复制到视频内存,从而将WPF与PCSX-Reloaded绑定在一起.该解决方案无效,但是可以实现100%的兼容性,并且适合于第一个发行版.(After some time of thinking I have decided to add in my project emulator of the first game console of PlayStation line. However, I have faced with problem with stop supporting of the PCSX-Reloaded open source by community - code is stopped supporting about 15-20 years ago, and there is a problem to integrate graphic renderer on base DirectDraw with WPF and DirectX 11 texhnology. I have decided to bind the software renderer of PCSX-Reloaded with WPF by coping rendered video from system memory to video memory by fast coping of DirectX 11 texture. This solution is not effective, but it allows get 100% compatibility and is suitable for the first release.)
此外,我添加了两个与PCSX-Reloaded兼容的功能:(In addition, I have added two features for compatibility with PCSX-Reloaded:)
-
Visual vibration
-PlayStations的游戏手柄具有反馈功能,可将游戏玩家与游戏玩法更深入地融合在一起. Omega Red项目支持对游戏板控制的反馈,但是从触摸板进行反馈是PlayStation 6的绝佳功能:))但是,在研究PCSX-Reloaded的代码时,我发现了从游戏板仿真器到回调函数的引用图形渲染器!我发现通过渲染渲染图像来对游戏手柄的振动做出反应的想法很不错!结果,我在项目中添加了以下功能:(- game pad of PlayStations has feature of feed back which allows to more deep integrate gamer with gameplay. Omega Red project supports feed back for game pad control, but feed back from touch pad is fantastic feature of PlayStation 6:)) However, at time of research code of PCSX-Reloaded I had found reference on callback function from emulator of game pad to graphic renderer! I have found that idea to react on vibration of game pad by transformation of the rendered image is GREAT! As a result, I have added this features in my project:) -
Memory card shared
-原始的Omega Red项目会根据游戏光盘的唯一序列号为每个游戏创建存储卡,以防止覆盖另一游戏的节余.这种模式可用于PlayStation 2,因为游戏通常需要一张DVD,但是在PlayStation 1游戏中,将游戏状态从一个游戏光盘转移到另一个游戏光盘会出现问题-PlayStation 1上的许多游戏需要两个或多个磁盘.因此,我决定为所有PlayStation 1游戏添加一个共享的内存证书.(- original Omega Red project creates memory card for each game on base of the unique serial number of game disc for preventing of overwriting savings of one game by another. This schema is workable for PlayStation 2 because game is usually takes one DVD, but in case of PlayStation 1 games there is a problem with transfer game state from one game disc to another - many games on PlayStation 1 takes two or more disks. As result, I have decided add one shared memory cred for all PlayStation 1 games.)
另外,我添加了三个新功能:(In addition, I have added three new features:)
-
为实时游戏过程的视频编码选择恒定比特率:(Selection constant bitrate for video encoding of the live game process:) 目标记录文件的选择大小:(Selection size of the target recorded file:)
-
按组拆分BIOS和游戏光盘以用于PlayStation 1,PlayStation 2和PlayStation Portable:(Splitting BIOSs and game Discs by groups for PlayStation 1, PlayStation 2 and PlayStation Portable:)
-
在重复部分的开头显示当前BIOS和游戏光盘的名称:(Display names of the current BIOS and game disc in head of the releated sections:)
在下一个演示中可以看到所有三个平台上的游戏演示:(Demonstration of games on all three platforms you can see in the next demo:)
新的PS1图形渲染器(New PS1 graphic renderer)
经过一段时间的PS1代码测试,我发现软件渲染器有局限性-当我尝试在HD就绪720p的电视分辨率下扩展结果图像时,我发现其图像包含多边形和纹理的BIG像素伪像.合适的解决方案是在硬件上替换软件渲染器.但是,我发现PS1硬件渲染器的当前解决方案使用OpenGL驱动程序-这对我的项目Omega Red是个问题,因为它基于WPF,DirectX9和DIrectX11.我只找到一种解决方案-在DirectX11上编写新的图形渲染器!(After some time of testing PS1 code I have found that software renderer has limitation - while I had tried to expand the result image from TV resolution on HD ready 720p I found that its image contained BIG pixels artifacts of polygons and textures. The suitable solution is to replace software renderer on hardware one. However, I have found that the current solutions of hardware renderer for PS1 use OpenGL driver - it is a problem for my project Omega Red because it is based on WPF, DirectX9 and DIrectX11. I had found only one solution - write the new graphic renderer on DirectX11 !!!)
我的工作结果很好,而且很有远见:(The result of my work is good and very perspective:)
可以在下一个演示中比较这些渲染器的演示:(Demonstration of comparison these renderers you can see in the next demo:)
刷新帧率(Refresh frame rate)
该项目使用WPF C#框架作为模拟器渲染和显示图形上下文之间的中间层:render将场景绘制到纹理中,WPF框架将此纹理嵌入到用户界面中.将DirectX纹理嵌入到用户界面中是WPF图形驱动程序的``瓶颈''-WPF是为Windows XP SP2设计的,并在地下室DirectX9层中进行嵌入,DirectX9纹理使用CPU的功能.(This project uses WPF C# framework for intermediate layer between render of emulator and graphic context of display: render draws scene into the texture and WPF framework embed this texture into the user interface. Embedding of DirectX texture into the user interface is ‘bottleneck’ of WPF graphic driver - WPF was designed for Windows XP SP2 and has in basement DirectX9 layer, embedding DirectX9 texture uses CPU power.)
结果,CPU的负载增加了,CPU的等待时间也增加了-仿真器的音频流中变为静默暂停.通过跳过DirectX9纹理嵌入,可以减少CPU负载.当前的纹理更新频率可以通过选项"(As a result, loading of CPU is increased and latency of CPU is increased too - in audio stream of emulator become silence pauses. Decrease of CPU loading is possible by skipping of DirectX9 texture embedding. The current frequency of texture updating is possible to monitore by option “) Show frames per second
“:(":)
可以通过”(Frame updating is possible change by option “) Skip frame mode:
“:(":)
适用于PS1,PS2,PSP游戏的4K(2160p)分辨率(4K (2160p) resolution for PS1, PS2, PSP games)
大多数仿真器都有用于通过本机API(DirectX或OpenGL)渲染游戏场景的软件解决方案.结果,仿真器具有具有不同功能的图形引擎.其中之一是使用目标输出窗口分辨率进行渲染.该解决方案使用特殊的目标视频纹理作为PS1,PS2,PSP仿真器的目标渲染目标,并且此纹理的大小定义了虚拟摄像机的视图大小.(Most emulators have software solution for rendering game scence by native APIs: DirectX or OpenGL. As a result, emulators have graphic engine with the different functionality. One of them is rendering with the target output window resolution. This solution uses special target video texture as the target rendering destination for PS1, PS2, PSP emulators, and size of this texture defines view size of the virtual camera.)
目标渲染纹理的大小在配置大小中定义:(The size of target rendering texture is defined in config size:)
可以在视频中比较720р/2160р的渲染质量:(Quality of rendering with 720р / 2160р can be compared in video:)
恢复(Resume)
Omega Red是从简单的想法开始开发的,目的是改进原始的PCSX2仿真器并添加一些新功能.这是一种更加用户友好的解决方案,对PCSX2开发协会很有用.(Omega Red has been developed since a simple idea to improve the original PCSX2 emulator and add some new features. It is a more user friendly solution and can be useful for PCSX2 development society.)
兴趣点(Points of Interest)
在开发该项目的C#部分时,我面临着堆栈溢出的问题-在处理来自DVD映像程序的数据时,抛出了堆栈溢出类型的异常.经过研究,我发现原始的PCSX2项目通过C/C ++宏的组合生成MIPS转换器的代码.它允许快速生成有效代码,但是此代码具有递归结构,该结构消耗了进程的STACK.对于本机C/C ++,这不是问题,但是C#项目的STACK大小有限,对于PCSX2代码而言还不够.如何解决? -这很容易.有一个特殊的程序(At the time of development of the C# part of the project, I was faced with the problem of stack overflow - at the moment of the processing of data from DVD image program, throw out exception of stack overflow type. After some research, I found that the original PCSX2 project generates code of MIPS translators by combination of C/C++ macros. It allows fast generation of effective code, but this code has a recursive structure which consumes STACK of process. For native C/C++, it is not a problem, but C# projects has a limited size of STACK which IS NOT enough for PCSX2 code. How has it been resolved? - it is very easy. There is a special program “)editbin.exe(editbin.exe)“在允许编辑已编译程序的Visual Studio Pack中-参数”(” in Visual Studio pack which allows to edit the compiled program - argument “) /STACK:
“允许更改程序处理的堆栈.下一条命令在"构建后事件命令行"中执行:(” allows to change STACK of program process. Next command is executed in “Post-build event command line”:)
"$(DevEnvDir)..\..\VC\bin\editbin.exe" /STACK:6000000 "$(TargetPath)"
它将C#程序的STACK扩展到600万字节.(It expands STACK of C# program up to 6 million bytes.)
历史和更新(History and Updates)
2018/09/10:第一次更新(09/10/2018: First update)
- 添加 “(Added “)当前的配色方案:(Current colour schema:)“用于更改应用程序元素颜色的选项(” option for changing of the colour of application’s elements)
19/11/2018:第二次更新(19/11/2018: Second update)
- 将Omega Red Visual Studio项目从VS2013迁移到VS2017,并支持GSdx的最新更新.(Migrated Omega Red Visual Studio project from VS2013 to VS2017 with supporting the last updates of GSdx in the)
VideoRenderer
项目.(project.) - 添加 “(Added “)触摸板秤(Touch pad scale)“选项,用于更改游戏触摸板元素以适合屏幕大小和手指大小.(” option for changing of the game touch pad elements for suitable size of the screen and size of fingers.)
- 添加(Added)
MediaStream
用于实施”(project for implementing of the RTSP Server of the “)生活(Live)当前游戏的流功能.(” streaming functionality of the current game.)
11/02/2019:第三次更新(11/02/2019: Third update)
- 添加 “(Added “)镶嵌(Tessellation)“配置.(” config.)
- 添加 “(Added “)音量控制(Audio volume control)” 零件.(” component.)
- 添加 “(Added “)快速保存(Quick saving)” 零件.(” component.)
- 通过添加远程显示(Added remote displaying via)RTSP服务器(RTSP Server)支持.(supporting.)
02/04/2019:第四次更新(02/04/2019: Fourth update)
- 添加 “(Added “)启用FXAA(Enable FXAA)“为(” for)
PCSX2
- 添加 “(Added “)快速加载图标(Fast loading icon)"(")
- 添加(Added)
PPSSPP
仿真器(emulator)
27/06/2019:第五次更新(27/06/2019: Fifth update)
- 添加了GoogleDrive和YouTube支持(Added GoogleDrive and YouTube supporting)
- 添加了游戏播放流功能(Added game play streaming functionality)
25/11/2019:第六次更新(25/11/2019: Sixth update)
- 添加(Added)
PCSX-Reloaded
PlayStation 1的模拟器(emulator of PlayStation 1) - 添加 “(Added “)启用视觉振动(Visual vibration is enabled)"(")
- 添加了共享存储卡(Added shared memory card)
- 添加了选择视频编码器的比特率(Added selection video encoder bitrate)
- 增加了记录文件的选择大小(Added selection size of recorded file)
- 添加了BIOS和游戏光盘的分组(Added grouping of BIOSs and game discs)
- 在重复部分的开头添加了当前BIOS和游戏光盘的显示名称(Added displaing names of the current BIOS and game disc in head of the releated sections)
2020年1月21日:第七次更新(21/01/2020: Seventh update)
- 在PlayStation 1的模拟器中替换DirectX 11渲染器上的软件渲染器.(Replace software renderer on DirectX 11 renderer in emulator of PlayStation 1.)
13/07/2020:第八次更新(13/07/2020: Eightth update)
- 欧米茄红色视频指南;(Video guide for Omega Red;)
- 加(Add) [刷新帧率(Refresh frame rate)](https://www.codeproject.com#Refresh frame rate) ;(;)
- 游戏垫支持.(Game pad supporting.)
2020年3月8日:第九次更新(03/08/2020: Nineth update)
- 增加了选择渲染分辨率:710p,1080p,1440p,2160p(Added choice rendering resolutions: 710p, 1080p, 1440p, 2160p)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C# XML C++ Windows hardware WPF threads 新闻 翻译