mirror of https://github.com/bsnes-emu/bsnes.git
Update to v068r20 release.
byuu says: Changelog: - fixed window casting crash in phoenix - added perfect forwarding to nall::string variadic templates to fix file load dialog crash in phoenix - disabled copy constructors in utf8_t to prevent this problem from occurring again in the future - separated canvas window proc by creating a separate class for it (ironically it was a desktop window causing the first crash) - use processorArchitecture="*" to make compilation easier - fixed status bar font assignment in phoenix/Windows - added InitCommonControls + CoInitialize for XAudio2 on XP - had to use DirectSound for audio; XAudio2 is crashing on exit which breaks the profiling (only a problem because you can't change the drivers without recompiling, there's really no reason to profile XAudio2 anyway)
This commit is contained in:
parent
697f23d45c
commit
4163059b21
|
@ -24,7 +24,7 @@ else ifeq ($(platform),osx)
|
|||
else ifeq ($(platform),win)
|
||||
link += -mwindows
|
||||
# link += -mconsole
|
||||
link += -mthreads -s -luuid -lkernel32 -luser32 -lgdi32 -lshell32
|
||||
link += -mthreads -s -luuid -lkernel32 -luser32 -lgdi32 -lcomctl32 -lcomdlg32 -lshell32 -lole32
|
||||
link += -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
|
||||
else
|
||||
unknown_platform: help;
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace nall {
|
|||
inline string& operator=(const string&);
|
||||
inline string& operator=(string&&);
|
||||
|
||||
template<typename... Args> inline string(Args... args);
|
||||
template<typename... Args> inline string(Args&&... args);
|
||||
inline string(const string&);
|
||||
inline string(string&&);
|
||||
inline ~string();
|
||||
|
@ -135,7 +135,7 @@ namespace nall {
|
|||
inline string strdouble(double value);
|
||||
|
||||
//variadic.hpp
|
||||
template<typename... Args> inline void print(Args... args);
|
||||
template<typename... Args> inline void print(Args&&... args);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -72,16 +72,16 @@ static void istring(string &output) {
|
|||
}
|
||||
|
||||
template<typename T, typename... Args>
|
||||
static void istring(string &output, T value, Args... args) {
|
||||
static void istring(string &output, const T &value, Args&&... args) {
|
||||
output.append(value);
|
||||
istring(output, args...);
|
||||
istring(output, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<typename... Args> string::string(Args... args) {
|
||||
template<typename... Args> string::string(Args&&... args) {
|
||||
size = 64;
|
||||
data = (char*)malloc(size + 1);
|
||||
*data = 0;
|
||||
istring(*this, args...);
|
||||
istring(*this, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
string::string(const string &value) {
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
namespace nall {
|
||||
|
||||
template<typename... Args> inline void print(Args... args) {
|
||||
printf("%s", (const char*)string(args...));
|
||||
template<typename... Args> inline void print(Args&&... args) {
|
||||
printf("%s", (const char*)string(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,6 +62,9 @@ namespace nall {
|
|||
delete[] buffer;
|
||||
}
|
||||
|
||||
utf8_t(const utf8_t&) = delete;
|
||||
utf8_t& operator=(const utf8_t&) = delete;
|
||||
|
||||
private:
|
||||
char *buffer;
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@ void Canvas::create(Window &parent, unsigned x, unsigned y, unsigned width, unsi
|
|||
canvas->bmi.bmiHeader.biSizeImage = canvas->pitch * canvas->height;
|
||||
|
||||
widget->window = CreateWindow(
|
||||
L"phoenix_window", L"",
|
||||
L"phoenix_canvas", L"",
|
||||
WS_CHILD | WS_VISIBLE,
|
||||
x, y, width, height,
|
||||
parent.widget->window, (HMENU)object->id, GetModuleHandle(0), 0
|
||||
|
@ -42,3 +42,19 @@ Canvas::~Canvas() {
|
|||
delete[] canvas->buffer;
|
||||
delete canvas;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK Canvas_windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
||||
switch(msg) {
|
||||
case WM_PAINT: {
|
||||
Object *object_ptr = (Object*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
if(object_ptr) {
|
||||
if(dynamic_cast<Canvas*>(object_ptr)) {
|
||||
Canvas &canvas = (Canvas&)*object_ptr;
|
||||
canvas.redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return DefWindowProc(hwnd, msg, wparam, lparam);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ void Label::setText(const char *text) {
|
|||
}
|
||||
|
||||
//all of this for want of a STATIC SS_VCENTER flag ...
|
||||
LRESULT CALLBACK Label_WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
||||
LRESULT CALLBACK Label_windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
||||
Window *window_ptr = (Window*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
|
||||
if(!window_ptr) return DefWindowProc(hwnd, msg, wparam, lparam);
|
||||
Label *label_ptr = (Label*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity type="win32" name="phoenix" version="1.0.0.0" processorArchitecture="AMD64"/>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="AMD64" publicKeyToken="6595b64144ccf1df" language="*"/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity type="win32" name="phoenix" version="1.0.0.0" processorArchitecture="x86"/>
|
||||
<assemblyIdentity type="win32" name="phoenix" version="1.0.0.0" processorArchitecture="*"/>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
|
@ -1,7 +1 @@
|
|||
#ifdef ARCH_X86
|
||||
1 24 "phoenix-x86.Manifest"
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_AMD64
|
||||
1 24 "phoenix-amd64.Manifest"
|
||||
#endif
|
||||
1 24 "phoenix.Manifest"
|
||||
|
|
|
@ -23,7 +23,7 @@ void Window::setDefaultFont(Font &font) {
|
|||
}
|
||||
|
||||
void Window::setFont(Font &font) {
|
||||
SendMessage(window->status, WM_SETFONT, (WPARAM)window->defaultFont, 0);
|
||||
SendMessage(window->status, WM_SETFONT, (WPARAM)font.font->font, 0);
|
||||
}
|
||||
|
||||
void Window::setGeometry(unsigned x, unsigned y, unsigned width, unsigned height) {
|
||||
|
|
|
@ -195,9 +195,9 @@ string OS::fileSave(Window &parent, const char *filter, const char *path) {
|
|||
}
|
||||
|
||||
static LRESULT CALLBACK OS_windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
||||
Window *window_ptr = (Window*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
if(!window_ptr) return DefWindowProc(hwnd, msg, wparam, lparam);
|
||||
Window &window = *window_ptr;
|
||||
Object *object_ptr = (Object*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
if(!object_ptr || !dynamic_cast<Window*>(object_ptr)) return DefWindowProc(hwnd, msg, wparam, lparam);
|
||||
Window &window = (Window&)*object_ptr;
|
||||
|
||||
switch(msg) {
|
||||
case WM_CLOSE: {
|
||||
|
@ -226,16 +226,6 @@ static LRESULT CALLBACK OS_windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM
|
|||
}
|
||||
}
|
||||
|
||||
case WM_PAINT: {
|
||||
Object *object_ptr = (Object*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
if(object_ptr) {
|
||||
if(dynamic_cast<Canvas*>(object_ptr)) {
|
||||
Canvas &canvas = (Canvas&)*object_ptr;
|
||||
canvas.redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case WM_COMMAND: {
|
||||
unsigned id = LOWORD(wparam);
|
||||
HWND control = GetDlgItem(window.widget->window, id);
|
||||
|
@ -369,6 +359,9 @@ Object* OS::findObject(unsigned id) {
|
|||
}
|
||||
|
||||
OS::OS() {
|
||||
InitCommonControls();
|
||||
CoInitialize(0);
|
||||
|
||||
os = new OS::Data;
|
||||
os->proportionalFont = Font_createFont("Tahoma", 8, false, false);
|
||||
os->monospaceFont = Font_createFont("Courier New", 8, false, false);
|
||||
|
@ -386,13 +379,25 @@ OS::OS() {
|
|||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
RegisterClass(&wc);
|
||||
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hbrBackground = CreateSolidBrush(RGB(0, 0, 0));
|
||||
wc.hCursor = LoadCursor(0, IDC_ARROW);
|
||||
wc.hIcon = LoadIcon(0, IDI_APPLICATION);
|
||||
wc.hInstance = GetModuleHandle(0);
|
||||
wc.lpfnWndProc = Canvas_windowProc;
|
||||
wc.lpszClassName = L"phoenix_canvas";
|
||||
wc.lpszMenuName = 0;
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
RegisterClass(&wc);
|
||||
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
|
||||
wc.hCursor = LoadCursor(0, IDC_ARROW);
|
||||
wc.hIcon = LoadIcon(0, IDI_APPLICATION);
|
||||
wc.hInstance = GetModuleHandle(0);
|
||||
wc.lpfnWndProc = Label_WindowProc;
|
||||
wc.lpfnWndProc = Label_windowProc;
|
||||
wc.lpszClassName = L"phoenix_label";
|
||||
wc.lpszMenuName = 0;
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace SNES {
|
||||
namespace Info {
|
||||
static const char Name[] = "bsnes";
|
||||
static const char Version[] = "068.19";
|
||||
static const char Version[] = "068.20";
|
||||
static const unsigned SerializerVersion = 13;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ else ifeq ($(platform),osx)
|
|||
|
||||
link += $(if $(findstring audio.openal,$(ruby)),-framework OpenAL)
|
||||
else ifeq ($(platform),win)
|
||||
arch := -DARCH_X86
|
||||
flags += -DPHOENIX_WINDOWS
|
||||
link +=
|
||||
|
||||
|
@ -65,7 +64,7 @@ obj/ruby.o: ruby/ruby.cpp $(call rwildcard,ruby/*)
|
|||
obj/phoenix.o: phoenix/phoenix.cpp $(call rwildcard,phoenix/*)
|
||||
|
||||
obj/resource.o: $(ui)/resource.rc
|
||||
windres $(ui)/resource.rc obj/resource.o $(arch)
|
||||
windres $(ui)/resource.rc obj/resource.o
|
||||
|
||||
# targets
|
||||
ui_build:;
|
||||
|
|
|
@ -4,7 +4,7 @@ Application application;
|
|||
|
||||
#if defined(PLATFORM_WIN)
|
||||
static string VideoDriver = "Direct3D";
|
||||
static string AudioDriver = "XAudio2";
|
||||
static string AudioDriver = "DirectSound";
|
||||
static string InputDriver = "RawInput";
|
||||
#elif defined(PLATFORM_X)
|
||||
static string VideoDriver = "OpenGL";
|
||||
|
@ -73,7 +73,9 @@ void Application::main(int argc, char **argv) {
|
|||
while(os.pending()) os.run();
|
||||
SNES::system.term();
|
||||
|
||||
exit(0);
|
||||
video.term();
|
||||
audio.term();
|
||||
input.term();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
|
|
@ -1,9 +1,2 @@
|
|||
#ifdef ARCH_X86
|
||||
1 24 "../phoenix/windows/phoenix-x86.Manifest"
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_AMD64
|
||||
1 24 "../phoenix/windows/phoenix-amd64.Manifest"
|
||||
#endif
|
||||
|
||||
1 24 "../phoenix/windows/phoenix.Manifest"
|
||||
2 ICON DISCARDABLE "data/bsnes.ico"
|
||||
|
|
Loading…
Reference in New Issue