Update to v094r08 release.

byuu says:

Lots of changes this time around. FreeBSD stability and compilation is
still a work in progress.

FreeBSD 10 + Clang 3.3 = 108fps
FreeBSD 10 + GCC 4.7 = 130fps

Errata 1: I've been fighting that god-damned endian.h header for the
past nine WIPs now. The above WIP isn't building now because FreeBSD
isn't including headers before using certain types, and you end up with
a trillion error messages. So just delete all the endian.h includes from
nall/intrinsics.hpp to build.

Errata 2: I was trying to match g++ and g++47, so I used $(findstring
g++,$(compiler)), which ends up also matching clang++. Oops. Easy fix,
put Clang first and then else if g++ next. Not ideal, but oh well. All
it's doing for now is declaring -fwrapv twice, so you don't have to fix
it just yet. Probably just going to alias g++="g++47" and do exact
matching instead.

Errata 3: both OpenGL::term and VideoGLX::term are causing a core dump
on BSD. No idea why. The resources are initialized and valid, but
releasing them crashes the application.

Changelog:
- nall/Makefile is more flexible with overriding $(compiler), so you can
  build with GCC or Clang on BSD (defaults to GCC now)
- PLATFORM_X was renamed to PLATFORM_XORG, and it's also declared with
  PLATFORM_LINUX or PLATFORM_BSD
  - PLATFORM_XORG probably isn't the best name ... still thinking about
    what best to call LINUX|BSD|SOLARIS or ^(WINDOWS|MACOSX)
- fixed a few legitimate Clang warning messages in nall
- Compiler::VisualCPP is ugly as hell, renamed to Compiler::CL
- nall/platform includes nall/intrinsics first. Trying to move away from
  testing for _WIN32, etc directly in all files. Work in progress.
- nall turns off Clang warnings that I won't "fix", because they aren't
  broken. It's much less noisy to compile with warnings on now.
- phoenix gains the ability to set background and foreground colors on
  various text container widgets (GTK only for now.)
- rewrote a lot of the MSU1 code to try and simplify it. Really hope
  I didn't break anything ... I don't have any MSU1 test ROMs handy
- SNES coprocessor audio is now mixed as sclamp<16>(system_sample
  + coprocessor_sample) instead of sclamp<16>((sys + cop) / 2)
  - allows for greater chance of aliasing (still low, SNES audio is
    quiet), but doesn't cut base system volume in half anymore
- fixed Super Scope and Justifier cursor colors
- use input.xlib instead of input.x ... allows Xlib input driver to be
  visible on Linux and BSD once again
- make install and make uninstall must be run as root again; no longer
  using install but cp instead for BSD compatibility
- killed $(DESTDIR) ... use make prefix=$DESTDIR$prefix instead
- you can now set text/background colors for the loki console via (eg):
 - settings.terminal.background-color 0x000000
 - settings.terminal.foreground-color 0xffffff
This commit is contained in:
Tim Allen 2014-02-24 20:39:09 +11:00
parent ecc651c88b
commit 1a7bc6bb87
71 changed files with 553 additions and 157 deletions

View File

@ -3,7 +3,7 @@
namespace Emulator { namespace Emulator {
static const char Name[] = "higan"; static const char Name[] = "higan";
static const char Version[] = "094.07"; static const char Version[] = "094.08";
static const char Author[] = "byuu"; static const char Author[] = "byuu";
static const char License[] = "GPLv3"; static const char License[] = "GPLv3";
static const char Website[] = "http://byuu.org/"; static const char Website[] = "http://byuu.org/";

View File

@ -34,29 +34,45 @@ ifeq ($(platform),)
endif endif
endif endif
# compiler detection
ifeq ($(compiler),)
ifeq ($(platform),windows)
compiler := g++
flags := -fwrapv
link :=
else ifeq ($(platform),macosx)
compiler := clang++
flags := -fwrapv -w -stdlib=libc++
link := -lc++ -lobjc
else ifeq ($(platform),bsd)
compiler := clang++
flags := -fwrapv -w -I/usr/local/include
else
compiler := g++
flags := -fwrapv
link :=
endif
cflags := -x c -std=c99 cflags := -x c -std=c99
objcflags := -x objective-c -std=c99 objcflags := -x objective-c -std=c99
cppflags := -x c++ -std=c++11 cppflags := -x c++ -std=c++11
objcppflags := -x objective-c++ -std=c++11 objcppflags := -x objective-c++ -std=c++11
flags :=
link :=
# compiler detection
ifeq ($(compiler),)
ifeq ($(platform),windows)
compiler := g++
else ifeq ($(platform),macosx)
compiler := clang++
else ifeq ($(platform),bsd)
compiler := g++47
else
compiler := g++
endif
endif
# gcc settings
ifeq ($(findstring g++,$(compiler)),g++)
flags += -fwrapv
endif
# clang settings
ifeq ($(findstring clang++,$(compiler)),clang++)
flags += -fwrapv -w
endif
# macosx settings
ifeq ($(platform),macosx)
flags += -stdlib=libc++
link += -lc++ -lobjc
endif
# bsd settings
ifeq ($(platform),bsd)
flags += -I/usr/local/include
endif endif
# cross-compilation support # cross-compilation support

View File

@ -9,7 +9,7 @@ struct compositor {
inline static bool enabled(); inline static bool enabled();
inline static bool enable(bool status); inline static bool enable(bool status);
#if defined(PLATFORM_X) #if defined(PLATFORM_XORG)
enum class Compositor : unsigned { Unknown, Metacity, Xfwm4 }; enum class Compositor : unsigned { Unknown, Metacity, Xfwm4 };
inline static Compositor detect(); inline static Compositor detect();
@ -21,7 +21,7 @@ struct compositor {
#endif #endif
}; };
#if defined(PLATFORM_X) #if defined(PLATFORM_XORG)
//Metacity //Metacity

View File

@ -8,7 +8,7 @@
#include <nall/string.hpp> #include <nall/string.hpp>
#include <nall/utility.hpp> #include <nall/utility.hpp>
#if defined(PLATFORM_X) || defined(PLATFORM_MACOSX) #if defined(PLATFORM_XORG) || defined(PLATFORM_MACOSX)
#include <dlfcn.h> #include <dlfcn.h>
#elif defined(PLATFORM_WINDOWS) #elif defined(PLATFORM_WINDOWS)
#include <windows.h> #include <windows.h>
@ -35,7 +35,7 @@ private:
uintptr_t handle = 0; uintptr_t handle = 0;
}; };
#if defined(PLATFORM_X) #if defined(PLATFORM_XORG)
inline bool library::open(const string& name, const string& path) { inline bool library::open(const string& name, const string& path) {
if(handle) close(); if(handle) close();
handle = (uintptr_t)dlopen(string(path, !path.empty() && !path.endsWith("/") ? "/" : "", "lib", name, ".so"), RTLD_LAZY); handle = (uintptr_t)dlopen(string(path, !path.empty() && !path.endsWith("/") ? "/" : "", "lib", name, ".so"), RTLD_LAZY);

View File

@ -19,6 +19,7 @@ struct Resampler {
virtual void clear() = 0; virtual void clear() = 0;
virtual void sample() = 0; virtual void sample() = 0;
Resampler(DSP& dsp) : dsp(dsp) {} Resampler(DSP& dsp) : dsp(dsp) {}
virtual ~Resampler() {}
}; };
struct DSP { struct DSP {

View File

@ -188,7 +188,7 @@ struct file : varint {
if(!fp) return; //file not open if(!fp) return; //file not open
buffer_flush(); buffer_flush();
uintmax_t req_offset = file_offset; intmax_t req_offset = file_offset;
switch(index_) { switch(index_) {
case index::absolute: req_offset = offset; break; case index::absolute: req_offset = offset; break;
case index::relative: req_offset += offset; break; case index::relative: req_offset += offset; break;

View File

@ -3,16 +3,9 @@
namespace nall { namespace nall {
#if defined(_WIN32)
#elif defined(__APPLE__)
#include <machine/endian.h>
#else
#include <endian.h>
#endif
struct Intrinsics { struct Intrinsics {
enum class Compiler : unsigned { Clang, GCC, VisualCPP, Unknown }; enum class Compiler : unsigned { Clang, GCC, CL, Unknown };
enum class Platform : unsigned { Windows, MacOSX, X, Unknown }; //X = Linux, BSD, etc enum class Platform : unsigned { Windows, MacOSX, Linux, BSD, Unknown };
enum class Architecture : unsigned { x86, amd64, Unknown }; enum class Architecture : unsigned { x86, amd64, Unknown };
enum class Endian : unsigned { LSB, MSB, Unknown }; enum class Endian : unsigned { LSB, MSB, Unknown };
@ -27,12 +20,20 @@ struct Intrinsics {
#if defined(__clang__) #if defined(__clang__)
#define COMPILER_CLANG #define COMPILER_CLANG
Intrinsics::Compiler Intrinsics::compiler() { return Intrinsics::Compiler::Clang; } Intrinsics::Compiler Intrinsics::compiler() { return Intrinsics::Compiler::Clang; }
#pragma clang diagnostic ignored "-Wempty-body"
#pragma clang diagnostic ignored "-Wparentheses"
#pragma clang diagnostic ignored "-Wreturn-type"
#pragma clang diagnostic ignored "-Wswitch"
#pragma clang diagnostic ignored "-Wtautological-compare"
#elif defined(__GNUC__) #elif defined(__GNUC__)
#define COMPILER_GCC #define COMPILER_GCC
Intrinsics::Compiler Intrinsics::compiler() { return Intrinsics::Compiler::GCC; } Intrinsics::Compiler Intrinsics::compiler() { return Intrinsics::Compiler::GCC; }
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#define COMPILER_VISUALCPP #define COMPILER_CL
Intrinsics::Compiler Intrinsics::compiler() { return Intrinsics::Compiler::VisualCPP; } Intrinsics::Compiler Intrinsics::compiler() { return Intrinsics::Compiler::CL; }
#pragma warning(disable:4996) //disable libc "deprecation" warnings
#else #else
#warning "unable to detect compiler" #warning "unable to detect compiler"
#define COMPILER_UNKNOWN #define COMPILER_UNKNOWN
@ -47,9 +48,14 @@ struct Intrinsics {
#elif defined(__APPLE__) #elif defined(__APPLE__)
#define PLATFORM_MACOSX #define PLATFORM_MACOSX
Intrinsics::Platform Intrinsics::platform() { return Intrinsics::Platform::MacOSX; } Intrinsics::Platform Intrinsics::platform() { return Intrinsics::Platform::MacOSX; }
#elif defined(linux) || defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__GNU__) #elif defined(linux) || defined(__linux__)
#define PLATFORM_X #define PLATFORM_LINUX
Intrinsics::Platform Intrinsics::platform() { return Intrinsics::Platform::X; } #define PLATFORM_XORG
Intrinsics::Platform Intrinsics::platform() { return Intrinsics::Platform::Linux; }
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__)
#define PLATFORM_BSD
#define PLATFORM_XORG
Intrinsics::Platform Intrinsics::platform() { return Intrinsics::Platform::BSD; }
#else #else
#warning "unable to detect platform" #warning "unable to detect platform"
#define PLATFORM_UNKNOWN #define PLATFORM_UNKNOWN
@ -58,6 +64,14 @@ struct Intrinsics {
/* Architecture Detection */ /* Architecture Detection */
#if defined(PLATFORM_MACOSX)
#include <machine/endian.h>
#elif defined(PLATFORM_LINUX)
#include <endian.h>
#elif defined(PLATFORM_BSD)
#include <sys/endian.h>
#endif
#if defined(__i386__) || defined(_M_IX86) #if defined(__i386__) || defined(_M_IX86)
#define ARCH_X86 #define ARCH_X86
Intrinsics::Architecture Intrinsics::architecture() { return Intrinsics::Architecture::x86; } Intrinsics::Architecture Intrinsics::architecture() { return Intrinsics::Architecture::x86; }

View File

@ -27,7 +27,7 @@ template<typename... Args> inline void invoke(const string& name, Args&&... args
ShellExecuteW(NULL, NULL, utf16_t(name), utf16_t(arguments), NULL, SW_SHOWNORMAL); ShellExecuteW(NULL, NULL, utf16_t(name), utf16_t(arguments), NULL, SW_SHOWNORMAL);
} }
#elif defined(PLATFORM_X) #elif defined(PLATFORM_XORG)
template<typename... Args> inline void invoke(const string& name, Args&&... args) { template<typename... Args> inline void invoke(const string& name, Args&&... args) {
pid_t pid = fork(); pid_t pid = fork();

View File

@ -58,7 +58,7 @@
#include <nall/windows/utf8.hpp> #include <nall/windows/utf8.hpp>
#endif #endif
#if defined(PLATFORM_X) #if defined(PLATFORM_XORG)
#include <nall/serial.hpp> #include <nall/serial.hpp>
#endif #endif

View File

@ -1,22 +1,20 @@
#ifndef NALL_PLATFORM_HPP #ifndef NALL_PLATFORM_HPP
#define NALL_PLATFORM_HPP #define NALL_PLATFORM_HPP
#include <nall/intrinsics.hpp>
namespace Math { namespace Math {
static const long double e = 2.71828182845904523536; static const long double e = 2.71828182845904523536;
static const long double Pi = 3.14159265358979323846; static const long double Pi = 3.14159265358979323846;
} }
#if defined(_WIN32) #if defined(PLATFORM_WINDOWS)
//minimum version needed for _wstat64, etc //minimum version needed for _wstat64, etc
#undef __MSVCRT_VERSION__ #undef __MSVCRT_VERSION__
#define __MSVCRT_VERSION__ 0x0601 #define __MSVCRT_VERSION__ 0x0601
#include <nall/windows/utf8.hpp> #include <nall/windows/utf8.hpp>
#endif #endif
//=========================
//standard platform headers
//=========================
#include <limits> #include <limits>
#include <utility> #include <utility>
@ -33,7 +31,7 @@ namespace Math {
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#if defined(_WIN32) #if defined(PLATFORM_WINDOWS)
#include <io.h> #include <io.h>
#include <direct.h> #include <direct.h>
#include <shlobj.h> #include <shlobj.h>
@ -47,16 +45,11 @@ namespace Math {
#define dllexport #define dllexport
#endif #endif
//========== #if defined(COMPILER_CL)
//Visual C++
//==========
#if defined(_MSC_VER)
#pragma warning(disable:4996) //disable libc "deprecation" warnings
#define va_copy(dest, src) ((dest) = (src)) #define va_copy(dest, src) ((dest) = (src))
#endif #endif
#if defined(_WIN32) #if defined(PLATFORM_WINDOWS)
__declspec(dllimport) int _fileno(FILE*); __declspec(dllimport) int _fileno(FILE*);
inline int access(const char* path, int amode) { return _waccess(nall::utf16_t(path), amode); } inline int access(const char* path, int amode) { return _waccess(nall::utf16_t(path), amode); }
@ -68,14 +61,10 @@ namespace Math {
inline void usleep(unsigned milliseconds) { Sleep(milliseconds / 1000); } inline void usleep(unsigned milliseconds) { Sleep(milliseconds / 1000); }
#endif #endif
//================ #if defined(COMPILER_CLANG) || defined(COMPILER_GCC)
//inline expansion
//================
#if defined(__clang__) || defined(__GNUC__)
#define neverinline __attribute__((noinline)) #define neverinline __attribute__((noinline))
#define alwaysinline inline __attribute__((always_inline)) #define alwaysinline inline __attribute__((always_inline))
#elif defined(_MSC_VER) #elif defined(COMPILER_CL)
#define neverinline __declspec(noinline) #define neverinline __declspec(noinline)
#define alwaysinline inline __forceinline #define alwaysinline inline __forceinline
#else #else
@ -83,11 +72,7 @@ namespace Math {
#define alwaysinline inline #define alwaysinline inline
#endif #endif
//=========== #if defined(COMPILER_CLANG) || defined(COMPILER_GCC)
//unreachable
//===========
#if defined(__clang__) || defined(__GNUC__)
#define unreachable __builtin_unreachable() #define unreachable __builtin_unreachable()
#else #else
#define unreachable throw #define unreachable throw

View File

@ -5,7 +5,7 @@
#include <nall/stdint.hpp> #include <nall/stdint.hpp>
#include <nall/string.hpp> #include <nall/string.hpp>
#if !defined(PLATFORM_X) && !defined(PLATFORM_MACOSX) #if !defined(PLATFORM_XORG) && !defined(PLATFORM_MACOSX)
#error "nall/serial: unsupported platform" #error "nall/serial: unsupported platform"
#endif #endif

View File

@ -24,22 +24,26 @@ char* strupper(char* str) {
char* qstrlower(char* s) { char* qstrlower(char* s) {
if(!s) return nullptr; if(!s) return nullptr;
char* base = s;
bool quoted = false; bool quoted = false;
while(*s) { while(*s) {
if(*s == '\"' || *s == '\'') quoted ^= 1; if(*s == '\"' || *s == '\'') quoted ^= 1;
if(quoted == false && *s >= 'A' && *s <= 'Z') *s += 0x20; if(quoted == false && *s >= 'A' && *s <= 'Z') *s += 0x20;
s++; s++;
} }
return base;
} }
char* qstrupper(char* s) { char* qstrupper(char* s) {
if(!s) return nullptr; if(!s) return nullptr;
char* base = s;
bool quoted = false; bool quoted = false;
while(*s) { while(*s) {
if(*s == '\"' || *s == '\'') quoted ^= 1; if(*s == '\"' || *s == '\'') quoted ^= 1;
if(quoted == false && *s >= 'a' && *s <= 'z') *s -= 0x20; if(quoted == false && *s >= 'a' && *s <= 'z') *s -= 0x20;
s++; s++;
} }
return base;
} }
char* strtr(char* dest, const char* before, const char* after) { char* strtr(char* dest, const char* before, const char* after) {

View File

@ -5,7 +5,8 @@
#include <nall/function.hpp> #include <nall/function.hpp>
#include <nall/intrinsics.hpp> #include <nall/intrinsics.hpp>
#if defined(PLATFORM_X) || defined(PLATFORM_MACOSX) #if defined(PLATFORM_XORG) || defined(PLATFORM_MACOSX)
#include <pthread.h> #include <pthread.h>
namespace nall { namespace nall {
@ -64,7 +65,9 @@ void* thread_entry_point(void* parameter) {
} }
} }
#elif defined(PLATFORM_WINDOWS) #elif defined(PLATFORM_WINDOWS)
namespace nall { namespace nall {
inline DWORD WINAPI thread_entry_point(LPVOID); inline DWORD WINAPI thread_entry_point(LPVOID);
@ -122,6 +125,7 @@ inline DWORD WINAPI thread_entry_point(LPVOID parameter) {
} }
} }
#endif #endif
#endif #endif

View File

@ -17,6 +17,12 @@ void pConsole::print(string text) {
void pConsole::reset() { void pConsole::reset() {
} }
void pConsole::setBackgroundColor(Color color) {
}
void pConsole::setForegroundColor(Color color) {
}
void pConsole::setPrompt(string prompt) { void pConsole::setPrompt(string prompt) {
} }

View File

@ -13,6 +13,8 @@ struct pConsole : public pWidget {
void print(string text); void print(string text);
void reset(); void reset();
void setBackgroundColor(Color color);
void setForegroundColor(Color color);
void setPrompt(string prompt); void setPrompt(string prompt);
pConsole(Console& console) : pWidget(console), console(console) {} pConsole(Console& console) : pWidget(console), console(console) {}

View File

@ -11,9 +11,15 @@
namespace phoenix { namespace phoenix {
void pHexEdit::setBackgroundColor(Color color) {
}
void pHexEdit::setColumns(unsigned columns) { void pHexEdit::setColumns(unsigned columns) {
} }
void pHexEdit::setForegroundColor(Color color) {
}
void pHexEdit::setLength(unsigned length) { void pHexEdit::setLength(unsigned length) {
} }

View File

@ -11,7 +11,9 @@ struct pHexEdit : public pWidget {
HexEdit& hexEdit; HexEdit& hexEdit;
CocoaHexEdit* cocoaHexEdit = nullptr; CocoaHexEdit* cocoaHexEdit = nullptr;
void setBackgroundColor(Color color);
void setColumns(unsigned columns); void setColumns(unsigned columns);
void setForegroundColor(Color color);
void setLength(unsigned length); void setLength(unsigned length);
void setOffset(unsigned offset); void setOffset(unsigned offset);
void setRows(unsigned rows); void setRows(unsigned rows);

View File

@ -31,12 +31,18 @@ Size pLineEdit::minimumSize() {
return {size.width + 10, size.height + 8}; return {size.width + 10, size.height + 8};
} }
void pLineEdit::setBackgroundColor(Color color) {
}
void pLineEdit::setEditable(bool editable) { void pLineEdit::setEditable(bool editable) {
@autoreleasepool { @autoreleasepool {
[cocoaView setEditable:editable]; [cocoaView setEditable:editable];
} }
} }
void pLineEdit::setForegroundColor(Color color) {
}
void pLineEdit::setText(string text) { void pLineEdit::setText(string text) {
@autoreleasepool { @autoreleasepool {
[cocoaView setStringValue:[NSString stringWithUTF8String:text]]; [cocoaView setStringValue:[NSString stringWithUTF8String:text]];

View File

@ -14,7 +14,9 @@ struct pLineEdit : public pWidget {
CocoaLineEdit* cocoaLineEdit = nullptr; CocoaLineEdit* cocoaLineEdit = nullptr;
Size minimumSize(); Size minimumSize();
void setBackgroundColor(Color color);
void setEditable(bool editable); void setEditable(bool editable);
void setForegroundColor(Color color);
void setText(string text); void setText(string text);
string text(); string text();

View File

@ -250,6 +250,9 @@ void pListView::reset() {
} }
} }
void pListView::setBackgroundColor(Color color) {
}
void pListView::setCheckable(bool checkable) { void pListView::setCheckable(bool checkable) {
@autoreleasepool { @autoreleasepool {
[cocoaView reloadColumns]; [cocoaView reloadColumns];
@ -268,6 +271,9 @@ void pListView::setFont(string font) {
} }
} }
void pListView::setForegroundColor(Color color) {
}
void pListView::setHeaderText(const lstring& text) { void pListView::setHeaderText(const lstring& text) {
@autoreleasepool { @autoreleasepool {
[cocoaView reloadColumns]; [cocoaView reloadColumns];

View File

@ -44,9 +44,11 @@ struct pListView : public pWidget {
void autoSizeColumns(); void autoSizeColumns();
void remove(unsigned selection); void remove(unsigned selection);
void reset(); void reset();
void setBackgroundColor(Color color);
void setCheckable(bool checkable); void setCheckable(bool checkable);
void setChecked(unsigned selection, bool checked); void setChecked(unsigned selection, bool checked);
void setFont(string font); void setFont(string font);
void setForegroundColor(Color color);
void setHeaderText(const lstring& text); void setHeaderText(const lstring& text);
void setHeaderVisible(bool visible); void setHeaderVisible(bool visible);
void setImage(unsigned selection, unsigned position, const image& image); void setImage(unsigned selection, unsigned position, const image& image);

View File

@ -43,6 +43,9 @@
namespace phoenix { namespace phoenix {
void pTextEdit::setBackgroundColor(Color color) {
}
void pTextEdit::setCursorPosition(unsigned position) { void pTextEdit::setCursorPosition(unsigned position) {
@autoreleasepool { @autoreleasepool {
string text = [[[cocoaView content] string] UTF8String]; string text = [[[cocoaView content] string] UTF8String];
@ -63,6 +66,9 @@ void pTextEdit::setFont(string font) {
} }
} }
void pTextEdit::setForegroundColor(Color color) {
}
void pTextEdit::setText(string text) { void pTextEdit::setText(string text) {
@autoreleasepool { @autoreleasepool {
[[cocoaView content] setString:[NSString stringWithUTF8String:text]]; [[cocoaView content] setString:[NSString stringWithUTF8String:text]];

View File

@ -15,9 +15,11 @@ struct pTextEdit : public pWidget {
TextEdit& textEdit; TextEdit& textEdit;
CocoaTextEdit* cocoaTextEdit = nullptr; CocoaTextEdit* cocoaTextEdit = nullptr;
void setBackgroundColor(Color color);
void setCursorPosition(unsigned position); void setCursorPosition(unsigned position);
void setEditable(bool editable); void setEditable(bool editable);
void setFont(string font); void setFont(string font);
void setForegroundColor(Color color);
void setText(string text); void setText(string text);
void setWordWrap(bool wordWrap); void setWordWrap(bool wordWrap);
string text(); string text();

View File

@ -1217,6 +1217,14 @@ ComboButton::~ComboButton() {
//Console //Console
//======= //=======
Color Console::backgroundColor() const {
return state.backgroundColor;
}
Color Console::foregroundColor() const {
return state.foregroundColor;
}
void Console::print(const string& text) { void Console::print(const string& text) {
return p.print(text); return p.print(text);
} }
@ -1229,6 +1237,16 @@ void Console::reset() {
return p.reset(); return p.reset();
} }
void Console::setBackgroundColor(Color color) {
state.backgroundColor = color;
return p.setBackgroundColor(color);
}
void Console::setForegroundColor(Color color) {
state.foregroundColor = color;
return p.setForegroundColor(color);
}
void Console::setPrompt(const string& prompt) { void Console::setPrompt(const string& prompt) {
state.prompt = prompt; state.prompt = prompt;
return p.setPrompt(prompt); return p.setPrompt(prompt);
@ -1288,10 +1306,18 @@ Frame::~Frame() {
//HexEdit //HexEdit
//======= //=======
Color HexEdit::backgroundColor() const {
return state.backgroundColor;
}
unsigned HexEdit::columns() const { unsigned HexEdit::columns() const {
return state.columns; return state.columns;
} }
Color HexEdit::foregroundColor() const {
return state.foregroundColor;
}
unsigned HexEdit::length() const { unsigned HexEdit::length() const {
return state.length; return state.length;
} }
@ -1304,11 +1330,21 @@ unsigned HexEdit::rows() const {
return state.rows; return state.rows;
} }
void HexEdit::setBackgroundColor(Color color) {
state.backgroundColor = color;
return p.setBackgroundColor(color);
}
void HexEdit::setColumns(unsigned columns) { void HexEdit::setColumns(unsigned columns) {
state.columns = columns; state.columns = columns;
return p.setColumns(columns); return p.setColumns(columns);
} }
void HexEdit::setForegroundColor(Color color) {
state.foregroundColor = color;
return p.setForegroundColor(color);
}
void HexEdit::setLength(unsigned length) { void HexEdit::setLength(unsigned length) {
state.length = length; state.length = length;
return p.setLength(length); return p.setLength(length);
@ -1437,15 +1473,33 @@ Label::~Label() {
//LineEdit //LineEdit
//======== //========
Color LineEdit::backgroundColor() const {
return state.backgroundColor;
}
bool LineEdit::editable() const { bool LineEdit::editable() const {
return state.editable; return state.editable;
} }
Color LineEdit::foregroundColor() const {
return state.foregroundColor;
}
void LineEdit::setBackgroundColor(Color color) {
state.backgroundColor = color;
return p.setBackgroundColor(color);
}
void LineEdit::setEditable(bool editable) { void LineEdit::setEditable(bool editable) {
state.editable = editable; state.editable = editable;
return p.setEditable(editable); return p.setEditable(editable);
} }
void LineEdit::setForegroundColor(Color color) {
state.foregroundColor = color;
return p.setForegroundColor(color);
}
void LineEdit::setText(const string& text) { void LineEdit::setText(const string& text) {
state.text = text; state.text = text;
return p.setText(text); return p.setText(text);
@ -1482,6 +1536,10 @@ void ListView::autoSizeColumns() {
return p.autoSizeColumns(); return p.autoSizeColumns();
} }
Color ListView::backgroundColor() const {
return state.backgroundColor;
}
bool ListView::checkable() const { bool ListView::checkable() const {
return state.checkable; return state.checkable;
} }
@ -1495,6 +1553,10 @@ unsigned ListView::columns() const {
return max(1u, state.headerText.size()); return max(1u, state.headerText.size());
} }
Color ListView::foregroundColor() const {
return state.foregroundColor;
}
bool ListView::headerVisible() const { bool ListView::headerVisible() const {
return state.headerVisible; return state.headerVisible;
} }
@ -1533,6 +1595,11 @@ unsigned ListView::selection() const {
return state.selection; return state.selection;
} }
void ListView::setBackgroundColor(Color color) {
state.backgroundColor = color;
return p.setBackgroundColor(color);
}
void ListView::setCheckable(bool checkable) { void ListView::setCheckable(bool checkable) {
state.checkable = checkable; state.checkable = checkable;
return p.setCheckable(checkable); return p.setCheckable(checkable);
@ -1544,6 +1611,11 @@ void ListView::setChecked(unsigned selection, bool checked) {
return p.setChecked(selection, checked); return p.setChecked(selection, checked);
} }
void ListView::setForegroundColor(Color color) {
state.foregroundColor = color;
return p.setForegroundColor(color);
}
void ListView::setHeaderText(const lstring& text) { void ListView::setHeaderText(const lstring& text) {
state.headerText = text; state.headerText = text;
return p.setHeaderText(text); return p.setHeaderText(text);
@ -1811,10 +1883,23 @@ TabFrame::~TabFrame() {
//TextEdit //TextEdit
//======== //========
Color TextEdit::backgroundColor() const {
return state.backgroundColor;
}
bool TextEdit::editable() const { bool TextEdit::editable() const {
return state.editable; return state.editable;
} }
Color TextEdit::foregroundColor() const {
return state.foregroundColor;
}
void TextEdit::setBackgroundColor(Color color) {
state.backgroundColor = color;
return p.setBackgroundColor(color);
}
void TextEdit::setCursorPosition(unsigned position) { void TextEdit::setCursorPosition(unsigned position) {
state.cursorPosition = position; state.cursorPosition = position;
return p.setCursorPosition(position); return p.setCursorPosition(position);
@ -1825,6 +1910,11 @@ void TextEdit::setEditable(bool editable) {
return p.setEditable(editable); return p.setEditable(editable);
} }
void TextEdit::setForegroundColor(Color color) {
state.foregroundColor = color;
return p.setForegroundColor(color);
}
void TextEdit::setText(const string& text) { void TextEdit::setText(const string& text) {
state.text = text; state.text = text;
return p.setText(text); return p.setText(text);

View File

@ -524,9 +524,13 @@ struct Console : private nall::base_from_member<pConsole&>, Widget {
template<typename... Args> void print(Args&&... args) { print({args...}); } template<typename... Args> void print(Args&&... args) { print({args...}); }
Color backgroundColor() const;
Color foregroundColor() const;
void print(const nall::string& text); void print(const nall::string& text);
nall::string prompt() const; nall::string prompt() const;
void reset(); void reset();
void setBackgroundColor(Color color);
void setForegroundColor(Color color);
void setPrompt(const nall::string& prompt); void setPrompt(const nall::string& prompt);
Console(); Console();
@ -553,11 +557,15 @@ struct HexEdit : private nall::base_from_member<pHexEdit&>, Widget {
nall::function<uint8_t (unsigned)> onRead; nall::function<uint8_t (unsigned)> onRead;
nall::function<void (unsigned, uint8_t)> onWrite; nall::function<void (unsigned, uint8_t)> onWrite;
Color backgroundColor() const;
unsigned columns() const; unsigned columns() const;
Color foregroundColor() const;
unsigned length() const; unsigned length() const;
unsigned offset() const; unsigned offset() const;
unsigned rows() const; unsigned rows() const;
void setBackgroundColor(Color color);
void setColumns(unsigned columns); void setColumns(unsigned columns);
void setForegroundColor(Color color);
void setLength(unsigned length); void setLength(unsigned length);
void setOffset(unsigned offset); void setOffset(unsigned offset);
void setRows(unsigned rows); void setRows(unsigned rows);
@ -615,8 +623,12 @@ struct LineEdit : private nall::base_from_member<pLineEdit&>, Widget {
nall::function<void ()> onActivate; nall::function<void ()> onActivate;
nall::function<void ()> onChange; nall::function<void ()> onChange;
Color backgroundColor() const;
bool editable() const; bool editable() const;
Color foregroundColor() const;
void setBackgroundColor(Color color);
void setEditable(bool editable = true); void setEditable(bool editable = true);
void setForegroundColor(Color color);
void setText(const nall::string& text); void setText(const nall::string& text);
nall::string text(); nall::string text();
@ -634,9 +646,11 @@ struct ListView : private nall::base_from_member<pListView&>, Widget {
void append(const nall::lstring& text); void append(const nall::lstring& text);
void autoSizeColumns(); void autoSizeColumns();
Color backgroundColor() const;
bool checkable() const; bool checkable() const;
bool checked(unsigned selection) const; bool checked(unsigned selection) const;
unsigned columns() const; unsigned columns() const;
Color foregroundColor() const;
bool headerVisible() const; bool headerVisible() const;
nall::image image(unsigned selection, unsigned position) const; nall::image image(unsigned selection, unsigned position) const;
void remove(unsigned selection); void remove(unsigned selection);
@ -644,8 +658,10 @@ struct ListView : private nall::base_from_member<pListView&>, Widget {
unsigned rows() const; unsigned rows() const;
bool selected() const; bool selected() const;
unsigned selection() const; unsigned selection() const;
void setBackgroundColor(Color color);
void setCheckable(bool checkable = true); void setCheckable(bool checkable = true);
void setChecked(unsigned selection, bool checked = true); void setChecked(unsigned selection, bool checked = true);
void setForegroundColor(Color color);
void setHeaderText(const nall::lstring& text); void setHeaderText(const nall::lstring& text);
void setHeaderVisible(bool visible = true); void setHeaderVisible(bool visible = true);
void setImage(unsigned selection, unsigned position, const nall::image& image = nall::image{}); void setImage(unsigned selection, unsigned position, const nall::image& image = nall::image{});
@ -736,9 +752,13 @@ struct TabFrame : private nall::base_from_member<pTabFrame&>, Widget {
struct TextEdit : private nall::base_from_member<pTextEdit&>, Widget { struct TextEdit : private nall::base_from_member<pTextEdit&>, Widget {
nall::function<void ()> onChange; nall::function<void ()> onChange;
Color backgroundColor() const;
bool editable() const; bool editable() const;
Color foregroundColor() const;
void setBackgroundColor(Color color);
void setCursorPosition(unsigned position); void setCursorPosition(unsigned position);
void setEditable(bool editable = true); void setEditable(bool editable = true);
void setForegroundColor(Color color);
void setText(const nall::string& text); void setText(const nall::string& text);
void setWordWrap(bool wordWrap = true); void setWordWrap(bool wordWrap = true);
nall::string text(); nall::string text();

View File

@ -24,7 +24,7 @@ struct MessageWindow::State {
struct Window::State { struct Window::State {
bool backgroundColorOverride = false; bool backgroundColorOverride = false;
Color backgroundColor = {0, 0, 0, 255}; Color backgroundColor = {0, 0, 0};
bool droppable = false; bool droppable = false;
bool fullScreen = false; bool fullScreen = false;
Geometry geometry = {128, 128, 256, 256}; Geometry geometry = {128, 128, 256, 256};
@ -125,6 +125,8 @@ struct ComboButton::State {
}; };
struct Console::State { struct Console::State {
Color backgroundColor = {255, 255, 255};
Color foregroundColor = {0, 0, 0};
string prompt; string prompt;
}; };
@ -134,7 +136,9 @@ struct Frame::State {
}; };
struct HexEdit::State { struct HexEdit::State {
Color backgroundColor = {255, 255, 255};
unsigned columns = 16; unsigned columns = 16;
Color foregroundColor = {0, 0, 0};
unsigned length = 0; unsigned length = 0;
unsigned offset = 0; unsigned offset = 0;
unsigned rows = 16; unsigned rows = 16;
@ -155,13 +159,17 @@ struct Label::State {
}; };
struct LineEdit::State { struct LineEdit::State {
Color backgroundColor = {255, 255, 255};
bool editable = true; bool editable = true;
Color foregroundColor = {0, 0, 0};
string text; string text;
}; };
struct ListView::State { struct ListView::State {
Color backgroundColor = {255, 255, 255};
bool checkable = false; bool checkable = false;
vector<bool> checked; vector<bool> checked;
Color foregroundColor = {0, 0, 0};
lstring headerText; lstring headerText;
bool headerVisible = false; bool headerVisible = false;
vector<vector<nall::image>> image; vector<vector<nall::image>> image;
@ -196,8 +204,10 @@ struct TabFrame::State {
}; };
struct TextEdit::State { struct TextEdit::State {
Color backgroundColor = {255, 255, 255};
unsigned cursorPosition = 0; unsigned cursorPosition = 0;
bool editable = true; bool editable = true;
Color foregroundColor = {0, 0, 0};
string text; string text;
bool wordWrap = true; bool wordWrap = true;
}; };

View File

@ -353,6 +353,8 @@ struct pConsole : public pWidget {
void print(string text); void print(string text);
void reset(); void reset();
void setBackgroundColor(Color color);
void setForegroundColor(Color color);
void setPrompt(string prompt); void setPrompt(string prompt);
pConsole(Console& console) : pWidget(console), console(console) {} pConsole(Console& console) : pWidget(console), console(console) {}
@ -389,7 +391,9 @@ struct pHexEdit : public pWidget {
GtkTextMark* textCursor; GtkTextMark* textCursor;
bool focused(); bool focused();
void setBackgroundColor(Color color);
void setColumns(unsigned columns); void setColumns(unsigned columns);
void setForegroundColor(Color color);
void setLength(unsigned length); void setLength(unsigned length);
void setOffset(unsigned offset); void setOffset(unsigned offset);
void setRows(unsigned rows); void setRows(unsigned rows);
@ -451,7 +455,9 @@ struct pLineEdit : public pWidget {
LineEdit& lineEdit; LineEdit& lineEdit;
Size minimumSize(); Size minimumSize();
void setBackgroundColor(Color color);
void setEditable(bool editable); void setEditable(bool editable);
void setForegroundColor(Color color);
void setText(string text); void setText(string text);
string text(); string text();
@ -479,8 +485,10 @@ struct pListView : public pWidget {
bool focused(); bool focused();
void remove(unsigned selection); void remove(unsigned selection);
void reset(); void reset();
void setBackgroundColor(Color color);
void setCheckable(bool checkable); void setCheckable(bool checkable);
void setChecked(unsigned selection, bool checked); void setChecked(unsigned selection, bool checked);
void setForegroundColor(Color color);
void setHeaderText(const lstring& text); void setHeaderText(const lstring& text);
void setHeaderVisible(bool visible); void setHeaderVisible(bool visible);
void setImage(unsigned selection, unsigned position, const image& image); void setImage(unsigned selection, unsigned position, const image& image);
@ -577,8 +585,10 @@ struct pTextEdit : public pWidget {
GtkTextBuffer* textBuffer; GtkTextBuffer* textBuffer;
bool focused(); bool focused();
void setBackgroundColor(Color color);
void setCursorPosition(unsigned position); void setCursorPosition(unsigned position);
void setEditable(bool editable); void setEditable(bool editable);
void setForegroundColor(Color color);
void setText(string text); void setText(string text);
void setWordWrap(bool wordWrap); void setWordWrap(bool wordWrap);
string text(); string text();

View File

@ -18,6 +18,16 @@ void pConsole::reset() {
seekToEnd(); seekToEnd();
} }
void pConsole::setBackgroundColor(Color color) {
GdkColor gdkColor = CreateColor(color.red, color.green, color.blue);
gtk_widget_modify_base(subWidget, GTK_STATE_NORMAL, &gdkColor);
}
void pConsole::setForegroundColor(Color color) {
GdkColor gdkColor = CreateColor(color.red, color.green, color.blue);
gtk_widget_modify_text(subWidget, GTK_STATE_NORMAL, &gdkColor);
}
void pConsole::setPrompt(string prompt) { void pConsole::setPrompt(string prompt) {
//erase previous prompt and replace it with new prompt //erase previous prompt and replace it with new prompt
GtkTextIter lhs, rhs; GtkTextIter lhs, rhs;
@ -41,11 +51,6 @@ void pConsole::constructor() {
textBuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(subWidget)); textBuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(subWidget));
GdkColor background = CreateColor(72, 24, 24);
gtk_widget_modify_base(subWidget, GTK_STATE_NORMAL, &background);
GdkColor foreground = CreateColor(255, 255, 255);
gtk_widget_modify_text(subWidget, GTK_STATE_NORMAL, &foreground);
g_signal_connect(G_OBJECT(subWidget), "key-press-event", G_CALLBACK(Console_keyPress), (gpointer)&console); g_signal_connect(G_OBJECT(subWidget), "key-press-event", G_CALLBACK(Console_keyPress), (gpointer)&console);
gtk_widget_show(subWidget); gtk_widget_show(subWidget);

View File

@ -27,11 +27,21 @@ bool pHexEdit::focused() {
return GTK_WIDGET_HAS_FOCUS(subWidget) || GTK_WIDGET_HAS_FOCUS(scrollBar); return GTK_WIDGET_HAS_FOCUS(subWidget) || GTK_WIDGET_HAS_FOCUS(scrollBar);
} }
void pHexEdit::setBackgroundColor(Color color) {
GdkColor gdkColor = CreateColor(color.red, color.green, color.blue);
gtk_widget_modify_base(subWidget, GTK_STATE_NORMAL, &gdkColor);
}
void pHexEdit::setColumns(unsigned columns) { void pHexEdit::setColumns(unsigned columns) {
setScroll(); setScroll();
update(); update();
} }
void pHexEdit::setForegroundColor(Color color) {
GdkColor gdkColor = CreateColor(color.red, color.green, color.blue);
gtk_widget_modify_text(subWidget, GTK_STATE_NORMAL, &gdkColor);
}
void pHexEdit::setLength(unsigned length) { void pHexEdit::setLength(unsigned length) {
setScroll(); setScroll();
update(); update();

View File

@ -14,10 +14,20 @@ Size pLineEdit::minimumSize() {
return {size.width + 10, size.height + 10}; return {size.width + 10, size.height + 10};
} }
void pLineEdit::setBackgroundColor(Color color) {
GdkColor gdkColor = CreateColor(color.red, color.green, color.blue);
gtk_widget_modify_base(gtkWidget, GTK_STATE_NORMAL, &gdkColor);
}
void pLineEdit::setEditable(bool editable) { void pLineEdit::setEditable(bool editable) {
gtk_editable_set_editable(GTK_EDITABLE(gtkWidget), editable); gtk_editable_set_editable(GTK_EDITABLE(gtkWidget), editable);
} }
void pLineEdit::setForegroundColor(Color color) {
GdkColor gdkColor = CreateColor(color.red, color.green, color.blue);
gtk_widget_modify_text(gtkWidget, GTK_STATE_NORMAL, &gdkColor);
}
void pLineEdit::setText(string text) { void pLineEdit::setText(string text) {
locked = true; locked = true;
gtk_entry_set_text(GTK_ENTRY(gtkWidget), text); gtk_entry_set_text(GTK_ENTRY(gtkWidget), text);

View File

@ -61,6 +61,11 @@ void pListView::reset() {
gtk_scrolled_window_set_vadjustment(GTK_SCROLLED_WINDOW(gtkWidget), 0); gtk_scrolled_window_set_vadjustment(GTK_SCROLLED_WINDOW(gtkWidget), 0);
} }
void pListView::setBackgroundColor(Color color) {
GdkColor gdkColor = CreateColor(color.red, color.green, color.blue);
gtk_widget_modify_base(subWidget, GTK_STATE_NORMAL, &gdkColor);
}
void pListView::setCheckable(bool checkable) { void pListView::setCheckable(bool checkable) {
gtk_cell_renderer_set_visible(column(0).checkbutton, checkable); gtk_cell_renderer_set_visible(column(0).checkbutton, checkable);
} }
@ -72,6 +77,11 @@ void pListView::setChecked(unsigned selection, bool checked) {
gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, checked, -1); gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, checked, -1);
} }
void pListView::setForegroundColor(Color color) {
GdkColor gdkColor = CreateColor(color.red, color.green, color.blue);
gtk_widget_modify_text(subWidget, GTK_STATE_NORMAL, &gdkColor);
}
void pListView::setHeaderText(const lstring& text) { void pListView::setHeaderText(const lstring& text) {
destructor(); destructor();
constructor(); constructor();

View File

@ -9,6 +9,11 @@ bool pTextEdit::focused() {
return GTK_WIDGET_HAS_FOCUS(subWidget); return GTK_WIDGET_HAS_FOCUS(subWidget);
} }
void pTextEdit::setBackgroundColor(Color color) {
GdkColor gdkColor = CreateColor(color.red, color.green, color.blue);
gtk_widget_modify_base(subWidget, GTK_STATE_NORMAL, &gdkColor);
}
void pTextEdit::setCursorPosition(unsigned position) { void pTextEdit::setCursorPosition(unsigned position) {
GtkTextMark* mark = gtk_text_buffer_get_mark(textBuffer, "insert"); GtkTextMark* mark = gtk_text_buffer_get_mark(textBuffer, "insert");
GtkTextIter iter; GtkTextIter iter;
@ -22,6 +27,11 @@ void pTextEdit::setEditable(bool editable) {
gtk_text_view_set_editable(GTK_TEXT_VIEW(subWidget), editable); gtk_text_view_set_editable(GTK_TEXT_VIEW(subWidget), editable);
} }
void pTextEdit::setForegroundColor(Color color) {
GdkColor gdkColor = CreateColor(color.red, color.green, color.blue);
gtk_widget_modify_text(subWidget, GTK_STATE_NORMAL, &gdkColor);
}
void pTextEdit::setText(string text) { void pTextEdit::setText(string text) {
locked = true; locked = true;
gtk_text_buffer_set_text(textBuffer, text, -1); gtk_text_buffer_set_text(textBuffer, text, -1);

View File

@ -331,7 +331,7 @@ void pWindow::constructor() {
if(file::exists(filename)) { if(file::exists(filename)) {
//maximum image size supported by GTK+ is 256x256; so we must scale larger images ourselves //maximum image size supported by GTK+ is 256x256; so we must scale larger images ourselves
nall::image icon(filename); nall::image icon(filename);
icon.scale(min(256u, icon.width), min(256u, icon.height), Interpolation::Hermite); icon.scale(min(256u, icon.width), min(256u, icon.height), true);
GdkPixbuf* pixbuf = CreatePixbuf(icon); GdkPixbuf* pixbuf = CreatePixbuf(icon);
gtk_window_set_icon(GTK_WINDOW(widget), pixbuf); gtk_window_set_icon(GTK_WINDOW(widget), pixbuf);
g_object_unref(G_OBJECT(pixbuf)); g_object_unref(G_OBJECT(pixbuf));

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
** Meta object code from reading C++ file 'platform.moc.hpp' ** Meta object code from reading C++ file 'platform.moc.hpp'
** **
** Created: Wed Feb 5 08:24:19 2014 ** Created: Fri Feb 14 13:37:55 2014
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.2) ** by: The Qt Meta Object Compiler version 63 (Qt 4.8.2)
** **
** WARNING! All changes made in this file will be lost! ** WARNING! All changes made in this file will be lost!

View File

@ -432,6 +432,8 @@ public:
void print(string text); void print(string text);
void reset(); void reset();
void setBackgroundColor(Color color);
void setForegroundColor(Color color);
void setPrompt(string prompt); void setPrompt(string prompt);
pConsole(Console& console) : pWidget(console), console(console) {} pConsole(Console& console) : pWidget(console), console(console) {}
@ -480,7 +482,9 @@ public:
QHBoxLayout* qtLayout; QHBoxLayout* qtLayout;
QtHexEditScrollBar* qtScroll; QtHexEditScrollBar* qtScroll;
void setBackgroundColor(Color color);
void setColumns(unsigned columns); void setColumns(unsigned columns);
void setForegroundColor(Color color);
void setLength(unsigned length); void setLength(unsigned length);
void setOffset(unsigned offset); void setOffset(unsigned offset);
void setRows(unsigned rows); void setRows(unsigned rows);
@ -560,7 +564,9 @@ public:
QLineEdit* qtLineEdit; QLineEdit* qtLineEdit;
Size minimumSize(); Size minimumSize();
void setBackgroundColor(Color color);
void setEditable(bool editable); void setEditable(bool editable);
void setForegroundColor(Color color);
void setText(string text); void setText(string text);
string text(); string text();
@ -585,8 +591,10 @@ public:
void autoSizeColumns(); void autoSizeColumns();
void remove(unsigned selection); void remove(unsigned selection);
void reset(); void reset();
void setBackgroundColor(Color color);
void setCheckable(bool checkable); void setCheckable(bool checkable);
void setChecked(unsigned selection, bool checked); void setChecked(unsigned selection, bool checked);
void setForegroundColor(Color color);
void setHeaderText(const lstring& text); void setHeaderText(const lstring& text);
void setHeaderVisible(bool visible); void setHeaderVisible(bool visible);
void setImage(unsigned selection, unsigned position, const image& image); void setImage(unsigned selection, unsigned position, const image& image);
@ -699,8 +707,10 @@ public:
TextEdit& textEdit; TextEdit& textEdit;
QTextEdit* qtTextEdit; QTextEdit* qtTextEdit;
void setBackgroundColor(Color color);
void setCursorPosition(unsigned position); void setCursorPosition(unsigned position);
void setEditable(bool editable); void setEditable(bool editable);
void setForegroundColor(Color color);
void setText(string text); void setText(string text);
void setWordWrap(bool wordWrap); void setWordWrap(bool wordWrap);
string text(); string text();

View File

@ -6,6 +6,12 @@ void pConsole::print(string text) {
void pConsole::reset() { void pConsole::reset() {
} }
void pConsole::setBackgroundColor(Color color) {
}
void pConsole::setForegroundColor(Color color) {
}
void pConsole::setPrompt(string prompt) { void pConsole::setPrompt(string prompt) {
} }

View File

@ -1,9 +1,15 @@
namespace phoenix { namespace phoenix {
void pHexEdit::setBackgroundColor(Color color) {
}
void pHexEdit::setColumns(unsigned columns) { void pHexEdit::setColumns(unsigned columns) {
update(); update();
} }
void pHexEdit::setForegroundColor(Color color) {
}
void pHexEdit::setLength(unsigned length) { void pHexEdit::setLength(unsigned length) {
//add one if last row is not equal to column length (eg only part of the row is present) //add one if last row is not equal to column length (eg only part of the row is present)
bool indivisible = hexEdit.state.columns == 0 || (hexEdit.state.length % hexEdit.state.columns) != 0; bool indivisible = hexEdit.state.columns == 0 || (hexEdit.state.length % hexEdit.state.columns) != 0;

View File

@ -5,10 +5,16 @@ Size pLineEdit::minimumSize() {
return {size.width + 12, size.height + 12}; return {size.width + 12, size.height + 12};
} }
void pLineEdit::setBackgroundColor(Color color) {
}
void pLineEdit::setEditable(bool editable) { void pLineEdit::setEditable(bool editable) {
qtLineEdit->setReadOnly(!editable); qtLineEdit->setReadOnly(!editable);
} }
void pLineEdit::setForegroundColor(Color color) {
}
void pLineEdit::setText(string text) { void pLineEdit::setText(string text) {
qtLineEdit->setText(QString::fromUtf8(text)); qtLineEdit->setText(QString::fromUtf8(text));
} }

View File

@ -29,6 +29,9 @@ void pListView::reset() {
qtListView->clear(); qtListView->clear();
} }
void pListView::setBackgroundColor(Color color) {
}
void pListView::setCheckable(bool checkable) { void pListView::setCheckable(bool checkable) {
if(checkable) { if(checkable) {
auto items = qtListView->findItems("", Qt::MatchContains); auto items = qtListView->findItems("", Qt::MatchContains);
@ -43,6 +46,9 @@ void pListView::setChecked(unsigned selection, bool checked) {
locked = false; locked = false;
} }
void pListView::setForegroundColor(Color color) {
}
void pListView::setHeaderText(const lstring& text) { void pListView::setHeaderText(const lstring& text) {
QStringList labels; QStringList labels;
for(auto& column : text) labels << QString::fromUtf8(column); for(auto& column : text) labels << QString::fromUtf8(column);

View File

@ -1,5 +1,8 @@
namespace phoenix { namespace phoenix {
void pTextEdit::setBackgroundColor(Color color) {
}
void pTextEdit::setCursorPosition(unsigned position) { void pTextEdit::setCursorPosition(unsigned position) {
QTextCursor cursor = qtTextEdit->textCursor(); QTextCursor cursor = qtTextEdit->textCursor();
unsigned lastCharacter = strlen(qtTextEdit->toPlainText().toUtf8().constData()); unsigned lastCharacter = strlen(qtTextEdit->toPlainText().toUtf8().constData());
@ -11,6 +14,9 @@ void pTextEdit::setEditable(bool editable) {
qtTextEdit->setTextInteractionFlags(editable ? Qt::TextEditorInteraction : Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse); qtTextEdit->setTextInteractionFlags(editable ? Qt::TextEditorInteraction : Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
} }
void pTextEdit::setForegroundColor(Color color) {
}
void pTextEdit::setText(string text) { void pTextEdit::setText(string text) {
qtTextEdit->setPlainText(QString::fromUtf8(text)); qtTextEdit->setPlainText(QString::fromUtf8(text));
} }

View File

@ -6,6 +6,12 @@ void pConsole::print(string text) {
void pConsole::reset() { void pConsole::reset() {
} }
void pConsole::setBackgroundColor(Color color) {
}
void pConsole::setForegroundColor(Color color) {
}
void pConsole::setPrompt(string prompt) { void pConsole::setPrompt(string prompt) {
} }

View File

@ -5,6 +5,8 @@ struct pConsole : public pWidget {
void print(string text); void print(string text);
void reset(); void reset();
void setBackgroundColor(Color color);
void setForegroundColor(Color color);
void setPrompt(string prompt); void setPrompt(string prompt);
pConsole(Console& console) : pWidget(console), console(console) {} pConsole(Console& console) : pWidget(console), console(console) {}

View File

@ -1,8 +1,14 @@
namespace phoenix { namespace phoenix {
void pHexEdit::setBackgroundColor(Color color) {
}
void pHexEdit::setColumns(unsigned columns) { void pHexEdit::setColumns(unsigned columns) {
} }
void pHexEdit::setForegroundColor(Color color) {
}
void pHexEdit::setLength(unsigned length) { void pHexEdit::setLength(unsigned length) {
} }

View File

@ -3,7 +3,9 @@ namespace phoenix {
struct pHexEdit : public pWidget { struct pHexEdit : public pWidget {
HexEdit& hexEdit; HexEdit& hexEdit;
void setBackgroundColor(Color color);
void setColumns(unsigned columns); void setColumns(unsigned columns);
void setForegroundColor(Color color);
void setLength(unsigned length); void setLength(unsigned length);
void setOffset(unsigned offset); void setOffset(unsigned offset);
void setRows(unsigned rows); void setRows(unsigned rows);

View File

@ -1,8 +1,14 @@
namespace phoenix { namespace phoenix {
void pLineEdit::setBackgroundColor(Color color) {
}
void pLineEdit::setEditable(bool editable) { void pLineEdit::setEditable(bool editable) {
} }
void pLineEdit::setForegroundColor(Color color) {
}
void pLineEdit::setText(string text) { void pLineEdit::setText(string text) {
} }

View File

@ -3,7 +3,9 @@ namespace phoenix {
struct pLineEdit : public pWidget { struct pLineEdit : public pWidget {
LineEdit& lineEdit; LineEdit& lineEdit;
void setBackgroundColor(Color color);
void setEditable(bool editable); void setEditable(bool editable);
void setForegroundColor(Color color);
void setText(string text); void setText(string text);
string text(); string text();

View File

@ -12,12 +12,18 @@ void pListView::remove(unsigned selection) {
void pListView::reset() { void pListView::reset() {
} }
void pListView::setBackgroundColor(Color color) {
}
void pListView::setCheckable(bool checkable) { void pListView::setCheckable(bool checkable) {
} }
void pListView::setChecked(unsigned selection, bool checked) { void pListView::setChecked(unsigned selection, bool checked) {
} }
void pListView::setForegroundColor(Color color) {
}
void pListView::setHeaderText(const lstring& text) { void pListView::setHeaderText(const lstring& text) {
} }

View File

@ -7,8 +7,10 @@ struct pListView : public pWidget {
void autoSizeColumns(); void autoSizeColumns();
void remove(unsigned selection); void remove(unsigned selection);
void reset(); void reset();
void setBackgroundColor(Color color);
void setCheckable(bool checkable); void setCheckable(bool checkable);
void setChecked(unsigned selection, bool checked); void setChecked(unsigned selection, bool checked);
void setForegroundColor(Color color);
void setHeaderText(const lstring& text); void setHeaderText(const lstring& text);
void setHeaderVisible(bool visible); void setHeaderVisible(bool visible);
void setImage(unsigned selection, unsigned position, const image& image); void setImage(unsigned selection, unsigned position, const image& image);

View File

@ -1,11 +1,17 @@
namespace phoenix { namespace phoenix {
void pTextEdit::setBackgroundColor(Color color) {
}
void pTextEdit::setCursorPosition(unsigned position) { void pTextEdit::setCursorPosition(unsigned position) {
} }
void pTextEdit::setEditable(bool editable) { void pTextEdit::setEditable(bool editable) {
} }
void pTextEdit::setForegroundColor(Color color) {
}
void pTextEdit::setText(string text) { void pTextEdit::setText(string text) {
} }

View File

@ -3,8 +3,10 @@ namespace phoenix {
struct pTextEdit : public pWidget { struct pTextEdit : public pWidget {
TextEdit& textEdit; TextEdit& textEdit;
void setBackgroundColor(Color color);
void setCursorPosition(unsigned position); void setCursorPosition(unsigned position);
void setEditable(bool editable); void setEditable(bool editable);
void setForegroundColor(Color color);
void setText(string text); void setText(string text);
void setWordWrap(bool wordWrap); void setWordWrap(bool wordWrap);
string text(); string text();

View File

@ -363,6 +363,8 @@ struct pConsole : public pWidget {
void print(string text); void print(string text);
void reset(); void reset();
void setBackgroundColor(Color color);
void setForegroundColor(Color color);
void setPrompt(string prompt); void setPrompt(string prompt);
pConsole(Console& console) : pWidget(console), console(console) {} pConsole(Console& console) : pWidget(console), console(console) {}
@ -391,7 +393,9 @@ struct pHexEdit : public pWidget {
WindowProc windowProc = nullptr; WindowProc windowProc = nullptr;
HWND scrollBar = nullptr; HWND scrollBar = nullptr;
void setBackgroundColor(Color color);
void setColumns(unsigned columns); void setColumns(unsigned columns);
void setForegroundColor(Color color);
void setLength(unsigned length); void setLength(unsigned length);
void setOffset(unsigned offset); void setOffset(unsigned offset);
void setRows(unsigned rows); void setRows(unsigned rows);
@ -454,7 +458,9 @@ struct pLineEdit : public pWidget {
LineEdit& lineEdit; LineEdit& lineEdit;
Size minimumSize(); Size minimumSize();
void setBackgroundColor(Color color);
void setEditable(bool editable); void setEditable(bool editable);
void setForegroundColor(Color color);
void setText(string text); void setText(string text);
string text(); string text();
@ -477,8 +483,10 @@ struct pListView : public pWidget {
void autoSizeColumns(); void autoSizeColumns();
void remove(unsigned selection); void remove(unsigned selection);
void reset(); void reset();
void setBackgroundColor(Color color);
void setCheckable(bool checkable); void setCheckable(bool checkable);
void setChecked(unsigned selection, bool checked); void setChecked(unsigned selection, bool checked);
void setForegroundColor(Color color);
void setGeometry(Geometry geometry); void setGeometry(Geometry geometry);
void setHeaderText(const lstring& text); void setHeaderText(const lstring& text);
void setHeaderVisible(bool visible); void setHeaderVisible(bool visible);
@ -573,8 +581,10 @@ struct pTabFrame : public pWidget {
struct pTextEdit : public pWidget { struct pTextEdit : public pWidget {
TextEdit& textEdit; TextEdit& textEdit;
void setBackgroundColor(Color color);
void setCursorPosition(unsigned position); void setCursorPosition(unsigned position);
void setEditable(bool editable); void setEditable(bool editable);
void setForegroundColor(Color color);
void setText(string text); void setText(string text);
void setWordWrap(bool wordWrap); void setWordWrap(bool wordWrap);
string text(); string text();

View File

@ -14,6 +14,12 @@ void pConsole::print(string text) {
void pConsole::reset() { void pConsole::reset() {
} }
void pConsole::setBackgroundColor(Color color) {
}
void pConsole::setForegroundColor(Color color) {
}
void pConsole::setPrompt(string prompt) { void pConsole::setPrompt(string prompt) {
} }

View File

@ -49,10 +49,16 @@ static LRESULT CALLBACK HexEdit_windowProc(HWND hwnd, UINT msg, WPARAM wparam, L
return hexEdit.p.windowProc(hwnd, msg, wparam, lparam); return hexEdit.p.windowProc(hwnd, msg, wparam, lparam);
} }
void pHexEdit::setBackgroundColor(Color color) {
}
void pHexEdit::setColumns(unsigned columns) { void pHexEdit::setColumns(unsigned columns) {
update(); update();
} }
void pHexEdit::setForegroundColor(Color color) {
}
void pHexEdit::setLength(unsigned length) { void pHexEdit::setLength(unsigned length) {
SetScrollRange(scrollBar, SB_CTL, 0, rowsScrollable(), TRUE); SetScrollRange(scrollBar, SB_CTL, 0, rowsScrollable(), TRUE);
EnableWindow(scrollBar, rowsScrollable() > 0); EnableWindow(scrollBar, rowsScrollable() > 0);

View File

@ -5,10 +5,16 @@ Size pLineEdit::minimumSize() {
return {size.width + 12, size.height + 10}; return {size.width + 12, size.height + 10};
} }
void pLineEdit::setBackgroundColor(Color color) {
}
void pLineEdit::setEditable(bool editable) { void pLineEdit::setEditable(bool editable) {
SendMessage(hwnd, EM_SETREADONLY, editable == false, 0); SendMessage(hwnd, EM_SETREADONLY, editable == false, 0);
} }
void pLineEdit::setForegroundColor(Color color) {
}
void pLineEdit::setText(string text) { void pLineEdit::setText(string text) {
locked = true; locked = true;
SetWindowText(hwnd, utf16_t(text)); SetWindowText(hwnd, utf16_t(text));

View File

@ -56,6 +56,9 @@ void pListView::reset() {
buildImageList(); //free previously allocated images buildImageList(); //free previously allocated images
} }
void pListView::setBackgroundColor(Color color) {
}
void pListView::setCheckable(bool checkable) { void pListView::setCheckable(bool checkable) {
ListView_SetExtendedListViewStyle(hwnd, LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES | (checkable ? LVS_EX_CHECKBOXES : 0)); ListView_SetExtendedListViewStyle(hwnd, LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES | (checkable ? LVS_EX_CHECKBOXES : 0));
} }
@ -66,6 +69,9 @@ void pListView::setChecked(unsigned selection, bool checked) {
locked = false; locked = false;
} }
void pListView::setForegroundColor(Color color) {
}
void pListView::setGeometry(Geometry geometry) { void pListView::setGeometry(Geometry geometry) {
pWidget::setGeometry(geometry); pWidget::setGeometry(geometry);
autoSizeColumns(); autoSizeColumns();

View File

@ -1,5 +1,8 @@
namespace phoenix { namespace phoenix {
void pTextEdit::setBackgroundColor(Color color) {
}
void pTextEdit::setCursorPosition(unsigned position) { void pTextEdit::setCursorPosition(unsigned position) {
if(position == ~0) position >>= 1; //Edit_SetSel takes signed type if(position == ~0) position >>= 1; //Edit_SetSel takes signed type
Edit_SetSel(hwnd, position, position); Edit_SetSel(hwnd, position, position);
@ -10,6 +13,9 @@ void pTextEdit::setEditable(bool editable) {
SendMessage(hwnd, EM_SETREADONLY, editable == false, (LPARAM)0); SendMessage(hwnd, EM_SETREADONLY, editable == false, (LPARAM)0);
} }
void pTextEdit::setForegroundColor(Color color) {
}
void pTextEdit::setText(string text) { void pTextEdit::setText(string text) {
locked = true; locked = true;
string output = text; string output = text;

View File

@ -1,6 +1,6 @@
/* Global Headers */ /* Global Headers */
#if defined(PLATFORM_X) #if defined(PLATFORM_XORG)
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>

View File

@ -14,7 +14,7 @@ struct Input {
virtual bool acquired() { return false; } virtual bool acquired() { return false; }
virtual nall::vector<nall::HID::Device*> poll() { return {}; } virtual nall::vector<nall::HID::Device*> poll() { return {}; }
virtual bool rumble(uint64_t id, bool enable) {} virtual bool rumble(uint64_t id, bool enable) { return false; }
virtual bool init() { return true; } virtual bool init() { return true; }
virtual void term() {} virtual void term() {}

View File

@ -1,4 +1,4 @@
#if defined(PLATFORM_X) #if defined(PLATFORM_XORG)
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glx.h> #include <GL/glx.h>
#define glGetProcAddress(name) (*glXGetProcAddress)((const GLubyte*)(name)) #define glGetProcAddress(name) (*glXGetProcAddress)((const GLubyte*)(name))

View File

@ -10,11 +10,6 @@ MSU1 msu1;
void MSU1::Enter() { msu1.enter(); } void MSU1::Enter() { msu1.enter(); }
void MSU1::enter() { void MSU1::enter() {
if(boot == true) {
boot = false;
for(unsigned addr = 0x2000; addr <= 0x2007; addr++) mmio_write(addr, 0x00);
}
while(true) { while(true) {
if(scheduler.sync == Scheduler::SynchronizeMode::All) { if(scheduler.sync == Scheduler::SynchronizeMode::All) {
scheduler.exit(Scheduler::ExitReason::SynchronizeEvent); scheduler.exit(Scheduler::ExitReason::SynchronizeEvent);
@ -27,12 +22,12 @@ void MSU1::enter() {
if(audiofile.end()) { if(audiofile.end()) {
if(!mmio.audio_repeat) { if(!mmio.audio_repeat) {
mmio.audio_play = false; mmio.audio_play = false;
audiofile.seek(mmio.audio_offset = 8); audiofile.seek(mmio.audio_play_offset = 8);
} else { } else {
audiofile.seek(mmio.audio_offset = mmio.audio_loop_offset); audiofile.seek(mmio.audio_play_offset = mmio.audio_loop_offset);
} }
} else { } else {
mmio.audio_offset += 4; mmio.audio_play_offset += 4;
left = audiofile.readl(2); left = audiofile.readl(2);
right = audiofile.readl(2); right = audiofile.readl(2);
} }
@ -57,7 +52,6 @@ void MSU1::init() {
} }
void MSU1::load() { void MSU1::load() {
data_open();
} }
void MSU1::unload() { void MSU1::unload() {
@ -72,17 +66,24 @@ void MSU1::power() {
void MSU1::reset() { void MSU1::reset() {
create(MSU1::Enter, 44100); create(MSU1::Enter, 44100);
boot = true;
mmio.data_offset = 0; mmio.data_seek_offset = 0;
mmio.audio_offset = 0; mmio.data_read_offset = 0;
mmio.audio_play_offset = 0;
mmio.audio_loop_offset = 0;
mmio.audio_track = 0; mmio.audio_track = 0;
mmio.audio_volume = 255; mmio.audio_volume = 0;
mmio.data_busy = true;
mmio.audio_busy = true; mmio.data_busy = false;
mmio.audio_busy = false;
mmio.audio_repeat = false; mmio.audio_repeat = false;
mmio.audio_play = false; mmio.audio_play = false;
mmio.audio_error = false; mmio.audio_error = false;
data_open();
audio_open();
} }
void MSU1::data_open() { void MSU1::data_open() {
@ -91,7 +92,7 @@ void MSU1::data_open() {
string name = document["cartridge/msu1/rom/name"].data; string name = document["cartridge/msu1/rom/name"].data;
if(name.empty()) name = "msu1.rom"; if(name.empty()) name = "msu1.rom";
if(datafile.open({interface->path(ID::SuperFamicom), name}, file::mode::read)) { if(datafile.open({interface->path(ID::SuperFamicom), name}, file::mode::read)) {
datafile.seek(mmio.data_offset); datafile.seek(mmio.data_read_offset);
} }
} }
@ -105,9 +106,20 @@ void MSU1::audio_open() {
break; break;
} }
if(audiofile.open({interface->path(ID::SuperFamicom), name}, file::mode::read)) { if(audiofile.open({interface->path(ID::SuperFamicom), name}, file::mode::read)) {
audiofile.seek(mmio.audio_offset); if(audiofile.size() >= 8) {
uint32 header = audiofile.readm(4);
if(header == 0x4d535531) { //"MSU1"
mmio.audio_loop_offset = 8 + audiofile.readl(4) * 4;
if(mmio.audio_loop_offset > audiofile.size()) mmio.audio_loop_offset = 8;
mmio.audio_error = false;
audiofile.seek(mmio.audio_play_offset);
return;
} }
} }
audiofile.close();
}
mmio.audio_error = true;
}
uint8 MSU1::mmio_read(unsigned addr) { uint8 MSU1::mmio_read(unsigned addr) {
cpu.synchronize_coprocessors(); cpu.synchronize_coprocessors();
@ -123,9 +135,9 @@ uint8 MSU1::mmio_read(unsigned addr) {
| (Revision << 0); | (Revision << 0);
case 0x2001: case 0x2001:
if(mmio.data_busy) return 0x00; if(mmio.data_busy) return 0x00;
mmio.data_offset++; if(datafile.end()) return 0x00;
if(datafile.open()) return datafile.read(); mmio.data_read_offset++;
return 0x00; return datafile.read();
case 0x2002: return 'S'; case 0x2002: return 'S';
case 0x2003: return '-'; case 0x2003: return '-';
case 0x2004: return 'M'; case 0x2004: return 'M';
@ -140,35 +152,22 @@ void MSU1::mmio_write(unsigned addr, uint8 data) {
addr = 0x2000 | (addr & 7); addr = 0x2000 | (addr & 7);
switch(addr) { switch(addr) {
case 0x2000: mmio.data_offset = (mmio.data_offset & 0xffffff00) | (data << 0); break; case 0x2000: mmio.data_seek_offset = (mmio.data_seek_offset & 0xffffff00) | (data << 0); break;
case 0x2001: mmio.data_offset = (mmio.data_offset & 0xffff00ff) | (data << 8); break; case 0x2001: mmio.data_seek_offset = (mmio.data_seek_offset & 0xffff00ff) | (data << 8); break;
case 0x2002: mmio.data_offset = (mmio.data_offset & 0xff00ffff) | (data << 16); break; case 0x2002: mmio.data_seek_offset = (mmio.data_seek_offset & 0xff00ffff) | (data << 16); break;
case 0x2003: mmio.data_offset = (mmio.data_offset & 0x00ffffff) | (data << 24); case 0x2003: mmio.data_seek_offset = (mmio.data_seek_offset & 0x00ffffff) | (data << 24);
if(datafile.open()) datafile.seek(mmio.data_offset); mmio.data_read_offset = mmio.data_seek_offset;
mmio.data_busy = false; data_open();
break; break;
case 0x2004: mmio.audio_track = (mmio.audio_track & 0xff00) | (data << 0); break; case 0x2004: mmio.audio_track = (mmio.audio_track & 0xff00) | (data << 0); break;
case 0x2005: mmio.audio_track = (mmio.audio_track & 0x00ff) | (data << 8); case 0x2005: mmio.audio_track = (mmio.audio_track & 0x00ff) | (data << 8);
mmio.audio_offset = 0; mmio.audio_play_offset = 8;
audio_open(); audio_open();
if(audiofile.open()) {
uint32 header = audiofile.readm(4);
if(header != 0x4d535531) { //verify 'MSU1' header
audiofile.close();
} else {
mmio.audio_loop_offset = 8 + audiofile.readl(4) * 4;
mmio.audio_offset = 8;
}
}
mmio.audio_busy = false;
mmio.audio_repeat = false;
mmio.audio_play = false;
mmio.audio_error = !audiofile.open();
break;
case 0x2006:
mmio.audio_volume = data;
break; break;
case 0x2006: mmio.audio_volume = data; break;
case 0x2007: case 0x2007:
if(mmio.audio_busy) break;
if(mmio.audio_error) break;
mmio.audio_repeat = data & 2; mmio.audio_repeat = data & 2;
mmio.audio_play = data & 1; mmio.audio_play = data & 1;
break; break;

View File

@ -16,11 +16,10 @@ struct MSU1 : Coprocessor {
void serialize(serializer&); void serialize(serializer&);
private: private:
bool boot;
file datafile; file datafile;
file audiofile; file audiofile;
enum Flag { enum Flag : unsigned {
DataBusy = 0x80, DataBusy = 0x80,
AudioBusy = 0x40, AudioBusy = 0x40,
AudioRepeating = 0x20, AudioRepeating = 0x20,
@ -30,8 +29,10 @@ private:
}; };
struct MMIO { struct MMIO {
uint32 data_offset; uint32 data_seek_offset;
uint32 audio_offset; uint32 data_read_offset;
uint32 audio_play_offset;
uint32 audio_loop_offset; uint32 audio_loop_offset;
uint16 audio_track; uint16 audio_track;

View File

@ -3,10 +3,10 @@
void MSU1::serialize(serializer& s) { void MSU1::serialize(serializer& s) {
Thread::serialize(s); Thread::serialize(s);
s.integer(boot); s.integer(mmio.data_seek_offset);
s.integer(mmio.data_read_offset);
s.integer(mmio.data_offset); s.integer(mmio.audio_play_offset);
s.integer(mmio.audio_offset);
s.integer(mmio.audio_loop_offset); s.integer(mmio.audio_loop_offset);
s.integer(mmio.audio_track); s.integer(mmio.audio_track);

View File

@ -60,8 +60,8 @@ void Audio::flush() {
signed cop_right = (int16)(cop_sample >> 16); signed cop_right = (int16)(cop_sample >> 16);
interface->audioSample( interface->audioSample(
sclamp<16>((dsp_left + cop_left ) / 2), sclamp<16>(dsp_left + cop_left ),
sclamp<16>((dsp_right + cop_right) / 2) sclamp<16>(dsp_right + cop_right)
); );
} }
} }

View File

@ -95,10 +95,10 @@ void Video::draw_cursor(uint16_t color, int x, int y) {
uint32_t pixelcolor = (15 << 15) | ((pixel == 1) ? 0 : color); uint32_t pixelcolor = (15 << 15) | ((pixel == 1) ? 0 : color);
if(hires == false) { if(hires == false) {
*((uint32_t*)data + vy * 1024 + vx) = palette[pixelcolor]; *((uint32_t*)data + vy * 1024 + vx) = pixelcolor;
} else { } else {
*((uint32_t*)data + vy * 1024 + vx * 2 + 0) = palette[pixelcolor]; *((uint32_t*)data + vy * 1024 + vx * 2 + 0) = pixelcolor;
*((uint32_t*)data + vy * 1024 + vx * 2 + 1) = palette[pixelcolor]; *((uint32_t*)data + vy * 1024 + vx * 2 + 1) = pixelcolor;
} }
} }
} }

View File

@ -25,11 +25,11 @@ else ifeq ($(platform),macosx)
else ifeq ($(platform),linux) else ifeq ($(platform),linux)
ruby := video.glx video.xv video.xshm video.sdl ruby := video.glx video.xv video.xshm video.sdl
ruby += audio.alsa audio.openal audio.oss audio.pulseaudio audio.pulseaudiosimple audio.ao ruby += audio.alsa audio.openal audio.oss audio.pulseaudio audio.pulseaudiosimple audio.ao
ruby += input.udev input.sdl input.x ruby += input.udev input.sdl input.xlib
else ifeq ($(platform),bsd) else ifeq ($(platform),bsd)
ruby := video.glx ruby := video.glx
ruby += audio.openal audio.oss ruby += audio.openal audio.oss
ruby += input.x ruby += input.xlib
endif endif
# phoenix # phoenix
@ -89,25 +89,29 @@ resource:
sourcery $(ui)/resource/resource.bml $(ui)/resource/resource.cpp $(ui)/resource/resource.hpp sourcery $(ui)/resource/resource.bml $(ui)/resource/resource.cpp $(ui)/resource/resource.hpp
install: install:
ifeq ($(platform),windows) ifneq ($(shell id -un),root)
$(error "make install must be run as root")
else ifeq ($(platform),windows)
else ifeq ($(platform),macosx) else ifeq ($(platform),macosx)
sudo mkdir -p /Library/Application\ Support/$(name) mkdir -p /Library/Application\ Support/$(name)
sudo cp -R profile/* /Library/Application\ Support/$(name) cp -R profile/* /Library/Application\ Support/$(name)
sudo cp data/cheats.bml /Library/Application\ Support/$(name)/cheats.bml cp data/cheats.bml /Library/Application\ Support/$(name)/cheats.bml
sudo chmod -R 777 /Library/Application\ Support/$(name) chmod -R 777 /Library/Application\ Support/$(name)
else else
sudo install -D -m 755 out/$(name) $(DESTDIR)$(prefix)/bin/$(name) cp out/$(name) $(prefix)/bin/$(name)
sudo install -D -m 644 data/$(name).png $(DESTDIR)$(prefix)/share/pixmaps/$(name).png cp data/$(name).png $(prefix)/share/pixmaps/$(name).png
sudo install -D -m 644 data/$(name).desktop $(DESTDIR)$(prefix)/share/applications/$(name).desktop cp data/$(name).desktop $(prefix)/share/applications/$(name).desktop
sudo mkdir -p /usr/share/$(name) mkdir -p /usr/share/$(name)
sudo cp -R profile/* /usr/share/$(name) cp -R profile/* /usr/share/$(name)
sudo cp data/cheats.bml /usr/share/$(name)/cheats.bml cp data/cheats.bml /usr/share/$(name)/cheats.bml
sudo chmod -R 777 /usr/share/$(name) chmod -R 777 /usr/share/$(name)
endif endif
uninstall: uninstall:
ifeq ($(platform),windows) ifneq ($(shell id -un),root)
$(error "make uninstall must be run as root")
else ifeq ($(platform),windows)
else ifeq ($(platform),macosx) else ifeq ($(platform),macosx)
else else
sudo rm $(DESTDIR)$(prefix)/bin/$(name) rm $(prefix)/bin/$(name)
endif endif

View File

@ -109,6 +109,8 @@ bool StateManager::save(string filename, unsigned revision) {
fp.write(slot.data(), slot.capacity()); fp.write(slot.data(), slot.capacity());
} }
} }
return true;
} }
void StateManager::slotLoad() { void StateManager::slotLoad() {

View File

@ -72,21 +72,25 @@ resource:
sourcery $(ui)/resource/resource.bml $(ui)/resource/resource.cpp $(ui)/resource/resource.hpp sourcery $(ui)/resource/resource.bml $(ui)/resource/resource.cpp $(ui)/resource/resource.hpp
install: install:
ifeq ($(platform),windows) ifneq ($(shell id -un),root)
$(error "make install must be run as root")
else ifeq ($(platform),windows)
else ifeq ($(platform),macosx) else ifeq ($(platform),macosx)
sudo mkdir -p /Library/Application\ Support/$(name) mkdir -p /Library/Application\ Support/$(name)
sudo cp -R profile/* /Library/Application\ Support/$(name) cp -R profile/* /Library/Application\ Support/$(name)
sudo chmod -R 777 /Library/Application\ Support/$(name) chmod -R 777 /Library/Application\ Support/$(name)
else else
sudo install -D -m 755 out/$(name) $(DESTDIR)$(prefix)/bin/$(name) cp out/$(name) $(prefix)/bin/$(name)
sudo mkdir -p /usr/share/$(name) mkdir -p /usr/share/$(name)
sudo cp -R profile/* /usr/share/$(name) cp -R profile/* /usr/share/$(name)
sudo chmod -R 777 /usr/share/$(name) chmod -R 777 /usr/share/$(name)
endif endif
uninstall: uninstall:
ifeq ($(platform),windows) ifneq ($(shell id -un),root)
$(error "make uninstall must be run as root")
else ifeq ($(platform),windows)
else ifeq ($(platform),macosx) else ifeq ($(platform),macosx)
else else
sudo rm $(DESTDIR)$(prefix)/bin/$(name) rm $(prefix)/bin/$(name)
endif endif

View File

@ -16,6 +16,10 @@ Settings::Settings() {
input.append(input.driver = ruby::input.optimalDriver(), "Driver"); input.append(input.driver = ruby::input.optimalDriver(), "Driver");
append(input, "Input"); append(input, "Input");
terminal.append(terminal.backgroundColor = 0x481818, "BackgroundColor");
terminal.append(terminal.foregroundColor = 0xffffff, "ForegroundColor");
append(terminal, "Terminal");
geometry.append(geometry.presentation = "", "Presentation"); geometry.append(geometry.presentation = "", "Presentation");
geometry.append(geometry.terminal = "", "Terminal"); geometry.append(geometry.terminal = "", "Terminal");
append(geometry, "Geometry"); append(geometry, "Geometry");
@ -31,7 +35,7 @@ void Settings::load() {
void Settings::unload() { void Settings::unload() {
//remember window geometry for next run //remember window geometry for next run
geometry.presentation = presentation->geometry().text(); geometry.presentation = presentation->geometry().text();
geometry.terminal = terminal->geometry().text(); geometry.terminal = ::terminal->geometry().text();
Configuration::Document::save(program->path("settings.bml")); Configuration::Document::save(program->path("settings.bml"));
} }
@ -46,6 +50,8 @@ void Settings::command(string s, lstring args) {
if(s == "audio.synchronize" && argc == 1) { audio.synchronize = args[0] != "false"; ruby::audio.set(ruby::Audio::Synchronize, audio.synchronize); return; } if(s == "audio.synchronize" && argc == 1) { audio.synchronize = args[0] != "false"; ruby::audio.set(ruby::Audio::Synchronize, audio.synchronize); return; }
if(s == "audio.mute" && argc == 1) { audio.mute = args[0] != "false"; return; } if(s == "audio.mute" && argc == 1) { audio.mute = args[0] != "false"; return; }
if(s == "input.driver" && argc == 1) { input.driver = args[0]; return; } if(s == "input.driver" && argc == 1) { input.driver = args[0]; return; }
if(s == "terminal.background-color" && argc == 1) { terminal.backgroundColor = hex(args[0]); ::terminal->setColors(); return; }
if(s == "terminal.foreground-color" && argc == 1) { terminal.foregroundColor = hex(args[0]); ::terminal->setColors(); return; }
echo("Error: unrecognized setting: ", s, "\n"); echo("Error: unrecognized setting: ", s, "\n");
} }

View File

@ -14,6 +14,11 @@ struct Settings : Configuration::Document {
string driver; string driver;
} input; } input;
struct Terminal : Configuration::Node {
unsigned backgroundColor;
unsigned foregroundColor;
} terminal;
struct Geometry : Configuration::Node { struct Geometry : Configuration::Node {
string presentation; string presentation;
string terminal; string terminal;

View File

@ -13,6 +13,7 @@ Terminal::Terminal() {
console.setFont(Font::monospace(8)); console.setFont(Font::monospace(8));
console.setPrompt("$ "); console.setPrompt("$ ");
setColors();
layout.append(console, {~0, ~0}); layout.append(console, {~0, ~0});
append(layout); append(layout);
@ -367,3 +368,17 @@ void Terminal::reset() {
void Terminal::print(const string& text) { void Terminal::print(const string& text) {
console.print(text); console.print(text);
} }
void Terminal::setColors() {
console.setBackgroundColor({
(uint8)(settings->terminal.backgroundColor >> 16),
(uint8)(settings->terminal.backgroundColor >> 8),
(uint8)(settings->terminal.backgroundColor >> 0)
});
console.setForegroundColor({
(uint8)(settings->terminal.foregroundColor >> 16),
(uint8)(settings->terminal.foregroundColor >> 8),
(uint8)(settings->terminal.foregroundColor >> 0)
});
}

View File

@ -19,6 +19,7 @@ struct Terminal : Window {
void inputEvent(HID::Device& device, unsigned group, unsigned input, int16_t oldValue, int16_t newValue); void inputEvent(HID::Device& device, unsigned group, unsigned input, int16_t oldValue, int16_t newValue);
void reset(); void reset();
void print(const string& text); void print(const string& text);
void setColors();
VerticalLayout layout; VerticalLayout layout;
Console console; Console console;