Compare commits

..

18 commits

Author SHA1 Message Date
Daniel Prilik
8ae814d615
Update .gitattributes 2022-01-11 14:34:56 -08:00
Daniel Prilik
cbc4160fe9
Merge pull request #15 from MrKOSMOS/master
Compiler warnings fix
2021-12-03 12:30:03 -10:00
MrKOSMOS
9f0c11c6e3
Update cpu.cc 2021-12-03 20:34:03 +00:00
MrKOSMOS
f19d1d0304
Update emu.cc 2021-12-03 20:10:45 +00:00
MrKOSMOS
42d33b1e08
Update emu.h 2021-12-03 20:08:27 +00:00
MrKOSMOS
0995f9a86f
Update widenes.cc 2021-12-02 20:56:10 +00:00
MrKOSMOS
1d903e2615
Update mapper_009.cc 2021-12-02 20:46:53 +00:00
MrKOSMOS
99ae2a99fa
Update mapper_007.cc 2021-12-02 20:46:23 +00:00
MrKOSMOS
35290b5296
Update mapper_004.cc
Making the compiler happy
2021-12-02 20:42:38 +00:00
MrKOSMOS
8c23e981f0
Update mapper_001.cc 2021-12-02 20:30:21 +00:00
MrKOSMOS
6f27b38d83
Update apu.cc
Idk, compiler stuff
2021-12-02 20:29:04 +00:00
MrKOSMOS
9e16eb1d13
Update emu.cc 2021-12-02 19:05:10 +00:00
MrKOSMOS
af086ebfa6
Update emu.cc 2021-12-02 18:37:47 +00:00
MrKOSMOS
772656ed71
Update emu.h 2021-12-02 18:30:18 +00:00
Daniel Prilik
050bb8b193
Merge pull request #12 from Margen67/actions
Add GitHub Actions CI
2020-08-31 21:22:03 -04:00
Margen67
88a571ac30 Add GitHub Actions CI 2020-08-22 17:36:36 -07:00
Daniel Prilik
cd756d0a2d fix some gcc warnings, and maybe even a ppu bug?
first commit in a _long_ time, and it's just because I installed a
fresh linux distro and wanted to see if ANESE compiles on it.
It does, but I noticed a couple of warnings and bugs, so these are
some quick fixes.

looks like I had an unintended fallthrough in my bgr_fetch routine.
not sure how mission-critical this is, but maybe it fixes stuff?

other than that, g++ helpfuly noted some other silly errors and
unused vars, so I cleaned those up too.

lastly, I removed some code that skipped the first directory
returned by cute_files in the menu component. Not _super_ sure why
that was there in the first place, but directory traversal now
works on some more linux distros (such as the one I am running)
2018-12-03 14:04:27 -05:00
Daniel Prilik
0081371aa4
add links to wideNES writeup 2018-08-28 13:39:26 -04:00
17 changed files with 145 additions and 21 deletions

6
.gitattributes vendored
View file

@ -1,5 +1,5 @@
# Exclude test-roms from GitHub language statistics
roms/* linguist-documentation
roms/** linguist-vendored
# Explore research too
research/* linguist-documentation
# Exclude research too
research/** linguist-vendored

113
.github/workflows/CI.yml vendored Normal file
View file

@ -0,0 +1,113 @@
name: CI
on:
push:
paths-ignore:
- '*.yml'
pull_request:
paths-ignore:
- '*.yml'
jobs:
build-windows:
name: build-windows (${{ matrix.configuration }}, ${{ matrix.arch }})
env:
SDL2: SDL2-${{ matrix.SDL2_ver }}
POWERSHELL_TELEMETRY_OPTOUT: 1
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
configuration: [Release, Debug]
arch: [x86, x64]
SDL2_ver: [2.0.12]
include:
- arch: x86
platform: Win32
- arch: x64
platform: x64
steps:
- uses: actions/checkout@v2
#- uses: actions/cache@v2
# id: cache
# with:
# path: |
# SDL2-devel-${{ matrix.SDL2_ver }}-VC.zip
# SDL2-${{ env.SDL2_ver }}-win32-${{ matrix.arch }}.zip
# key: ${{ env.SDL2_ver }}_1
- name: Download SDL2
#if: steps.cache.outputs.cache-hit != 'true'
run: |
curl -LJO https://www.libsdl.org/release/SDL2-devel-${{ matrix.SDL2_ver }}-VC.zip -LJO https://www.libsdl.org/release/SDL2-${{ matrix.SDL2_ver }}-win32-${{ matrix.arch }}.zip
7z x -r -y SDL2-devel-${{ matrix.SDL2_ver }}-VC.zip
- name: CMake generate
run: |
mkdir build && cd build
cmake .. -A ${{ matrix.platform }}
- name: Build
working-directory: build
run: cmake --build . --config ${{ matrix.configuration }} -j $env:NUMBER_OF_PROCESSORS
- if: matrix.configuration == 'Release'
name: Prepare artifacts
run: |
7z x -r -y SDL2-${{ matrix.SDL2_ver }}-win32-${{ matrix.arch }}.zip -oartifacts
mv build\${{ matrix.configuration }}\anese.exe, roms\demos\* artifacts
- if: matrix.configuration == 'Release'
uses: actions/upload-artifact@v2
with:
name: ANESE-${{ runner.os }}-${{ matrix.arch }}
path: artifacts
build-linux:
runs-on: ubuntu-latest
env:
compiler: ${{ matrix.compiler }}
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
configuration: [Release, RelWithDebInfo, MinSizeRel, Debug]
steps:
- uses: actions/checkout@v2
- name: Install SDL2
run: |
sudo apt-get update
sudo apt-get -y install libsdl2-dev
- name: CMake generate
run: |
mkdir build && cd build
cmake ..
- name: Build
working-directory: build
run: cmake --build . --config ${{ matrix.configuration }} -j$(nproc)
build-macos:
runs-on: macos-latest
env:
compiler: ${{ matrix.compiler }}
HOMEBREW_NO_ANALYTICS: 1
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
configuration: [Release, RelWithDebInfo, MinSizeRel, Debug]
steps:
- uses: actions/checkout@v2
- name: Install SDL2
run: brew install SDL2
- name: CMake generate
run: |
mkdir build && cd build
cmake ..
- name: Build
working-directory: build
run: cmake --build . --config ${{ matrix.configuration }} -j$(sysctl -n hw.ncpu)
- if: matrix.configuration == 'Release'
name: Prepare artifacts
working-directory: build
run: cmake --build . --config ${{ matrix.configuration }} --target install -j$(sysctl -n hw.ncpu)
- if: matrix.configuration == 'Release'
uses: actions/upload-artifact@v2
with:
name: ANESE-${{ runner.os }}-${{ matrix.compiler }}
path: bin

View file

@ -32,7 +32,7 @@ endif(NOT CMAKE_BUILD_TYPE)
# Setup compiler flags for different platforms
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -fno-exceptions -fno-rtti -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -fno-exceptions -fno-rtti -Wno-class-memaccess -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -fsanitize=undefined -fsanitize=address")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -g")
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)

View file

@ -5,6 +5,10 @@
</a>
</p>
<p align="center">
<a href="https://github.com/daniel5151/ANESE/actions?query=branch%3Amaster">
<img src="https://github.com/daniel5151/ANESE/workflows/CI/badge.svg?branch=master"
alt="Build Status GitHub Actions">
</a>
<a href="https://ci.appveyor.com/project/daniel5151/anese">
<img src="https://ci.appveyor.com/api/projects/status/qgy19m8us3ss6ilt?svg=true"
alt="Build Status Windows">

View file

@ -71,7 +71,7 @@ APU::APU(const NES_Params& params, Memory& mem, InterruptLines& interrupt)
// https://wiki.nesdev.com/w/index.php/CPU_power_up_state
void APU::power_cycle() {
memset(&this->chan, 0, sizeof this->chan);
memset((char*)&this->chan, 0, sizeof this->chan);
// https://wiki.nesdev.com/w/index.php/APU_Noise
this->chan.noise.sr = 1;

View file

@ -150,7 +150,7 @@ void Mapper_001::power_cycle() {
}
void Mapper_001::reset() {
memset(&this->reg, 0, sizeof this->reg);
memset((char*)&this->reg, 0, sizeof this->reg);
this->reg.sr = 0x10;
// This isn't documented anywhere, but seems to be needed...

View file

@ -183,5 +183,5 @@ void Mapper_004::power_cycle() {
}
void Mapper_004::reset() {
memset(&this->reg, 0, sizeof this->reg);
memset((char*)&this->reg, 0, sizeof this->reg);
}

View file

@ -52,5 +52,5 @@ void Mapper_007::update_banks() {
}
void Mapper_007::reset() {
memset(&this->reg, 0, sizeof this->reg);
memset((char*)&this->reg, 0, sizeof this->reg);
}

View file

@ -86,7 +86,7 @@ Mirroring::Type Mapper_009::mirroring() const {
}
void Mapper_009::reset() {
memset(&this->reg, 0, sizeof this->reg);
memset((char*)&this->reg, 0, sizeof this->reg);
this->reg.latch[0] = 1;
this->reg.latch[1] = 1;
}

View file

@ -60,8 +60,11 @@ void CPU::service_interrupt(Interrupts::Type interrupt, bool brk /* = false */)
this->cycles += 7;
switch (interrupt) {
case Interrupts::IRQ: if (brk || !this->reg.p.i)
this->reg.pc = this->read16(0xFFFE); break;
case Interrupts::IRQ:
if (brk || !this->reg.p.i) {
this->reg.pc = this->read16(0xFFFE);
}
break;
case Interrupts::RESET: this->reg.pc = this->read16(0xFFFC); break;
case Interrupts::NMI: this->reg.pc = this->read16(0xFFFA); break;
default: break;
@ -424,7 +427,7 @@ u16 CPU::peek16(u16 addr) const {
u16 CPU::read16(u16 addr) {
return this->mem.read(addr + 0) |
(this->mem.read(addr + 1) << 8);
};
}
u16 CPU::peek16_zpg(u16 addr) const {
return this->mem.peek(addr + 0) |

View file

@ -442,7 +442,7 @@ void PPU::bgr_fetch() {
this->bgr.shift.at_latch[0] = this->bgr.at_byte & 1;
this->bgr.shift.at_latch[1] = this->bgr.at_byte & 2;
}
} break;
// 1) Fetch Nametable Byte
// https://wiki.nesdev.com/w/index.php/PPU_scrolling#Tile_and_attribute_fetching
case 2: {

View file

@ -18,8 +18,9 @@ void get_abs_path(char* abs_path, const char* path, unsigned int n) {
#ifdef WIN32
GetFullPathName(path, n, abs_path, nullptr);
#else
const char* _ = realpath(path, abs_path);
(void)n;
(void)realpath(path, abs_path);
(void)_;
#endif
}

View file

@ -204,7 +204,7 @@ void EmuModule::input(const SDL_Event& event) {
// Use CMD on macOS, and CTRL on windows / linux
bool mod_ctrl = strcmp(SDL_GetPlatform(), "Mac OS X") == 0
? event.key.keysym.mod & (KMOD_LGUI | KMOD_RGUI)
: mod_ctrl = event.key.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL);
: event.key.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL);
// Regular 'ol keys
switch (event.key.keysym.sym) {

View file

@ -110,14 +110,11 @@ void MenuSubModule::update() {
// Get file-listing
cf_dir_t dir;
cf_dir_open(&dir, this->nav.directory);
bool skip_first = true;
while (dir.has_next) {
cf_file_t file;
cf_read_file(&dir, &file);
if (!skip_first)
files.push_back(file);
files.push_back(file);
cf_dir_next(&dir);
skip_first = false;
}
cf_dir_close(&dir);

View file

@ -716,7 +716,7 @@ void WideNESModule::ppu_frame_end_handler() {
this->phash.max = INT_MIN;
// reset heuristics
memset(&this->h, 0, sizeof this->h);
memset((char*)&this->h, 0, sizeof this->h);
// check if scene already exists
// not that slow tbh, basically linear wrt #scenes (since unordered_map is

View file

@ -6338,6 +6338,7 @@ static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g)
// two back is the image from two frames ago, used for a very specific disposal format
static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, int req_comp, stbi_uc *two_back)
{
(void) req_comp;
int dispose;
int first_frame;
int pi;
@ -6562,6 +6563,7 @@ static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y,
static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri)
{
(void)ri;
stbi_uc *u = 0;
stbi__gif g;
memset(&g, 0, sizeof(g));

View file

@ -8,7 +8,8 @@ That's a lot of work.
Wouldn't it be cool to automate that?
Enter **wideNES**, a novel method to map-out NES games automatically.
Enter [**wideNES**](http://prilik.com/blog/wideNES), a novel method to map-out
NES games automatically.
<p align="center">
<img src="resources/web/wideNES_metroid.gif" alt="wideNES on Metroid">
@ -78,6 +79,9 @@ recorded.
It's not quite _that_ simple, since there are lots of additional heuritics that
are used to smooth out edge-cases, but at a high level, that's the gist of it!
If you're really interested in the gory details, check out the writeup on
[my blog!](http://prilik.com/blog/wideNES)
## Caveats
wideNES works surprisingly well with many games out of the box, but it's no