forked from sin365/AxibugEmuOnline
Compare commits
2 Commits
5a5741a185
...
7eaa208c78
| Author | SHA1 | Date | |
|---|---|---|---|
| 7eaa208c78 | |||
| 0628c4439d |
@ -7,18 +7,30 @@ namespace AxibugEmuOnline.Client
|
|||||||
{
|
{
|
||||||
GameObject gameObject { get; }
|
GameObject gameObject { get; }
|
||||||
|
|
||||||
|
/// <summary> 获得模拟器核心中的状态快照对象 </summary>
|
||||||
object GetState();
|
object GetState();
|
||||||
|
/// <summary> 获得模拟器核心中的状态快照字节数据 </summary>
|
||||||
byte[] GetStateBytes();
|
byte[] GetStateBytes();
|
||||||
|
/// <summary> 加载状态快照 </summary>
|
||||||
|
/// <param name="state">该对象应该来自核心的<see cref="GetState"/>方法的返回值,或是从<see cref="GetStateBytes"/>返回的byte数组构建</param>
|
||||||
void LoadState(object state);
|
void LoadState(object state);
|
||||||
|
/// <summary> 加载状态快照 </summary>
|
||||||
|
/// <param name="data">该对象应该来自核心的<see cref="GetStateBytes"/>返回的byte数组</param>
|
||||||
void LoadStateFromBytes(byte[] data);
|
void LoadStateFromBytes(byte[] data);
|
||||||
|
/// <summary> 暂停核心推帧 </summary>
|
||||||
void Pause();
|
void Pause();
|
||||||
|
/// <summary> 恢复核心推帧(从Pause状态恢复) </summary>
|
||||||
void Resume();
|
void Resume();
|
||||||
void SetupScheme();
|
/// <summary> 启动模拟器逻辑 </summary>
|
||||||
MsgBool StartGame(RomFile romFile);
|
MsgBool StartGame(RomFile romFile);
|
||||||
|
/// <summary> 重置核心,通常由模拟器核心提供的功能 </summary>
|
||||||
void DoReset();
|
void DoReset();
|
||||||
|
/// <summary> 获得模拟器核心的控制器设置器 </summary>
|
||||||
|
/// <returns></returns>
|
||||||
IControllerSetuper GetControllerSetuper();
|
IControllerSetuper GetControllerSetuper();
|
||||||
|
/// <summary> 核心所属平台 </summary>
|
||||||
RomPlatformType Platform { get; }
|
RomPlatformType Platform { get; }
|
||||||
|
/// <summary> 获取当前模拟器帧序号,在加载快照和Reset后,应当重置为0 </summary>
|
||||||
uint Frame { get; }
|
uint Frame { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ namespace AxibugEmuOnline.Client.Manager
|
|||||||
LaunchUI.Instance.HideMainMenu();
|
LaunchUI.Instance.HideMainMenu();
|
||||||
InGameUI.Instance.Show(romFile, m_emuCore);
|
InGameUI.Instance.Show(romFile, m_emuCore);
|
||||||
|
|
||||||
m_emuCore.SetupScheme();
|
CommandDispatcher.Instance.Current = CommandDispatcher.Instance.Gaming;
|
||||||
|
|
||||||
m_controllerSetuper = m_emuCore.GetControllerSetuper();
|
m_controllerSetuper = m_emuCore.GetControllerSetuper();
|
||||||
|
|
||||||
|
|||||||
@ -103,11 +103,6 @@ namespace AxibugEmuOnline.Client
|
|||||||
NesCore.Reset();
|
NesCore.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetupScheme()
|
|
||||||
{
|
|
||||||
CommandDispatcher.Instance.Current = CommandDispatcher.Instance.Gaming;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadState(object state)
|
public void LoadState(object state)
|
||||||
{
|
{
|
||||||
NesCore.LoadState((State)state);
|
NesCore.LoadState((State)state);
|
||||||
|
|||||||
@ -0,0 +1,80 @@
|
|||||||
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using static AxibugEmuOnline.Client.ScreenScaler;
|
||||||
|
|
||||||
|
namespace AxibugEmuOnline.Client
|
||||||
|
{
|
||||||
|
public class InGameUI_Scaler : ExpandMenu
|
||||||
|
{
|
||||||
|
private List<OptionMenu> m_subMenus = new List<OptionMenu>();
|
||||||
|
|
||||||
|
public InGameUI_Scaler(InGameUI inGameUI) : base("屏幕比例", null)
|
||||||
|
{
|
||||||
|
m_subMenus.Add(new Scale(inGameUI, null));
|
||||||
|
foreach (EnumScalerMode scaleModeValue in Enum.GetValues(typeof(EnumScalerMode)))
|
||||||
|
{
|
||||||
|
m_subMenus.Add(new Scale(inGameUI, scaleModeValue));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override List<OptionMenu> GetOptionMenus()
|
||||||
|
{
|
||||||
|
return m_subMenus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Scale : ExecuteMenu
|
||||||
|
{
|
||||||
|
private EnumScalerMode? m_mode;
|
||||||
|
private InGameUI m_gameUI;
|
||||||
|
|
||||||
|
public override bool IsApplied
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (m_gameUI.Core.IsNull()) return false;
|
||||||
|
|
||||||
|
var isSetMode = App.settings.ScreenScaler.IsSetMode(m_gameUI.Core.Platform);
|
||||||
|
|
||||||
|
if (m_mode == null && !isSetMode)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (isSetMode && m_mode.HasValue)
|
||||||
|
{
|
||||||
|
var mode = App.settings.ScreenScaler.GetMode(m_gameUI.Core.Platform);
|
||||||
|
return mode == m_mode.Value;
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Scale(InGameUI inGameUI, EnumScalerMode? mode) : base(ModeToName(mode), null)
|
||||||
|
{
|
||||||
|
m_mode = mode;
|
||||||
|
m_gameUI = inGameUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnExcute(OptionUI optionUI, ref bool cancelHide)
|
||||||
|
{
|
||||||
|
App.settings.ScreenScaler.SetMode(m_gameUI.Core.Platform, m_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
static string ModeToName(EnumScalerMode? mode)
|
||||||
|
{
|
||||||
|
if (mode == null) return "使用全局设置";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (mode.Value)
|
||||||
|
{
|
||||||
|
case EnumScalerMode.FullScreen: return "全屏";
|
||||||
|
case EnumScalerMode.Raw: return "原始尺寸";
|
||||||
|
case EnumScalerMode.Fix: return "适应";
|
||||||
|
default: throw new Exception($"Not Support Mode : {mode.Value}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2703b2b6867eb344386509ff36bf1459
|
||||||
Loading…
Reference in New Issue
Block a user