bsnes/nall/platform.hpp

128 lines
4.1 KiB
C++
Raw Normal View History

#pragma once
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
2014-02-24 09:39:09 +00:00
#include <nall/intrinsics.hpp>
namespace Math {
static const long double e = 2.71828182845904523536;
static const long double Pi = 3.14159265358979323846;
}
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
2014-02-24 09:39:09 +00:00
#if defined(PLATFORM_WINDOWS)
Update to v094r09 release. byuu says: This will easily be the biggest diff in the history of higan. And not in a good way. * target-higan and target-loki have been blown away completely * nall and ruby massively updated * phoenix replaced with hiro (pretty near a total rewrite) * target-higan restarted using hiro (just a window for now) * all emulation cores updated to compile again * installation changed to not require root privileges (installs locally) For the foreseeable future (maybe even permanently?), the new higan UI will only build under Linux/BSD with GTK+ 2.20+. Probably the most likely route for Windows/OS X will be to try and figure out how to build hiro/GTK on those platforms, as awful as that would be. The other alternative would be to produce new UIs for those platforms ... which would actually be a good opportunity to make something much more user friendly. Being that I just started on this a few hours ago, that means that for at least a few weeks, don't expect to be able to actually play any games. Right now, you can pretty much just compile the binary and that's it. It's quite possible that some nall changes didn't produce compilation errors, but will produce runtime errors. So until the UI can actually load games, we won't know if anything is broken. But we should mostly be okay. It was mostly just trim<1> -> trim changes, moving to Hash::SHA256 (much cleaner), and patching some reckless memory copy functions enough to compile. Progress isn't going to be like it was before: I'm now dividing my time much thinner between studying and other hobbies. My aim this time is not to produce a binary for everyone to play games on. Rather, it's to keep the emulator alive. I want to be able to apply critical patches again. And I would also like the base of the emulator to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
//minimum version needed for _wstat64, AI_ADDRCONFIG, etc
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0601
Update to v079 release. byuu says: This release includes Nintendo Super System DIP switch emulation and improved PPU rendering accuracy, among other things. Changelog: - added Nintendo Super System DIP switch emulation [requires XML setting maps] - emulated Super Game Boy $6001 VRAM offset selection port [ikari_01] - fixed randomness initialization of S-SMP port registers [fixes DBZ:Hyper Dimension and Ninja Warriors] - mosaic V-countdown caches BGOFS registers (fixes Super Turrican 2 effect) [reported by zal16] - non-mosaic BGOFS registers are always cached at H=60 (fixes NHL '94 and Super Mario World flickering) - fixed 2xSaI family of renderers on 64-bit systems - cleaned up SMP source code - phoenix: fixed a bug when closing bsnes while minimized Please note that the mosaic BGOFS fix is only for the accuracy profile. Unfortunately the older scanline-based compatibility renderer's code is nearly unmaintainable at this point, so I haven't yet been able to backport the fixes. Also, I have written a new cycle-accurate SMP core that does not use libco. The aim is to implement it into Snes9X v1.54. But it would of course be prudent to test the new core first. [...then in the next post...] Decided to keep that Super Mario World part a surprise, so ... surprise! Realized while working on the Super Turrican 2 mosaic fix, and from looking at NHL '94 and Dai Kaijuu Monogatari 2's behavior, that BGOFS registers must be cached between H=0 and H=88 for the entire scanline ... they can't work otherwise, and it'd be stupid for the PPU to re-add the offset to the position on every pixel anyway. I chose H=60 for now. Once I am set up with the RGB monitor and the North American cartridge dumping is completed, I'll set it on getting exact timings for all these things. It'll probably require a smallish speed hit to allow exact-cycle timing events for everything in the PPU.
2011-06-05 03:45:04 +00:00
#undef __MSVCRT_VERSION__
Update to v094r09 release. byuu says: This will easily be the biggest diff in the history of higan. And not in a good way. * target-higan and target-loki have been blown away completely * nall and ruby massively updated * phoenix replaced with hiro (pretty near a total rewrite) * target-higan restarted using hiro (just a window for now) * all emulation cores updated to compile again * installation changed to not require root privileges (installs locally) For the foreseeable future (maybe even permanently?), the new higan UI will only build under Linux/BSD with GTK+ 2.20+. Probably the most likely route for Windows/OS X will be to try and figure out how to build hiro/GTK on those platforms, as awful as that would be. The other alternative would be to produce new UIs for those platforms ... which would actually be a good opportunity to make something much more user friendly. Being that I just started on this a few hours ago, that means that for at least a few weeks, don't expect to be able to actually play any games. Right now, you can pretty much just compile the binary and that's it. It's quite possible that some nall changes didn't produce compilation errors, but will produce runtime errors. So until the UI can actually load games, we won't know if anything is broken. But we should mostly be okay. It was mostly just trim<1> -> trim changes, moving to Hash::SHA256 (much cleaner), and patching some reckless memory copy functions enough to compile. Progress isn't going to be like it was before: I'm now dividing my time much thinner between studying and other hobbies. My aim this time is not to produce a binary for everyone to play games on. Rather, it's to keep the emulator alive. I want to be able to apply critical patches again. And I would also like the base of the emulator to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
#define __MSVCRT_VERSION__ _WIN32_WINNT
#include <nall/windows/utf8.hpp>
Update to v079 release. byuu says: This release includes Nintendo Super System DIP switch emulation and improved PPU rendering accuracy, among other things. Changelog: - added Nintendo Super System DIP switch emulation [requires XML setting maps] - emulated Super Game Boy $6001 VRAM offset selection port [ikari_01] - fixed randomness initialization of S-SMP port registers [fixes DBZ:Hyper Dimension and Ninja Warriors] - mosaic V-countdown caches BGOFS registers (fixes Super Turrican 2 effect) [reported by zal16] - non-mosaic BGOFS registers are always cached at H=60 (fixes NHL '94 and Super Mario World flickering) - fixed 2xSaI family of renderers on 64-bit systems - cleaned up SMP source code - phoenix: fixed a bug when closing bsnes while minimized Please note that the mosaic BGOFS fix is only for the accuracy profile. Unfortunately the older scanline-based compatibility renderer's code is nearly unmaintainable at this point, so I haven't yet been able to backport the fixes. Also, I have written a new cycle-accurate SMP core that does not use libco. The aim is to implement it into Snes9X v1.54. But it would of course be prudent to test the new core first. [...then in the next post...] Decided to keep that Super Mario World part a surprise, so ... surprise! Realized while working on the Super Turrican 2 mosaic fix, and from looking at NHL '94 and Dai Kaijuu Monogatari 2's behavior, that BGOFS registers must be cached between H=0 and H=88 for the entire scanline ... they can't work otherwise, and it'd be stupid for the PPU to re-add the offset to the position on every pixel anyway. I chose H=60 for now. Once I am set up with the RGB monitor and the North American cartridge dumping is completed, I'll set it on getting exact timings for all these things. It'll probably require a smallish speed hit to allow exact-cycle timing events for everything in the PPU.
2011-06-05 03:45:04 +00:00
#endif
Update to v094r09 release. byuu says: This will easily be the biggest diff in the history of higan. And not in a good way. * target-higan and target-loki have been blown away completely * nall and ruby massively updated * phoenix replaced with hiro (pretty near a total rewrite) * target-higan restarted using hiro (just a window for now) * all emulation cores updated to compile again * installation changed to not require root privileges (installs locally) For the foreseeable future (maybe even permanently?), the new higan UI will only build under Linux/BSD with GTK+ 2.20+. Probably the most likely route for Windows/OS X will be to try and figure out how to build hiro/GTK on those platforms, as awful as that would be. The other alternative would be to produce new UIs for those platforms ... which would actually be a good opportunity to make something much more user friendly. Being that I just started on this a few hours ago, that means that for at least a few weeks, don't expect to be able to actually play any games. Right now, you can pretty much just compile the binary and that's it. It's quite possible that some nall changes didn't produce compilation errors, but will produce runtime errors. So until the UI can actually load games, we won't know if anything is broken. But we should mostly be okay. It was mostly just trim<1> -> trim changes, moving to Hash::SHA256 (much cleaner), and patching some reckless memory copy functions enough to compile. Progress isn't going to be like it was before: I'm now dividing my time much thinner between studying and other hobbies. My aim this time is not to produce a binary for everyone to play games on. Rather, it's to keep the emulator alive. I want to be able to apply critical patches again. And I would also like the base of the emulator to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
#include <atomic>
#include <limits>
Update to v094r09 release. byuu says: This will easily be the biggest diff in the history of higan. And not in a good way. * target-higan and target-loki have been blown away completely * nall and ruby massively updated * phoenix replaced with hiro (pretty near a total rewrite) * target-higan restarted using hiro (just a window for now) * all emulation cores updated to compile again * installation changed to not require root privileges (installs locally) For the foreseeable future (maybe even permanently?), the new higan UI will only build under Linux/BSD with GTK+ 2.20+. Probably the most likely route for Windows/OS X will be to try and figure out how to build hiro/GTK on those platforms, as awful as that would be. The other alternative would be to produce new UIs for those platforms ... which would actually be a good opportunity to make something much more user friendly. Being that I just started on this a few hours ago, that means that for at least a few weeks, don't expect to be able to actually play any games. Right now, you can pretty much just compile the binary and that's it. It's quite possible that some nall changes didn't produce compilation errors, but will produce runtime errors. So until the UI can actually load games, we won't know if anything is broken. But we should mostly be okay. It was mostly just trim<1> -> trim changes, moving to Hash::SHA256 (much cleaner), and patching some reckless memory copy functions enough to compile. Progress isn't going to be like it was before: I'm now dividing my time much thinner between studying and other hobbies. My aim this time is not to produce a binary for everyone to play games on. Rather, it's to keep the emulator alive. I want to be able to apply critical patches again. And I would also like the base of the emulator to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
#include <mutex>
#include <utility>
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
Update to v094r09 release. byuu says: This will easily be the biggest diff in the history of higan. And not in a good way. * target-higan and target-loki have been blown away completely * nall and ruby massively updated * phoenix replaced with hiro (pretty near a total rewrite) * target-higan restarted using hiro (just a window for now) * all emulation cores updated to compile again * installation changed to not require root privileges (installs locally) For the foreseeable future (maybe even permanently?), the new higan UI will only build under Linux/BSD with GTK+ 2.20+. Probably the most likely route for Windows/OS X will be to try and figure out how to build hiro/GTK on those platforms, as awful as that would be. The other alternative would be to produce new UIs for those platforms ... which would actually be a good opportunity to make something much more user friendly. Being that I just started on this a few hours ago, that means that for at least a few weeks, don't expect to be able to actually play any games. Right now, you can pretty much just compile the binary and that's it. It's quite possible that some nall changes didn't produce compilation errors, but will produce runtime errors. So until the UI can actually load games, we won't know if anything is broken. But we should mostly be okay. It was mostly just trim<1> -> trim changes, moving to Hash::SHA256 (much cleaner), and patching some reckless memory copy functions enough to compile. Progress isn't going to be like it was before: I'm now dividing my time much thinner between studying and other hobbies. My aim this time is not to produce a binary for everyone to play games on. Rather, it's to keep the emulator alive. I want to be able to apply critical patches again. And I would also like the base of the emulator to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
#include <fcntl.h>
Update to v079 release. byuu says: This release includes Nintendo Super System DIP switch emulation and improved PPU rendering accuracy, among other things. Changelog: - added Nintendo Super System DIP switch emulation [requires XML setting maps] - emulated Super Game Boy $6001 VRAM offset selection port [ikari_01] - fixed randomness initialization of S-SMP port registers [fixes DBZ:Hyper Dimension and Ninja Warriors] - mosaic V-countdown caches BGOFS registers (fixes Super Turrican 2 effect) [reported by zal16] - non-mosaic BGOFS registers are always cached at H=60 (fixes NHL '94 and Super Mario World flickering) - fixed 2xSaI family of renderers on 64-bit systems - cleaned up SMP source code - phoenix: fixed a bug when closing bsnes while minimized Please note that the mosaic BGOFS fix is only for the accuracy profile. Unfortunately the older scanline-based compatibility renderer's code is nearly unmaintainable at this point, so I haven't yet been able to backport the fixes. Also, I have written a new cycle-accurate SMP core that does not use libco. The aim is to implement it into Snes9X v1.54. But it would of course be prudent to test the new core first. [...then in the next post...] Decided to keep that Super Mario World part a surprise, so ... surprise! Realized while working on the Super Turrican 2 mosaic fix, and from looking at NHL '94 and Dai Kaijuu Monogatari 2's behavior, that BGOFS registers must be cached between H=0 and H=88 for the entire scanline ... they can't work otherwise, and it'd be stupid for the PPU to re-add the offset to the position on every pixel anyway. I chose H=60 for now. Once I am set up with the RGB monitor and the North American cartridge dumping is completed, I'll set it on getting exact timings for all these things. It'll probably require a smallish speed hit to allow exact-cycle timing events for everything in the PPU.
2011-06-05 03:45:04 +00:00
#include <sys/types.h>
#include <sys/stat.h>
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
2014-02-24 09:39:09 +00:00
#if defined(PLATFORM_WINDOWS)
#include <io.h>
#include <direct.h>
#include <shlobj.h>
Update to v079 release. byuu says: This release includes Nintendo Super System DIP switch emulation and improved PPU rendering accuracy, among other things. Changelog: - added Nintendo Super System DIP switch emulation [requires XML setting maps] - emulated Super Game Boy $6001 VRAM offset selection port [ikari_01] - fixed randomness initialization of S-SMP port registers [fixes DBZ:Hyper Dimension and Ninja Warriors] - mosaic V-countdown caches BGOFS registers (fixes Super Turrican 2 effect) [reported by zal16] - non-mosaic BGOFS registers are always cached at H=60 (fixes NHL '94 and Super Mario World flickering) - fixed 2xSaI family of renderers on 64-bit systems - cleaned up SMP source code - phoenix: fixed a bug when closing bsnes while minimized Please note that the mosaic BGOFS fix is only for the accuracy profile. Unfortunately the older scanline-based compatibility renderer's code is nearly unmaintainable at this point, so I haven't yet been able to backport the fixes. Also, I have written a new cycle-accurate SMP core that does not use libco. The aim is to implement it into Snes9X v1.54. But it would of course be prudent to test the new core first. [...then in the next post...] Decided to keep that Super Mario World part a surprise, so ... surprise! Realized while working on the Super Turrican 2 mosaic fix, and from looking at NHL '94 and Dai Kaijuu Monogatari 2's behavior, that BGOFS registers must be cached between H=0 and H=88 for the entire scanline ... they can't work otherwise, and it'd be stupid for the PPU to re-add the offset to the position on every pixel anyway. I chose H=60 for now. Once I am set up with the RGB monitor and the North American cartridge dumping is completed, I'll set it on getting exact timings for all these things. It'll probably require a smallish speed hit to allow exact-cycle timing events for everything in the PPU.
2011-06-05 03:45:04 +00:00
#include <wchar.h>
Update to v094r09 release. byuu says: This will easily be the biggest diff in the history of higan. And not in a good way. * target-higan and target-loki have been blown away completely * nall and ruby massively updated * phoenix replaced with hiro (pretty near a total rewrite) * target-higan restarted using hiro (just a window for now) * all emulation cores updated to compile again * installation changed to not require root privileges (installs locally) For the foreseeable future (maybe even permanently?), the new higan UI will only build under Linux/BSD with GTK+ 2.20+. Probably the most likely route for Windows/OS X will be to try and figure out how to build hiro/GTK on those platforms, as awful as that would be. The other alternative would be to produce new UIs for those platforms ... which would actually be a good opportunity to make something much more user friendly. Being that I just started on this a few hours ago, that means that for at least a few weeks, don't expect to be able to actually play any games. Right now, you can pretty much just compile the binary and that's it. It's quite possible that some nall changes didn't produce compilation errors, but will produce runtime errors. So until the UI can actually load games, we won't know if anything is broken. But we should mostly be okay. It was mostly just trim<1> -> trim changes, moving to Hash::SHA256 (much cleaner), and patching some reckless memory copy functions enough to compile. Progress isn't going to be like it was before: I'm now dividing my time much thinner between studying and other hobbies. My aim this time is not to produce a binary for everyone to play games on. Rather, it's to keep the emulator alive. I want to be able to apply critical patches again. And I would also like the base of the emulator to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <dlfcn.h>
#include <unistd.h>
#include <pwd.h>
Update to v094r09 release. byuu says: This will easily be the biggest diff in the history of higan. And not in a good way. * target-higan and target-loki have been blown away completely * nall and ruby massively updated * phoenix replaced with hiro (pretty near a total rewrite) * target-higan restarted using hiro (just a window for now) * all emulation cores updated to compile again * installation changed to not require root privileges (installs locally) For the foreseeable future (maybe even permanently?), the new higan UI will only build under Linux/BSD with GTK+ 2.20+. Probably the most likely route for Windows/OS X will be to try and figure out how to build hiro/GTK on those platforms, as awful as that would be. The other alternative would be to produce new UIs for those platforms ... which would actually be a good opportunity to make something much more user friendly. Being that I just started on this a few hours ago, that means that for at least a few weeks, don't expect to be able to actually play any games. Right now, you can pretty much just compile the binary and that's it. It's quite possible that some nall changes didn't produce compilation errors, but will produce runtime errors. So until the UI can actually load games, we won't know if anything is broken. But we should mostly be okay. It was mostly just trim<1> -> trim changes, moving to Hash::SHA256 (much cleaner), and patching some reckless memory copy functions enough to compile. Progress isn't going to be like it was before: I'm now dividing my time much thinner between studying and other hobbies. My aim this time is not to produce a binary for everyone to play games on. Rather, it's to keep the emulator alive. I want to be able to apply critical patches again. And I would also like the base of the emulator to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
#include <grp.h>
#include <sys/socket.h>
#include <sys/wait.h>
Update to v094r09 release. byuu says: This will easily be the biggest diff in the history of higan. And not in a good way. * target-higan and target-loki have been blown away completely * nall and ruby massively updated * phoenix replaced with hiro (pretty near a total rewrite) * target-higan restarted using hiro (just a window for now) * all emulation cores updated to compile again * installation changed to not require root privileges (installs locally) For the foreseeable future (maybe even permanently?), the new higan UI will only build under Linux/BSD with GTK+ 2.20+. Probably the most likely route for Windows/OS X will be to try and figure out how to build hiro/GTK on those platforms, as awful as that would be. The other alternative would be to produce new UIs for those platforms ... which would actually be a good opportunity to make something much more user friendly. Being that I just started on this a few hours ago, that means that for at least a few weeks, don't expect to be able to actually play any games. Right now, you can pretty much just compile the binary and that's it. It's quite possible that some nall changes didn't produce compilation errors, but will produce runtime errors. So until the UI can actually load games, we won't know if anything is broken. But we should mostly be okay. It was mostly just trim<1> -> trim changes, moving to Hash::SHA256 (much cleaner), and patching some reckless memory copy functions enough to compile. Progress isn't going to be like it was before: I'm now dividing my time much thinner between studying and other hobbies. My aim this time is not to produce a binary for everyone to play games on. Rather, it's to keep the emulator alive. I want to be able to apply critical patches again. And I would also like the base of the emulator to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
#include <netinet/in.h>
#include <netdb.h>
#include <poll.h>
#endif
#if defined(COMPILER_VISUALCPP)
#define va_copy(dest, src) ((dest) = (src))
#endif
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
2014-02-24 09:39:09 +00:00
#if defined(PLATFORM_WINDOWS)
#undef IN
#undef OUT
Update to v094r09 release. byuu says: This will easily be the biggest diff in the history of higan. And not in a good way. * target-higan and target-loki have been blown away completely * nall and ruby massively updated * phoenix replaced with hiro (pretty near a total rewrite) * target-higan restarted using hiro (just a window for now) * all emulation cores updated to compile again * installation changed to not require root privileges (installs locally) For the foreseeable future (maybe even permanently?), the new higan UI will only build under Linux/BSD with GTK+ 2.20+. Probably the most likely route for Windows/OS X will be to try and figure out how to build hiro/GTK on those platforms, as awful as that would be. The other alternative would be to produce new UIs for those platforms ... which would actually be a good opportunity to make something much more user friendly. Being that I just started on this a few hours ago, that means that for at least a few weeks, don't expect to be able to actually play any games. Right now, you can pretty much just compile the binary and that's it. It's quite possible that some nall changes didn't produce compilation errors, but will produce runtime errors. So until the UI can actually load games, we won't know if anything is broken. But we should mostly be okay. It was mostly just trim<1> -> trim changes, moving to Hash::SHA256 (much cleaner), and patching some reckless memory copy functions enough to compile. Progress isn't going to be like it was before: I'm now dividing my time much thinner between studying and other hobbies. My aim this time is not to produce a binary for everyone to play games on. Rather, it's to keep the emulator alive. I want to be able to apply critical patches again. And I would also like the base of the emulator to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
#undef interface
#define dllexport __declspec(dllexport)
#define MSG_NOSIGNAL 0
extern "C" {
using pollfd = WSAPOLLFD;
}
Update to v094r09 release. byuu says: This will easily be the biggest diff in the history of higan. And not in a good way. * target-higan and target-loki have been blown away completely * nall and ruby massively updated * phoenix replaced with hiro (pretty near a total rewrite) * target-higan restarted using hiro (just a window for now) * all emulation cores updated to compile again * installation changed to not require root privileges (installs locally) For the foreseeable future (maybe even permanently?), the new higan UI will only build under Linux/BSD with GTK+ 2.20+. Probably the most likely route for Windows/OS X will be to try and figure out how to build hiro/GTK on those platforms, as awful as that would be. The other alternative would be to produce new UIs for those platforms ... which would actually be a good opportunity to make something much more user friendly. Being that I just started on this a few hours ago, that means that for at least a few weeks, don't expect to be able to actually play any games. Right now, you can pretty much just compile the binary and that's it. It's quite possible that some nall changes didn't produce compilation errors, but will produce runtime errors. So until the UI can actually load games, we won't know if anything is broken. But we should mostly be okay. It was mostly just trim<1> -> trim changes, moving to Hash::SHA256 (much cleaner), and patching some reckless memory copy functions enough to compile. Progress isn't going to be like it was before: I'm now dividing my time much thinner between studying and other hobbies. My aim this time is not to produce a binary for everyone to play games on. Rather, it's to keep the emulator alive. I want to be able to apply critical patches again. And I would also like the base of the emulator to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
inline auto access(const char* path, int amode) -> int { return _waccess(nall::utf16_t(path), amode); }
inline auto getcwd(char* buf, size_t size) -> char* { wchar_t wpath[PATH_MAX] = L""; if(!_wgetcwd(wpath, size)) return nullptr; strcpy(buf, nall::utf8_t(wpath)); return buf; }
inline auto mkdir(const char* path, int mode) -> int { return _wmkdir(nall::utf16_t(path)); }
inline auto poll(struct pollfd fds[], unsigned long nfds, int timeout) -> int { return WSAPoll(fds, nfds, timeout); }
Update to v094r09 release. byuu says: This will easily be the biggest diff in the history of higan. And not in a good way. * target-higan and target-loki have been blown away completely * nall and ruby massively updated * phoenix replaced with hiro (pretty near a total rewrite) * target-higan restarted using hiro (just a window for now) * all emulation cores updated to compile again * installation changed to not require root privileges (installs locally) For the foreseeable future (maybe even permanently?), the new higan UI will only build under Linux/BSD with GTK+ 2.20+. Probably the most likely route for Windows/OS X will be to try and figure out how to build hiro/GTK on those platforms, as awful as that would be. The other alternative would be to produce new UIs for those platforms ... which would actually be a good opportunity to make something much more user friendly. Being that I just started on this a few hours ago, that means that for at least a few weeks, don't expect to be able to actually play any games. Right now, you can pretty much just compile the binary and that's it. It's quite possible that some nall changes didn't produce compilation errors, but will produce runtime errors. So until the UI can actually load games, we won't know if anything is broken. But we should mostly be okay. It was mostly just trim<1> -> trim changes, moving to Hash::SHA256 (much cleaner), and patching some reckless memory copy functions enough to compile. Progress isn't going to be like it was before: I'm now dividing my time much thinner between studying and other hobbies. My aim this time is not to produce a binary for everyone to play games on. Rather, it's to keep the emulator alive. I want to be able to apply critical patches again. And I would also like the base of the emulator to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
inline auto putenv(const char* value) -> int { return _wputenv(nall::utf16_t(value)); }
inline auto realpath(const char* file_name, char* resolved_name) -> char* { wchar_t wfile_name[PATH_MAX] = L""; if(!_wfullpath(wfile_name, nall::utf16_t(file_name), PATH_MAX)) return nullptr; strcpy(resolved_name, nall::utf8_t(wfile_name)); return resolved_name; }
inline auto rename(const char* oldname, const char* newname) -> int { return _wrename(nall::utf16_t(oldname), nall::utf16_t(newname)); }
inline auto usleep(unsigned milliseconds) -> void { Sleep(milliseconds / 1000); }
namespace nall {
//network functions take void*, not char*. this allows them to be used without casting
inline auto recv(int socket, void* buffer, size_t length, int flags) -> ssize_t {
return ::recv(socket, (char*)buffer, length, flags);
}
inline auto send(int socket, const void* buffer, size_t length, int flags) -> ssize_t {
return ::send(socket, (const char*)buffer, length, flags);
}
inline auto setsockopt(int socket, int level, int option_name, const void* option_value, socklen_t option_len) -> int {
return ::setsockopt(socket, level, option_name, (const char*)option_value, option_len);
}
}
Update to v094r09 release. byuu says: This will easily be the biggest diff in the history of higan. And not in a good way. * target-higan and target-loki have been blown away completely * nall and ruby massively updated * phoenix replaced with hiro (pretty near a total rewrite) * target-higan restarted using hiro (just a window for now) * all emulation cores updated to compile again * installation changed to not require root privileges (installs locally) For the foreseeable future (maybe even permanently?), the new higan UI will only build under Linux/BSD with GTK+ 2.20+. Probably the most likely route for Windows/OS X will be to try and figure out how to build hiro/GTK on those platforms, as awful as that would be. The other alternative would be to produce new UIs for those platforms ... which would actually be a good opportunity to make something much more user friendly. Being that I just started on this a few hours ago, that means that for at least a few weeks, don't expect to be able to actually play any games. Right now, you can pretty much just compile the binary and that's it. It's quite possible that some nall changes didn't produce compilation errors, but will produce runtime errors. So until the UI can actually load games, we won't know if anything is broken. But we should mostly be okay. It was mostly just trim<1> -> trim changes, moving to Hash::SHA256 (much cleaner), and patching some reckless memory copy functions enough to compile. Progress isn't going to be like it was before: I'm now dividing my time much thinner between studying and other hobbies. My aim this time is not to produce a binary for everyone to play games on. Rather, it's to keep the emulator alive. I want to be able to apply critical patches again. And I would also like the base of the emulator to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
#else
#define dllexport
#endif
#if defined(PLATFORM_MACOSX)
#define MSG_NOSIGNAL 0
#endif
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
2014-02-24 09:39:09 +00:00
#if defined(COMPILER_CLANG) || defined(COMPILER_GCC)
#define neverinline __attribute__((noinline))
#define alwaysinline inline __attribute__((always_inline))
#elif defined(COMPILER_VISUALCPP)
#define neverinline __declspec(noinline)
#define alwaysinline inline __forceinline
#else
#define neverinline
#define alwaysinline inline
#endif
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
2014-02-24 09:39:09 +00:00
#if defined(COMPILER_CLANG) || defined(COMPILER_GCC)
#define unreachable __builtin_unreachable()
#else
#define unreachable throw
#endif
Update to v094r09 release. byuu says: This will easily be the biggest diff in the history of higan. And not in a good way. * target-higan and target-loki have been blown away completely * nall and ruby massively updated * phoenix replaced with hiro (pretty near a total rewrite) * target-higan restarted using hiro (just a window for now) * all emulation cores updated to compile again * installation changed to not require root privileges (installs locally) For the foreseeable future (maybe even permanently?), the new higan UI will only build under Linux/BSD with GTK+ 2.20+. Probably the most likely route for Windows/OS X will be to try and figure out how to build hiro/GTK on those platforms, as awful as that would be. The other alternative would be to produce new UIs for those platforms ... which would actually be a good opportunity to make something much more user friendly. Being that I just started on this a few hours ago, that means that for at least a few weeks, don't expect to be able to actually play any games. Right now, you can pretty much just compile the binary and that's it. It's quite possible that some nall changes didn't produce compilation errors, but will produce runtime errors. So until the UI can actually load games, we won't know if anything is broken. But we should mostly be okay. It was mostly just trim<1> -> trim changes, moving to Hash::SHA256 (much cleaner), and patching some reckless memory copy functions enough to compile. Progress isn't going to be like it was before: I'm now dividing my time much thinner between studying and other hobbies. My aim this time is not to produce a binary for everyone to play games on. Rather, it's to keep the emulator alive. I want to be able to apply critical patches again. And I would also like the base of the emulator to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
#if defined(COMPILER_GCC) && __GNUC__ == 4 && __GNUC_MINOR__ <= 7
//GCC 4.7.x has a bug (#54849) when specifying override with a trailing return type:
//auto function() -> return_type override; //this is the syntax that the C++11 standard requires
//auto function() override -> return_type; //this is the syntax that GCC 4.7.x requires
//in order to compile code correctly with both compilers, we disable the override keyword for GCC
#define override
#endif