diff --git a/higan/emulator/emulator.hpp b/higan/emulator/emulator.hpp index 0e932bd1..42179bef 100755 --- a/higan/emulator/emulator.hpp +++ b/higan/emulator/emulator.hpp @@ -3,7 +3,7 @@ namespace Emulator { static const char Name[] = "higan"; - static const char Version[] = "091.14"; + static const char Version[] = "091.15"; static const char Author[] = "byuu"; static const char License[] = "GPLv3"; } diff --git a/higan/nall/string/utility.hpp b/higan/nall/string/utility.hpp index b2f93d2c..0225e4fe 100755 --- a/higan/nall/string/utility.hpp +++ b/higan/nall/string/utility.hpp @@ -74,7 +74,8 @@ char* integer(char *result, intmax_t value) { buffer[size++] = '0' + n; value /= 10; } while(value); - buffer[size++] = negative ? '-' : '+'; + if(negative) buffer[size++] = '-'; +//buffer[size++] = negative ? '-' : '+'; for(signed x = size - 1, y = 0; x >= 0 && y < size; x--, y++) result[x] = buffer[y]; result[size] = 0; @@ -110,7 +111,8 @@ template string integer(intmax_t value) { buffer[size++] = '0' + n; value /= 10; } while(value); - buffer[size++] = negative ? '-' : '+'; + if(negative) buffer[size++] = '-'; +//buffer[size++] = negative ? '-' : '+'; buffer[size] = 0; unsigned length = (length_ == 0 ? size : length_); @@ -137,7 +139,8 @@ template string linteger(intmax_t value) { buffer[size++] = '0' + n; value /= 10; } while(value); - buffer[size++] = negative ? '-' : '+'; + if(negative) buffer[size++] = '-'; +//buffer[size++] = negative ? '-' : '+'; buffer[size] = 0; unsigned length = (length_ == 0 ? size : length_); diff --git a/higan/phoenix/core/core.cpp b/higan/phoenix/core/core.cpp index caa326b4..a2588770 100755 --- a/higan/phoenix/core/core.cpp +++ b/higan/phoenix/core/core.cpp @@ -173,6 +173,10 @@ void OS::quit() { return pOS::quit(); } +void OS::setName(const string &name) { + osState.name = name; +} + void OS::initialize() { static bool initialized = false; if(initialized == false) { diff --git a/higan/phoenix/core/core.hpp b/higan/phoenix/core/core.hpp index dbf53a73..1b329f85 100755 --- a/higan/phoenix/core/core.hpp +++ b/higan/phoenix/core/core.hpp @@ -143,13 +143,14 @@ struct Object { pObject &p; }; -struct OS : Object { +struct OS { static void main(); static bool pendingEvents(); static void processEvents(); static void quit(); + static void setName(const nall::string &name); - OS(); + struct State; static void initialize(); }; diff --git a/higan/phoenix/core/state.hpp b/higan/phoenix/core/state.hpp index 2d46ca2f..a4bff751 100755 --- a/higan/phoenix/core/state.hpp +++ b/higan/phoenix/core/state.hpp @@ -1,3 +1,10 @@ +struct OS::State { + string name; + + State() { + } +} osState; + struct Timer::State { bool enabled; unsigned milliseconds; diff --git a/higan/phoenix/gtk/window.cpp b/higan/phoenix/gtk/window.cpp index b2457b5e..4518c38a 100755 --- a/higan/phoenix/gtk/window.cpp +++ b/higan/phoenix/gtk/window.cpp @@ -296,6 +296,15 @@ void pWindow::constructor() { widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); + //if program was given a name, try and set the window taskbar icon from one of the pixmaps folders + if(osState.name.empty() == false) { + if(file::exists({"/usr/share/pixmaps/", osState.name, ".png"})) { + gtk_window_set_icon_from_file(GTK_WINDOW(widget), string{"/usr/share/pixmaps/", osState.name, ".png"}, nullptr); + } else if(file::exists({"/usr/local/share/pixmaps/", osState.name, ".png"})) { + gtk_window_set_icon_from_file(GTK_WINDOW(widget), string{"/usr/local/share/pixmaps/", osState.name, ".png"}, nullptr); + } + } + if(gdk_screen_is_composited(gdk_screen_get_default())) { gtk_widget_set_colormap(widget, gdk_screen_get_rgba_colormap(gdk_screen_get_default())); } else { diff --git a/higan/phoenix/qt/platform.moc b/higan/phoenix/qt/platform.moc index b02a5cd0..2a53a326 100755 --- a/higan/phoenix/qt/platform.moc +++ b/higan/phoenix/qt/platform.moc @@ -1,7 +1,7 @@ /**************************************************************************** ** Meta object code from reading C++ file 'platform.moc.hpp' ** -** Created: Fri Dec 21 17:46:20 2012 +** Created: Wed Dec 26 00:12:14 2012 ** by: The Qt Meta Object Compiler version 62 (Qt 4.6.3) ** ** WARNING! All changes made in this file will be lost! diff --git a/higan/phoenix/qt/window.cpp b/higan/phoenix/qt/window.cpp index c6cb35d6..dac311ee 100755 --- a/higan/phoenix/qt/window.cpp +++ b/higan/phoenix/qt/window.cpp @@ -179,6 +179,15 @@ void pWindow::constructor() { qtWindow = new QtWindow(*this); qtWindow->setWindowTitle(" "); + //if program was given a name, try and set the window taskbar icon to a matching pixmap image + if(osState.name.empty() == false) { + if(file::exists({"/usr/share/pixmaps/", osState.name, ".png"})) { + qtWindow->setWindowIcon(QIcon(string{"/usr/share/pixmaps/", osState.name, ".png"})); + } else if(file::exists({"/usr/local/share/pixmaps/", osState.name, ".png"})) { + qtWindow->setWindowIcon(QIcon(string{"/usr/local/share/pixmaps/", osState.name, ".png"})); + } + } + qtLayout = new QVBoxLayout(qtWindow); qtLayout->setMargin(0); qtLayout->setSpacing(0); diff --git a/higan/phoenix/windows/widget/button.cpp b/higan/phoenix/windows/widget/button.cpp index 41e7e283..12cacbe5 100755 --- a/higan/phoenix/windows/widget/button.cpp +++ b/higan/phoenix/windows/widget/button.cpp @@ -63,10 +63,25 @@ void pButton::setImage(const image &image, Orientation orientation) { } Button_SetImageList(hwnd, &list); } + + setText(button.state.text); //update text to display nicely with image (or lack thereof) } void pButton::setText(const string &text) { - SetWindowText(hwnd, utf16_t(text)); + if(text.empty()) { + //bitmaps will not show up if text is empty + SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | BS_BITMAP); + } else { + //text will not show up if BS_BITMAP is set + SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~BS_BITMAP); + } + + if(OsVersion() >= WindowsVista && button.state.image.empty() == false && text.empty() == false) { + //Vista+ does not add spacing between the icon and text; causing them to run into each other + SetWindowText(hwnd, utf16_t(string{" ", text})); + } else { + SetWindowText(hwnd, utf16_t(text)); + } } void pButton::constructor() { @@ -74,7 +89,7 @@ void pButton::constructor() { SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&button); setDefaultFont(); setImage(button.state.image, button.state.orientation); - setText(button.state.text); +//setText(button.state.text); //called by setImage(); synchronize(); } diff --git a/higan/sfc/cartridge/cartridge.cpp b/higan/sfc/cartridge/cartridge.cpp index 9f76bc61..6be424f7 100755 --- a/higan/sfc/cartridge/cartridge.cpp +++ b/higan/sfc/cartridge/cartridge.cpp @@ -9,22 +9,18 @@ Cartridge cartridge; string Cartridge::title() { if(information.title.gameBoy.empty() == false) { - return information.title.gameBoy; + return {information.title.cartridge, " + ", information.title.gameBoy}; } if(information.title.satellaview.empty() == false) { - if(has_bs_cart()) { - return information.title.satellaview; - } else { - return {information.title.cartridge, " + ", information.title.satellaview}; - } + return {information.title.cartridge, " + ", information.title.satellaview}; } if(information.title.sufamiTurboA.empty() == false) { if(information.title.sufamiTurboB.empty() == true) { - return information.title.sufamiTurboA; + return {information.title.cartridge, " + ", information.title.sufamiTurboA}; } else { - return {information.title.sufamiTurboA, " + ", information.title.sufamiTurboB}; + return {information.title.cartridge, " + ", information.title.sufamiTurboA, " + ", information.title.sufamiTurboB}; } } diff --git a/higan/sfc/chip/event-skeleton/event.cpp b/higan/sfc/chip/event-skeleton/event.cpp deleted file mode 100644 index 8b5ba938..00000000 --- a/higan/sfc/chip/event-skeleton/event.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include - -#define EVENT_CPP -namespace SuperFamicom { - -Event event; - -void Event::Enter() { event.enter(); } - -void Event::enter() { - while(true) { - if(scheduler.sync == Scheduler::SynchronizeMode::All) { - scheduler.exit(Scheduler::ExitReason::SynchronizeEvent); - } - } - - step(1); - synchronize_cpu(); -} - -void Event::init() { -} - -void Event::load() { -} - -void Event::unload() { - rom[0].reset(); - rom[1].reset(); - rom[2].reset(); - rom[3].reset(); - ram.reset(); -} - -void Event::power() { -} - -void Event::reset() { - create(Event::Enter, 1); -} - -//DSP-1 -uint8 Event::sr(unsigned addr) { - return 0; -} - -//DSP-1 -void Event::dr(unsigned addr, uint8 data) { -} - -//is there bank-switching? -uint8 Event::rom_read(unsigned addr) { - return cpu.regs.mdr; -} - -//is there read-protection? -uint8 Event::ram_read(unsigned addr) { - return cpu.regs.mdr; -} - -//is there write-protection? -void Event::ram_write(unsigned addr, uint8 data) { -} - -void Event::serialize(serializer &s) { - Thread::serialize(s); - s.array(ram.data(), ram.size()); -} - -} diff --git a/higan/sfc/chip/event-skeleton/event.hpp b/higan/sfc/chip/event-skeleton/event.hpp deleted file mode 100644 index 75a2cc58..00000000 --- a/higan/sfc/chip/event-skeleton/event.hpp +++ /dev/null @@ -1,37 +0,0 @@ -//SNES-EVENT board emulation (skeleton): -//* Campus Challenge '92 -//* Powerfest '94 - -struct Event : Coprocessor { - MappedRAM rom[4]; - MappedRAM ram; - - static void Enter(); - void enter(); - void init(); - void load(); - void unload(); - void power(); - void reset(); - - uint8 sr(unsigned); - void dr(unsigned, uint8 data); - uint8 rom_read(unsigned addr); - uint8 ram_read(unsigned addr); - void ram_write(unsigned addr, uint8 data); - - void serialize(serializer&); - -//private: - enum class Board : unsigned { CampusChallenge92, Powerfest94 } board; - unsigned revision; - unsigned timer; - - string host; - unsigned port; - string path; - string username; - string password; -}; - -extern Event event; diff --git a/higan/sfc/chip/event/event.cpp b/higan/sfc/chip/event/event.cpp index 9d9d67e5..9e7a734b 100644 --- a/higan/sfc/chip/event/event.cpp +++ b/higan/sfc/chip/event/event.cpp @@ -38,15 +38,15 @@ void Event::submitScore() { if(usedSaveState) return; string data; - data.append("timer=", timer, ";"); + data.append("timer:", timer, "\n"); if(board == Board::CampusChallenge92) { unsigned mw = 0, fz = 0, pw = 0; for(unsigned n = 0x0408; n <= 0x040e; n++) mw = mw * 10 + ram.read(n); for(unsigned n = 0x0413; n >= 0x0410; n--) fz = fz * 10 + ram.read(n); for(unsigned n = 0x0418; n >= 0x0415; n--) pw = pw * 10 + ram.read(n); - data.append("mw=", mw, ";"); - data.append("fz=", fz, ";"); - data.append("pw=", pw); + data.append("mw:", mw, "\n"); + data.append("fz:", fz, "\n"); + data.append("pw:", pw, "\n"); } if(board == Board::Powerfest94) { unsigned ml = 0, mk[2] = {0}, ba[2] = {0}; @@ -55,9 +55,9 @@ void Event::submitScore() { for(unsigned n = 0x0411; n >= 0x0410; n--) mk[1] = mk[1] * 10 + ram.read(n); for(unsigned n = 0x0418; n >= 0x0415; n--) ba[0] = ba[0] * 10 + ram.read(n); for(unsigned n = 0x041a; n >= 0x0419; n--) ba[1] = ba[1] * 10 + ram.read(n); - data.append("ml=", ml, ";"); - data.append("mk=", mk[0], ",", mk[1], ";"); - data.append("ba=", ba[0], ",", ba[1]); + data.append("ml:", ml, "\n"); + data.append("mk:", mk[0], ",", mk[1], "\n"); + data.append("ba:", ba[0], ",", ba[1], "\n"); } lstring side = interface->server().split<1>("@"); diff --git a/higan/target-ethos/Makefile b/higan/target-ethos/Makefile index 6736c99c..32d48229 100755 --- a/higan/target-ethos/Makefile +++ b/higan/target-ethos/Makefile @@ -66,11 +66,14 @@ endif # targets build: $(objects) -ifeq ($(platform),osx) +ifeq ($(platform),x) + $(strip $(cpp) -o out/$(name) $(objects) $(link)) +else ifeq ($(platform),win) + $(strip $(cpp) -shared -o out/phoenix.dll obj/phoenix.o $(phoenixlink)) + $(strip $(cpp) -o out/$(name) $(subst obj/phoenix.o,,$(objects)) $(link) -Lout -lphoenix) +else ifeq ($(platform),osx) test -d ../$(name).app || mkdir -p ../$(name).app/Contents/MacOS $(strip $(cpp) -o ../$(name).app/Contents/MacOS/$(name) $(objects) $(link)) -else - $(strip $(cpp) -o out/$(name) $(objects) $(link)) endif resource: diff --git a/higan/target-ethos/ethos.cpp b/higan/target-ethos/ethos.cpp index 3d1da610..84547d94 100755 --- a/higan/target-ethos/ethos.cpp +++ b/higan/target-ethos/ethos.cpp @@ -133,6 +133,7 @@ int main(int argc, char **argv) { utf8_args(argc, argv); #endif + OS::setName("higan"); new Application(argc, argv); delete application; return 0; diff --git a/higan/target-ethos/general/browser.cpp b/higan/target-ethos/general/browser.cpp index 1602d659..870f5683 100755 --- a/higan/target-ethos/general/browser.cpp +++ b/higan/target-ethos/general/browser.cpp @@ -73,7 +73,7 @@ void Browser::bootstrap() { Folder folder; folder.extension = media.type; - folder.path = application->basepath; + folder.path = {userpath(), "Emulation/", media.name, "/"}; folder.selection = 0; folderList.append(folder); } diff --git a/higan/target-ethos/utility/utility.cpp b/higan/target-ethos/utility/utility.cpp index 0cda1f9d..d8e2de8a 100755 --- a/higan/target-ethos/utility/utility.cpp +++ b/higan/target-ethos/utility/utility.cpp @@ -29,6 +29,7 @@ void Utility::loadMedia(string pathname) { for(auto &emulator : application->emulator) { for(auto &media : emulator->media) { if(type != media.type) continue; + if(media.bootable == false) continue; return utility->loadMedia(emulator, media, {pathname, "/"}); } }