imgui: Update font. Test ROM status line.
This commit is contained in:
parent
c9f1e8d79b
commit
b11ecf932a
20
external/imgui/snes9x_imgui.cpp
vendored
20
external/imgui/snes9x_imgui.cpp
vendored
@ -1,9 +1,10 @@
|
||||
#include "snes9x_imgui.h"
|
||||
#include "snes9x_imgui_vera.h"
|
||||
#include "snes9x_imgui_noto.h"
|
||||
#include "imgui.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <array>
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "port.h"
|
||||
@ -20,12 +21,14 @@ namespace
|
||||
static void ImGui_DrawPressedKeys(int spacing)
|
||||
{
|
||||
|
||||
const char *keynames[] = { " ", " ", " ", "R", "L", "X", "A", "→", "←", "↓", "↑", "S", "s", "Y", "B" };
|
||||
const int keyorder[] = { 8, 10, 7, 9, 0, 6, 14, 13, 5, 1, 4, 3, 2, 11, 12 }; // < ^ > v A B Y X L R S s
|
||||
const std::array<const char *, 15> keynames =
|
||||
{ " ", " ", " ", "R", "L", "X", "A", "→", "←", "↓", "↑", "St", "Sel", "Y", "B" };
|
||||
const std::array<int, 12> keyorder =
|
||||
{ 10, 9, 8, 7, 6, 14, 13, 5, 4, 3, 11, 12 }; // < ^ > v A B Y X L R S s
|
||||
|
||||
enum controllers controller;
|
||||
int num_lines = 0;
|
||||
int cell_width = ImGui::CalcTextSize("--").x;
|
||||
int cell_width = ImGui::CalcTextSize("→ ").x;
|
||||
int8_t ids[4];
|
||||
std::string final_string;
|
||||
|
||||
@ -77,7 +80,7 @@ static void ImGui_DrawPressedKeys(int spacing)
|
||||
case CTL_JOYPAD: {
|
||||
std::string prefix = "#" + std::to_string(port + 1) + " ";
|
||||
auto prefix_size = ImGui::CalcTextSize(prefix.c_str());
|
||||
int box_width = 2 * spacing + prefix_size.x + cell_width * 15;
|
||||
int box_width = 2 * spacing + prefix_size.x + cell_width * keyorder.size();
|
||||
int box_height = 2 * spacing + prefix_size.y;
|
||||
int x = (ImGui::GetIO().DisplaySize.x - box_width) / 2;
|
||||
int y = ImGui::GetIO().DisplaySize.y - (spacing + box_height) * num_lines;
|
||||
@ -93,7 +96,7 @@ static void ImGui_DrawPressedKeys(int spacing)
|
||||
x += prefix_size.x;
|
||||
|
||||
uint16 pad = MovieGetJoypad(ids[0]);
|
||||
for (int i = 0; i < 15; i++)
|
||||
for (size_t i = 0; i < keyorder.size(); i++)
|
||||
{
|
||||
int j = keyorder[i];
|
||||
int mask = (1 << (j + 1));
|
||||
@ -272,8 +275,9 @@ void S9xImGuiInit(S9xImGuiInitInfo *init_info)
|
||||
ImFontGlyphRangesBuilder builder;
|
||||
builder.Clear();
|
||||
builder.AddRanges(ImGui::GetIO().Fonts->GetGlyphRangesDefault());
|
||||
builder.AddText("↑←↓→▶❚");
|
||||
builder.AddRanges(ImGui::GetIO().Fonts->GetGlyphRangesJapanese());
|
||||
builder.AddText("←↑→↓▶❚");
|
||||
ranges.clear();
|
||||
builder.BuildRanges(&ranges);
|
||||
ImGui::GetIO().Fonts->AddFontFromMemoryCompressedBase85TTF(imgui_roboto_font_compressed_data_base85, settings.font_size, nullptr, ranges.Data);
|
||||
ImGui::GetIO().Fonts->AddFontFromMemoryCompressedBase85TTF(imgui_noto_font_compressed_data_base85, settings.font_size, nullptr, ranges.Data);
|
||||
}
|
||||
|
3992
external/imgui/snes9x_imgui_noto.h
vendored
Normal file
3992
external/imgui/snes9x_imgui_noto.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4424
external/imgui/snes9x_imgui_vera.h
vendored
4424
external/imgui/snes9x_imgui_vera.h
vendored
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,9 @@
|
||||
#include "gfx.h"
|
||||
#include "memmap.h"
|
||||
#include "ppu.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
static void S9xThrottle(int);
|
||||
static void S9xCheckPointerTimer();
|
||||
@ -351,7 +354,6 @@ static bool S9xScreenSaverCheckFunc()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Snes9x core hooks */
|
||||
void S9xMessage(int type, int number, const char *message)
|
||||
{
|
||||
@ -360,6 +362,11 @@ void S9xMessage(int type, int number, const char *message)
|
||||
case S9X_MOVIE_INFO:
|
||||
S9xSetInfoString(message);
|
||||
break;
|
||||
case S9X_ROM_INFO:
|
||||
{
|
||||
S9xSetInfoString(Memory.GetMultilineROMInfo().c_str());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
45
memmap.cpp
45
memmap.cpp
@ -5,6 +5,8 @@
|
||||
\*****************************************************************************/
|
||||
|
||||
#include <string>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <numeric>
|
||||
#include <assert.h>
|
||||
|
||||
@ -3266,7 +3268,7 @@ const char * CMemory::StaticRAMSize (void)
|
||||
if (SRAMSize > 16)
|
||||
strcpy(str, "Corrupt");
|
||||
else
|
||||
sprintf(str, "%dKbits", 8 * (SRAMMask + 1) / 1024);
|
||||
sprintf(str, "%d Kbit", 8 * (SRAMMask + 1) / 1024);
|
||||
|
||||
return (str);
|
||||
}
|
||||
@ -3280,7 +3282,7 @@ const char * CMemory::Size (void)
|
||||
else if (ROMSize < 7 || ROMSize - 7 > 23)
|
||||
strcpy(str, "Corrupt");
|
||||
else
|
||||
sprintf(str, "%dMbits", 1 << (ROMSize - 7));
|
||||
sprintf(str, "%d Mbit", 1 << (ROMSize - 7));
|
||||
|
||||
return (str);
|
||||
}
|
||||
@ -3374,6 +3376,45 @@ const char * CMemory::PublishingCompany (void)
|
||||
return (nintendo_licensees[CompanyId]);
|
||||
}
|
||||
|
||||
static std::string sjis_to_utf8(std::string in)
|
||||
{
|
||||
std::string out;
|
||||
for (const auto &i : in)
|
||||
{
|
||||
unsigned char c = i;
|
||||
if (c > 160 && c < 192)
|
||||
out += "\357\275";
|
||||
else if (c >= 192)
|
||||
{
|
||||
out += "\357\276";
|
||||
c -= 0x40;
|
||||
}
|
||||
out += c;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string CMemory::GetMultilineROMInfo()
|
||||
{
|
||||
bool8 isChecksumOK = (Memory.ROMChecksum + Memory.ROMComplementChecksum == 0xffff) &&
|
||||
(Memory.ROMChecksum == Memory.CalculatedChecksum);
|
||||
std::string utf8_romname = sjis_to_utf8(Memory.ROMName);
|
||||
std::string tvstandard = Settings.PAL ? "PAL" : "NTSC";
|
||||
std::string checksum = isChecksumOK ? "Checksum OK"
|
||||
: Settings.IsPatched == 3 ? "UPS patched"
|
||||
: Settings.IsPatched == 2 ? "BPS patched"
|
||||
: Settings.IsPatched == 1 ? "IPS patched"
|
||||
: "Invalid Checksum";
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "\"" << utf8_romname << "\" (" + tvstandard + ") version " << Memory.Revision() << "\n";
|
||||
ss << Memory.KartContents() << ": " << Memory.MapType() << ": " << Memory.Size() << ", SRAM: " << Memory.StaticRAMSize() << "\n";
|
||||
ss << "ID: " << Memory.ROMId << ", CRC32: " << std::setfill('0') << std::setw(8) << std::setbase(16) << Memory.ROMCRC32 << ", " << checksum;
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
void CMemory::MakeRomInfoText (char *romtext)
|
||||
{
|
||||
char temp[256];
|
||||
|
Loading…
Reference in New Issue
Block a user