mirror of
https://github.com/libretro/Mesen.git
synced 2024-11-23 09:09:45 +00:00
Region: Display active region when loading game and changing regions from the menu
This commit is contained in:
parent
ac69be19a5
commit
aa3767b086
@ -71,6 +71,7 @@ void Console::Initialize(string romFilename, stringstream *filestream, string ip
|
||||
_memoryManager->RegisterIODevice(_controlManager.get());
|
||||
_memoryManager->RegisterIODevice(_mapper.get());
|
||||
|
||||
_model = NesModel::Auto;
|
||||
UpdateNesModel(false);
|
||||
|
||||
_initialized = true;
|
||||
@ -85,7 +86,10 @@ void Console::Initialize(string romFilename, stringstream *filestream, string ip
|
||||
VideoDecoder::GetInstance()->StartThread();
|
||||
|
||||
FolderUtilities::AddKnowGameFolder(FolderUtilities::GetFolderName(romFilename));
|
||||
MessageManager::DisplayMessage("GameLoaded", FolderUtilities::GetFilename(_mapper->GetRomName(), false));
|
||||
|
||||
string modelName = _model == NesModel::PAL ? "PAL" : (_model == NesModel::Dendy ? "Dendy" : "NTSC");
|
||||
string messageTitle = MessageManager::Localize("GameLoaded") + " (" + modelName + ")";
|
||||
MessageManager::DisplayMessage(messageTitle, FolderUtilities::GetFilename(_mapper->GetRomName(), false));
|
||||
if(EmulationSettings::GetOverclockRate() != 100) {
|
||||
MessageManager::DisplayMessage("ClockRate", std::to_string(EmulationSettings::GetOverclockRate()) + "%");
|
||||
}
|
||||
@ -258,9 +262,7 @@ void Console::Run()
|
||||
_runLock.Acquire();
|
||||
_stopLock.Acquire();
|
||||
|
||||
_model = NesModel::Auto;
|
||||
|
||||
targetTime = UpdateNesModel(false);
|
||||
targetTime = GetFrameDelay();
|
||||
|
||||
VideoDecoder::GetInstance()->StartThread();
|
||||
|
||||
@ -314,7 +316,9 @@ void Console::Run()
|
||||
|
||||
//Get next target time, and adjust based on whether we are ahead or behind
|
||||
double timeLag = EmulationSettings::GetEmulationSpeed() == 0 ? 0 : clockTimer.GetElapsedMS() - targetTime;
|
||||
targetTime = UpdateNesModel(true);
|
||||
UpdateNesModel(true);
|
||||
targetTime = GetFrameDelay();
|
||||
|
||||
clockTimer.Reset();
|
||||
targetTime -= timeLag;
|
||||
if(targetTime < 0) {
|
||||
@ -349,7 +353,7 @@ bool Console::IsRunning()
|
||||
return !Instance->_stopLock.IsFree();
|
||||
}
|
||||
|
||||
double Console::UpdateNesModel(bool sendNotification)
|
||||
void Console::UpdateNesModel(bool sendNotification)
|
||||
{
|
||||
bool configChanged = false;
|
||||
if(EmulationSettings::NeedControllerUpdate()) {
|
||||
@ -358,7 +362,6 @@ double Console::UpdateNesModel(bool sendNotification)
|
||||
}
|
||||
|
||||
NesModel model = EmulationSettings::GetNesModel();
|
||||
uint32_t emulationSpeed = EmulationSettings::GetEmulationSpeed();
|
||||
if(model == NesModel::Auto) {
|
||||
switch(_mapper->GetGameSystem()) {
|
||||
case GameSystem::NesPal: model = NesModel::PAL; break;
|
||||
@ -369,20 +372,10 @@ double Console::UpdateNesModel(bool sendNotification)
|
||||
if(_model != model) {
|
||||
_model = model;
|
||||
configChanged = true;
|
||||
}
|
||||
|
||||
double frameDelay;
|
||||
if(emulationSpeed == 0) {
|
||||
frameDelay = 0;
|
||||
} else {
|
||||
//60.1fps (NTSC), 50.01fps (PAL/Dendy)
|
||||
switch(model) {
|
||||
default:
|
||||
case NesModel::NTSC: frameDelay = 16.63926405550947; break;
|
||||
case NesModel::PAL:
|
||||
case NesModel::Dendy: frameDelay = 19.99720920217466; break;
|
||||
|
||||
if(sendNotification) {
|
||||
MessageManager::DisplayMessage("Region", model == NesModel::PAL ? "PAL" : (model == NesModel::Dendy ? "Dendy" : "NTSC"));
|
||||
}
|
||||
frameDelay /= (double)emulationSpeed / 100.0;
|
||||
}
|
||||
|
||||
_mapper->SetNesModel(model);
|
||||
@ -392,6 +385,24 @@ double Console::UpdateNesModel(bool sendNotification)
|
||||
if(configChanged && sendNotification) {
|
||||
MessageManager::SendNotification(ConsoleNotificationType::ConfigChanged);
|
||||
}
|
||||
}
|
||||
|
||||
double Console::GetFrameDelay()
|
||||
{
|
||||
uint32_t emulationSpeed = EmulationSettings::GetEmulationSpeed();
|
||||
double frameDelay;
|
||||
if(emulationSpeed == 0) {
|
||||
frameDelay = 0;
|
||||
} else {
|
||||
//60.1fps (NTSC), 50.01fps (PAL/Dendy)
|
||||
switch(_model) {
|
||||
default:
|
||||
case NesModel::NTSC: frameDelay = 16.63926405550947; break;
|
||||
case NesModel::PAL:
|
||||
case NesModel::Dendy: frameDelay = 19.99720920217466; break;
|
||||
}
|
||||
frameDelay /= (double)emulationSpeed / 100.0;
|
||||
}
|
||||
|
||||
return frameDelay;
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ class Console
|
||||
|
||||
void ResetComponents(bool softReset);
|
||||
void Initialize(string filename, stringstream *filestream = nullptr, string ipsFilename = "", int32_t archiveFileIndex = -1);
|
||||
double UpdateNesModel(bool sendNotification);
|
||||
void UpdateNesModel(bool sendNotification);
|
||||
double GetFrameDelay();
|
||||
|
||||
public:
|
||||
Console();
|
||||
|
@ -14,6 +14,7 @@ std::unordered_map<string, string> MessageManager::_enResources = {
|
||||
{ "GameLoaded", u8"Game loaded" },
|
||||
{ "Movies", u8"Movies" },
|
||||
{ "NetPlay", u8"Net Play" },
|
||||
{ "Region", u8"Region" },
|
||||
{ "SaveStates", u8"Save States" },
|
||||
{ "ScreenshotSaved", u8"Screenshot Saved" },
|
||||
{ "SoundRecorder", u8"Sound Recorder" },
|
||||
@ -74,6 +75,7 @@ std::unordered_map<string, string> MessageManager::_frResources = {
|
||||
{ "GameLoaded", u8"Jeu chargé" },
|
||||
{ "Movies", u8"Films" },
|
||||
{ "NetPlay", u8"Jeu en ligne" },
|
||||
{ "Region", u8"Région" },
|
||||
{ "SaveStates", u8"Sauvegardes" },
|
||||
{ "ScreenshotSaved", u8"Capture d'écran" },
|
||||
{ "SoundRecorder", u8"Enregistreur audio" },
|
||||
@ -134,6 +136,7 @@ std::unordered_map<string, string> MessageManager::_jaResources = {
|
||||
{ "GameLoaded", u8"ゲーム開始" },
|
||||
{ "Movies", u8"動画" },
|
||||
{ "NetPlay", u8"ネットプレー" },
|
||||
{ "Region", u8"地域" },
|
||||
{ "SaveStates", u8"クイックセーブ" },
|
||||
{ "ScreenshotSaved", u8"スクリーンショット" },
|
||||
{ "SoundRecorder", u8"サウンドレコーダー" },
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user