Update to v102r02 release.
byuu says:
Changelog:
- I caved on the `samples[] = {0.0}` thing, but I'm very unhappy about it
- if it's really invalid C++, then GCC needs to stop accepting it
in strict `-std=c++14` mode
- Emulator::Interface::Information::resettable is gone
- Emulator::Interface::reset() is gone
- FC, SFC, MD cores updated to remove soft reset behavior
- split GameBoy::Interface into GameBoyInterface,
GameBoyColorInterface
- split WonderSwan::Interface into WonderSwanInterface,
WonderSwanColorInterface
- PCE: fixed off-by-one scanline error [hex_usr]
- PCE: temporary hack to prevent crashing when VDS is set to < 2
- hiro: Cocoa: removed (u)int(#) constants; converted (u)int(#)
types to (u)int_(#)t types
- icarus: replaced usage of unique with strip instead (so we don't
mess up frameworks on macOS)
- libco: added macOS-specific section marker [Ryphecha]
So ... the major news this time is the removal of the soft reset
behavior. This is a major!! change that results in a 100KiB diff file,
and it's very prone to accidental mistakes!! If anyone is up for
testing, or even better -- looking over the code changes between v102r01
and v102r02 and looking for any issues, please do so. Ideally we'll want
to test every NES mapper type and every SNES coprocessor type by loading
said games and power cycling to make sure the games are all cleanly
resetting. It's too big of a change for me to cover there not being any
issues on my own, but this is truly critical code, so yeah ... please
help if you can.
We technically lose a bit of hardware documentation here. The soft reset
events do all kinds of interesting things in all kinds of different
chips -- or at least they do on the SNES. This is obviously not ideal.
But in the process of removing these portions of code, I found a few
mistakes I had made previously. It simplifies resetting the system state
a lot when not trying to have all the power() functions call the reset()
functions to share partial functionality.
In the future, the goal will be to come up with a way to add back in the
soft reset behavior via keyboard binding as with the Master System core.
What's going to have to happen is that the key binding will have to send
a "reset pulse" to every emulated chip, and those chips are going to
have to act independently to power() instead of reusing functionality.
We'll get there eventually, but there's many things of vastly greater
importance to work on right now, so it'll be a while. The information
isn't lost ... we'll just have to pull it out of v102 when we are ready.
Note that I left the SNES reset vector simulation code in, even though
it's not possible to trigger, for the time being.
Also ... the Super Game Boy core is still disconnected. To be honest, it
totally slipped my mind when I released v102 that it wasn't connected
again yet. This one's going to be pretty tricky to be honest. I'm
thinking about making a third GameBoy::Interface class just for SGB, and
coming up with some way of bypassing platform-> calls when in this
mode.
2017-01-22 21:04:26 +00:00
|
|
|
#if defined(LIBCO_C)
|
2016-09-14 11:55:53 +00:00
|
|
|
|
|
|
|
/*[amd64, arm, ppc, x86]:
|
|
|
|
by default, co_swap_function is marked as a text (code) section
|
|
|
|
if not supported, uncomment the below line to use mprotect instead */
|
|
|
|
/* #define LIBCO_MPROTECT */
|
|
|
|
|
|
|
|
/*[amd64]:
|
|
|
|
Win64 only: provides a substantial speed-up, but will thrash XMM regs
|
|
|
|
do not use this unless you are certain your application won't use SSE */
|
|
|
|
/* #define LIBCO_NO_SSE */
|
|
|
|
|
2020-10-08 14:18:08 +00:00
|
|
|
#if !defined(thread_local) /* User can override thread_local for obscure compilers */
|
|
|
|
#if !defined(LIBCO_MP) /* Running in single-threaded environment */
|
2016-09-14 11:55:53 +00:00
|
|
|
#define thread_local
|
2020-10-08 14:18:08 +00:00
|
|
|
#else /* Running in multi-threaded environment */
|
2020-10-16 23:17:56 +00:00
|
|
|
#if defined(__STDC__) /* Compiling as C Language */
|
2020-10-08 14:18:08 +00:00
|
|
|
#if defined(_MSC_VER) /* Don't rely on MSVC's C11 support */
|
2020-06-06 09:41:09 +00:00
|
|
|
#define thread_local __declspec(thread)
|
2020-10-08 14:18:08 +00:00
|
|
|
#elif __STDC_VERSION__ < 201112L /* If we are on C90/99 */
|
|
|
|
#if defined(__clang__) || defined(__GNUC__) /* Clang and GCC */
|
2020-06-06 09:41:09 +00:00
|
|
|
#define thread_local __thread
|
2020-10-08 14:18:08 +00:00
|
|
|
#else /* Otherwise, we ignore the directive (unless user provides their own) */
|
2020-06-06 09:41:09 +00:00
|
|
|
#define thread_local
|
|
|
|
#endif
|
2020-10-08 14:18:08 +00:00
|
|
|
#else /* C11 and newer define thread_local in threads.h */
|
2020-06-06 09:41:09 +00:00
|
|
|
#include <threads.h>
|
|
|
|
#endif
|
2020-10-08 14:18:08 +00:00
|
|
|
#elif defined(__cplusplus) /* Compiling as C++ Language */
|
|
|
|
#if __cplusplus < 201103L /* thread_local is a C++11 feature */
|
2020-06-06 09:41:09 +00:00
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define thread_local __declspec(thread)
|
|
|
|
#elif defined(__clang__) || defined(__GNUC__)
|
|
|
|
#define thread_local __thread
|
2020-10-08 14:18:08 +00:00
|
|
|
#else /* Otherwise, we ignore the directive (unless user provides their own) */
|
2020-06-06 09:41:09 +00:00
|
|
|
#define thread_local
|
|
|
|
#endif
|
2020-10-08 14:18:08 +00:00
|
|
|
#else /* In C++ >= 11, thread_local in a builtin keyword */
|
|
|
|
/* Don't do anything */
|
2020-06-06 09:41:09 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2016-09-14 11:55:53 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2020-06-06 09:41:09 +00:00
|
|
|
/* In alignas(a), 'a' should be a power of two that is at least the type's
|
|
|
|
alignment and at most the implementation's alignment limit. This limit is
|
|
|
|
2**13 on MSVC. To be portable to MSVC through at least version 10.0,
|
|
|
|
'a' should be an integer constant, as MSVC does not support expressions
|
|
|
|
such as 1 << 3.
|
|
|
|
|
|
|
|
The following C11 requirements are NOT supported on MSVC:
|
|
|
|
|
|
|
|
- If 'a' is zero, alignas has no effect.
|
|
|
|
- alignas can be used multiple times; the strictest one wins.
|
|
|
|
- alignas (TYPE) is equivalent to alignas (alignof (TYPE)).
|
|
|
|
*/
|
|
|
|
#if !defined(alignas)
|
2020-10-16 23:17:56 +00:00
|
|
|
#if defined(__STDC__) /* C Language */
|
2020-10-08 14:18:08 +00:00
|
|
|
#if defined(_MSC_VER) /* Don't rely on MSVC's C11 support */
|
2020-06-06 09:41:09 +00:00
|
|
|
#define alignas(bytes) __declspec(align(bytes))
|
2020-10-08 14:18:08 +00:00
|
|
|
#elif __STDC_VERSION__ >= 201112L /* C11 and above */
|
2020-06-06 09:41:09 +00:00
|
|
|
#include <stdalign.h>
|
2020-10-08 14:18:08 +00:00
|
|
|
#elif defined(__clang__) || defined(__GNUC__) /* C90/99 on Clang/GCC */
|
2020-06-06 09:41:09 +00:00
|
|
|
#define alignas(bytes) __attribute__ ((aligned (bytes)))
|
2020-10-08 14:18:08 +00:00
|
|
|
#else /* Otherwise, we ignore the directive (user should provide their own) */
|
2020-06-06 09:41:09 +00:00
|
|
|
#define alignas(bytes)
|
|
|
|
#endif
|
2020-10-08 14:18:08 +00:00
|
|
|
#elif defined(__cplusplus) /* C++ Language */
|
2020-06-06 09:41:09 +00:00
|
|
|
#if __cplusplus < 201103L
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define alignas(bytes) __declspec(align(bytes))
|
2020-10-08 14:18:08 +00:00
|
|
|
#elif defined(__clang__) || defined(__GNUC__) /* C++98/03 on Clang/GCC */
|
2020-06-06 09:41:09 +00:00
|
|
|
#define alignas(bytes) __attribute__ ((aligned (bytes)))
|
2020-10-08 14:18:08 +00:00
|
|
|
#else /* Otherwise, we ignore the directive (unless user provides their own) */
|
2020-06-06 09:41:09 +00:00
|
|
|
#define alignas(bytes)
|
|
|
|
#endif
|
2020-10-08 14:18:08 +00:00
|
|
|
#else /* C++ >= 11 has alignas keyword */
|
|
|
|
/* Do nothing */
|
2020-06-06 09:41:09 +00:00
|
|
|
#endif
|
2020-10-08 14:18:08 +00:00
|
|
|
#endif /* = !defined(__STDC_VERSION__) && !defined(__cplusplus) */
|
2016-09-14 11:55:53 +00:00
|
|
|
#endif
|
|
|
|
|
2020-06-06 13:27:44 +00:00
|
|
|
#if !defined(LIBCO_ASSERT)
|
|
|
|
#include <assert.h>
|
|
|
|
#define LIBCO_ASSERT assert
|
|
|
|
#endif
|
|
|
|
|
2021-07-05 21:09:30 +00:00
|
|
|
#if defined (__OpenBSD__)
|
|
|
|
#if !defined(LIBCO_MALLOC) || !defined(LIBCO_FREE)
|
2021-07-31 01:16:15 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/mman.h>
|
2021-07-05 21:09:30 +00:00
|
|
|
|
2021-07-31 01:16:15 +00:00
|
|
|
static void* malloc_obsd(size_t size) {
|
|
|
|
long pagesize = sysconf(_SC_PAGESIZE);
|
|
|
|
char* memory = (char*)mmap(NULL, size + pagesize, PROT_READ|PROT_WRITE, MAP_STACK|MAP_PRIVATE|MAP_ANON, -1, 0);
|
|
|
|
if (memory == MAP_FAILED) return NULL;
|
|
|
|
*(size_t*)memory = size + pagesize;
|
|
|
|
memory += pagesize;
|
|
|
|
return (void*)memory;
|
|
|
|
}
|
2021-07-05 21:09:30 +00:00
|
|
|
|
2021-07-31 01:16:15 +00:00
|
|
|
static void free_obsd(void *ptr) {
|
|
|
|
char* memory = (char*)ptr - sysconf(_SC_PAGESIZE);
|
|
|
|
munmap(memory, *(size_t*)memory);
|
|
|
|
}
|
2021-07-05 21:09:30 +00:00
|
|
|
|
2021-07-31 01:16:15 +00:00
|
|
|
#define LIBCO_MALLOC malloc_obsd
|
|
|
|
#define LIBCO_FREE free_obsd
|
2021-07-05 21:09:30 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2020-06-06 13:27:44 +00:00
|
|
|
#if !defined(LIBCO_MALLOC) || !defined(LIBCO_FREE)
|
|
|
|
#include <stdlib.h>
|
|
|
|
#define LIBCO_MALLOC malloc
|
|
|
|
#define LIBCO_FREE free
|
|
|
|
#endif
|
|
|
|
|
Update to v102r02 release.
byuu says:
Changelog:
- I caved on the `samples[] = {0.0}` thing, but I'm very unhappy about it
- if it's really invalid C++, then GCC needs to stop accepting it
in strict `-std=c++14` mode
- Emulator::Interface::Information::resettable is gone
- Emulator::Interface::reset() is gone
- FC, SFC, MD cores updated to remove soft reset behavior
- split GameBoy::Interface into GameBoyInterface,
GameBoyColorInterface
- split WonderSwan::Interface into WonderSwanInterface,
WonderSwanColorInterface
- PCE: fixed off-by-one scanline error [hex_usr]
- PCE: temporary hack to prevent crashing when VDS is set to < 2
- hiro: Cocoa: removed (u)int(#) constants; converted (u)int(#)
types to (u)int_(#)t types
- icarus: replaced usage of unique with strip instead (so we don't
mess up frameworks on macOS)
- libco: added macOS-specific section marker [Ryphecha]
So ... the major news this time is the removal of the soft reset
behavior. This is a major!! change that results in a 100KiB diff file,
and it's very prone to accidental mistakes!! If anyone is up for
testing, or even better -- looking over the code changes between v102r01
and v102r02 and looking for any issues, please do so. Ideally we'll want
to test every NES mapper type and every SNES coprocessor type by loading
said games and power cycling to make sure the games are all cleanly
resetting. It's too big of a change for me to cover there not being any
issues on my own, but this is truly critical code, so yeah ... please
help if you can.
We technically lose a bit of hardware documentation here. The soft reset
events do all kinds of interesting things in all kinds of different
chips -- or at least they do on the SNES. This is obviously not ideal.
But in the process of removing these portions of code, I found a few
mistakes I had made previously. It simplifies resetting the system state
a lot when not trying to have all the power() functions call the reset()
functions to share partial functionality.
In the future, the goal will be to come up with a way to add back in the
soft reset behavior via keyboard binding as with the Master System core.
What's going to have to happen is that the key binding will have to send
a "reset pulse" to every emulated chip, and those chips are going to
have to act independently to power() instead of reusing functionality.
We'll get there eventually, but there's many things of vastly greater
importance to work on right now, so it'll be a while. The information
isn't lost ... we'll just have to pull it out of v102 when we are ready.
Note that I left the SNES reset vector simulation code in, even though
it's not possible to trigger, for the time being.
Also ... the Super Game Boy core is still disconnected. To be honest, it
totally slipped my mind when I released v102 that it wasn't connected
again yet. This one's going to be pretty tricky to be honest. I'm
thinking about making a third GameBoy::Interface class just for SGB, and
coming up with some way of bypassing platform-> calls when in this
mode.
2017-01-22 21:04:26 +00:00
|
|
|
#if defined(_MSC_VER)
|
2016-09-14 11:55:53 +00:00
|
|
|
#define section(name) __declspec(allocate("." #name))
|
Update to v102r02 release.
byuu says:
Changelog:
- I caved on the `samples[] = {0.0}` thing, but I'm very unhappy about it
- if it's really invalid C++, then GCC needs to stop accepting it
in strict `-std=c++14` mode
- Emulator::Interface::Information::resettable is gone
- Emulator::Interface::reset() is gone
- FC, SFC, MD cores updated to remove soft reset behavior
- split GameBoy::Interface into GameBoyInterface,
GameBoyColorInterface
- split WonderSwan::Interface into WonderSwanInterface,
WonderSwanColorInterface
- PCE: fixed off-by-one scanline error [hex_usr]
- PCE: temporary hack to prevent crashing when VDS is set to < 2
- hiro: Cocoa: removed (u)int(#) constants; converted (u)int(#)
types to (u)int_(#)t types
- icarus: replaced usage of unique with strip instead (so we don't
mess up frameworks on macOS)
- libco: added macOS-specific section marker [Ryphecha]
So ... the major news this time is the removal of the soft reset
behavior. This is a major!! change that results in a 100KiB diff file,
and it's very prone to accidental mistakes!! If anyone is up for
testing, or even better -- looking over the code changes between v102r01
and v102r02 and looking for any issues, please do so. Ideally we'll want
to test every NES mapper type and every SNES coprocessor type by loading
said games and power cycling to make sure the games are all cleanly
resetting. It's too big of a change for me to cover there not being any
issues on my own, but this is truly critical code, so yeah ... please
help if you can.
We technically lose a bit of hardware documentation here. The soft reset
events do all kinds of interesting things in all kinds of different
chips -- or at least they do on the SNES. This is obviously not ideal.
But in the process of removing these portions of code, I found a few
mistakes I had made previously. It simplifies resetting the system state
a lot when not trying to have all the power() functions call the reset()
functions to share partial functionality.
In the future, the goal will be to come up with a way to add back in the
soft reset behavior via keyboard binding as with the Master System core.
What's going to have to happen is that the key binding will have to send
a "reset pulse" to every emulated chip, and those chips are going to
have to act independently to power() instead of reusing functionality.
We'll get there eventually, but there's many things of vastly greater
importance to work on right now, so it'll be a while. The information
isn't lost ... we'll just have to pull it out of v102 when we are ready.
Note that I left the SNES reset vector simulation code in, even though
it's not possible to trigger, for the time being.
Also ... the Super Game Boy core is still disconnected. To be honest, it
totally slipped my mind when I released v102 that it wasn't connected
again yet. This one's going to be pretty tricky to be honest. I'm
thinking about making a third GameBoy::Interface class just for SGB, and
coming up with some way of bypassing platform-> calls when in this
mode.
2017-01-22 21:04:26 +00:00
|
|
|
#elif defined(__APPLE__)
|
|
|
|
#define section(name) __attribute__((section("__TEXT,__" #name)))
|
|
|
|
#else
|
|
|
|
#define section(name) __attribute__((section("." #name "#")))
|
2016-09-14 11:55:53 +00:00
|
|
|
#endif
|
|
|
|
|
2020-06-06 13:27:44 +00:00
|
|
|
|
Update to v102r02 release.
byuu says:
Changelog:
- I caved on the `samples[] = {0.0}` thing, but I'm very unhappy about it
- if it's really invalid C++, then GCC needs to stop accepting it
in strict `-std=c++14` mode
- Emulator::Interface::Information::resettable is gone
- Emulator::Interface::reset() is gone
- FC, SFC, MD cores updated to remove soft reset behavior
- split GameBoy::Interface into GameBoyInterface,
GameBoyColorInterface
- split WonderSwan::Interface into WonderSwanInterface,
WonderSwanColorInterface
- PCE: fixed off-by-one scanline error [hex_usr]
- PCE: temporary hack to prevent crashing when VDS is set to < 2
- hiro: Cocoa: removed (u)int(#) constants; converted (u)int(#)
types to (u)int_(#)t types
- icarus: replaced usage of unique with strip instead (so we don't
mess up frameworks on macOS)
- libco: added macOS-specific section marker [Ryphecha]
So ... the major news this time is the removal of the soft reset
behavior. This is a major!! change that results in a 100KiB diff file,
and it's very prone to accidental mistakes!! If anyone is up for
testing, or even better -- looking over the code changes between v102r01
and v102r02 and looking for any issues, please do so. Ideally we'll want
to test every NES mapper type and every SNES coprocessor type by loading
said games and power cycling to make sure the games are all cleanly
resetting. It's too big of a change for me to cover there not being any
issues on my own, but this is truly critical code, so yeah ... please
help if you can.
We technically lose a bit of hardware documentation here. The soft reset
events do all kinds of interesting things in all kinds of different
chips -- or at least they do on the SNES. This is obviously not ideal.
But in the process of removing these portions of code, I found a few
mistakes I had made previously. It simplifies resetting the system state
a lot when not trying to have all the power() functions call the reset()
functions to share partial functionality.
In the future, the goal will be to come up with a way to add back in the
soft reset behavior via keyboard binding as with the Master System core.
What's going to have to happen is that the key binding will have to send
a "reset pulse" to every emulated chip, and those chips are going to
have to act independently to power() instead of reusing functionality.
We'll get there eventually, but there's many things of vastly greater
importance to work on right now, so it'll be a while. The information
isn't lost ... we'll just have to pull it out of v102 when we are ready.
Note that I left the SNES reset vector simulation code in, even though
it's not possible to trigger, for the time being.
Also ... the Super Game Boy core is still disconnected. To be honest, it
totally slipped my mind when I released v102 that it wasn't connected
again yet. This one's going to be pretty tricky to be honest. I'm
thinking about making a third GameBoy::Interface class just for SGB, and
coming up with some way of bypassing platform-> calls when in this
mode.
2017-01-22 21:04:26 +00:00
|
|
|
/* if defined(LIBCO_C) */
|
2016-09-14 11:55:53 +00:00
|
|
|
#endif
|