Skip to content

Commit

Permalink
Merge branch 'punesemu:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyoyo authored Jan 14, 2024
2 parents f52db02 + a281bcb commit 7554dc6
Show file tree
Hide file tree
Showing 23 changed files with 743 additions and 242 deletions.
7 changes: 5 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ Changelog:
- Rewritten mappers : All.
- Rewritten WRAM, VRAM, PRGROM, CHROM and Nametebles management.
- Rewritten FDS support.
Furthermore, an option has been added to select the mode for write operations. Until now, all writes were stored on an external file (to preserve the integrity of the disk image), now it's possible to choose to write them directly to the FDS/QD file (making it portable to other emulators as well).
* Furthermore, an option has been added to select the mode for write operations. Until now, all writes were stored on an external file (diff file) to preserve the integrity of the disk image, now it's possible to choose to write them directly to the FDS/QD file (making it portable to other emulators as well).
* Changed the format of the diff file, now I use the IPS format (which can always be applied to the original image).
- Rewritten the format and management of save states.
WARNING save states of version 0.110 or earlier are no longer compatible.
- Added support to Quick Disk format.
- Added an option for RAM initialization (#276).
It's possible to choose between three values:
* 0x00
* 0xFF (default)
* Randomize.
* Randomize
- Added a screen icon that shows when fast forward is active.
- Added the possibility to set default values for PPU overclocking to be applied for all roms in addition to the per-game ones already used.
- Added Arabic translation (thx to Chipsum).
- Added Polish translation (thx to elektronicznypank).
- Added full support for the NES 2.0 header format.
Expand Down
1 change: 1 addition & 0 deletions src/core/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ enum exit_type { EXIT_OK, EXIT_ERROR };
enum lower_value { LOWER, UPPER };
enum machine_mode { AUTO, NTSC, PAL, DENDY, DEFAULT = 255 };
enum initial_ram_value_type { IRV_0X00, IRV_0XFF, IRV_RANDOM };
enum overcan_type { PERGAME_OFF, PERGAME_ON, PERGAME_DEFAULT };
enum console_type {
REGULAR_NES,
VS_SYSTEM,
Expand Down
18 changes: 14 additions & 4 deletions src/core/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
#include "apu.h"
#include "input.h"

typedef struct _config_overclock {
BYTE enabled;
BYTE dmc_control_disabled;
struct config_overclock_extra_slines {
WORD vblank;
WORD postrender;
} extra_slines;
} _config_overclock;
typedef struct _last_geometry {
int x, y;
int w, h;
Expand Down Expand Up @@ -85,11 +93,7 @@ typedef struct _config {
BYTE bck_pause;
WORD language;
int dipswitch;
BYTE ppu_overclock;
BYTE ppu_overclock_dmc_control_disabled;
BYTE ppu_alignment;
WORD extra_vb_scanlines;
WORD extra_pr_scanlines;
BYTE save_battery_ram_file;
BYTE multiple_instances;
BYTE nsf_player_effect;
Expand All @@ -104,6 +108,12 @@ typedef struct _config {

_config_input input;
_config_apu apu;
_config_overclock *oclock;

struct _config_overclock_all {
_config_overclock def;
_config_overclock pergame;
} oclock_all;
#if defined (WITH_FFMPEG)
struct _config_recording {
BYTE last_type;
Expand Down
6 changes: 3 additions & 3 deletions src/core/cpu_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ INLINE static void apu_wr_reg(BYTE nidx, WORD address, BYTE value) {
r4011.cycles = r4011.frames = 0;
r4011.value = value;

if (!nsf.enabled && cfg->ppu_overclock && !cfg->ppu_overclock_dmc_control_disabled && value) {
if (!nsf.enabled && (cfg->oclock->enabled == PERGAME_ON) && !cfg->oclock->dmc_control_disabled && value) {
nes[nidx].p.overclock.DMC_in_use = TRUE;
nes[nidx].p.ppu_sclines.total = machine.total_lines;
nes[nidx].p.ppu_sclines.vint = machine.vint_lines;
Expand All @@ -1529,7 +1529,7 @@ INLINE static void apu_wr_reg(BYTE nidx, WORD address, BYTE value) {
if (address == 0x4012) {
DMC.address_start = (value << 6) | 0xC000;

if (!nsf.enabled && cfg->ppu_overclock && !cfg->ppu_overclock_dmc_control_disabled && value) {
if (!nsf.enabled && (cfg->oclock->enabled == PERGAME_ON) && !cfg->oclock->dmc_control_disabled && value) {
nes[nidx].p.overclock.DMC_in_use = FALSE;
ppu_overclock_update()
ppu_overclock_control()
Expand All @@ -1540,7 +1540,7 @@ INLINE static void apu_wr_reg(BYTE nidx, WORD address, BYTE value) {
/* sample length */
DMC.length = (value << 4) | 0x01;

if (!nsf.enabled && cfg->ppu_overclock && !cfg->ppu_overclock_dmc_control_disabled && value) {
if (!nsf.enabled && (cfg->oclock->enabled == PERGAME_ON) && !cfg->oclock->dmc_control_disabled && value) {
nes[nidx].p.overclock.DMC_in_use = FALSE;
ppu_overclock_update()
ppu_overclock_control()
Expand Down
2 changes: 0 additions & 2 deletions src/core/emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,6 @@ BYTE emu_turn_on(void) {
info.lag_frame.totals = 0;
info.lag_frame.consecutive = 0;

cfg->extra_vb_scanlines = cfg->extra_pr_scanlines = 0;

vs_system.watchdog.next = vs_system_wd_next()

info.r2002_jump_first_vblank = FALSE;
Expand Down
5 changes: 5 additions & 0 deletions src/core/fps.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "clock.h"
#include "conf.h"
#include "nes.h"
#include "gui.h"
#include "video/gfx_thread.h"

#define ff_estimated_ms()\
Expand Down Expand Up @@ -67,6 +68,7 @@ void fps_fast_forward_start(void) {
ppu_draw_screen_pause();
fps.fast_forward = TRUE;
fps_fast_forward_estimated_ms();
gui_update();
}
void fps_fast_forward_stop(void) {
if (!fps.fast_forward) {
Expand All @@ -75,6 +77,7 @@ void fps_fast_forward_stop(void) {
fps.fast_forward = FALSE;
fps_fast_forward_estimated_ms();
ppu_draw_screen_continue();
gui_update();
}

void fps_max_speed_estimated_ms(void) {
Expand All @@ -93,13 +96,15 @@ void fps_max_speed_start(void) {
ppu_draw_screen_pause();
fps.max_speed = TRUE;
fps_max_speed_estimated_ms();
gui_update();
}
void fps_max_speed_stop(void) {
if (!fps.max_speed) {
return;
}
fps.max_speed = FALSE;
fps_max_speed_estimated_ms();
gui_update();
ppu_draw_screen_continue();
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/mappers/MMC1.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ void wram_swap_MMC1_base(WORD address, WORD value) {
// older boards with older MMC1's, while the R bit was only introduced later. But because the E bit wasn't
// confirmed by the homebrew community until October 2010[4], emulators tend not to implement it.
//
// !!!! : Se Lascio questo controllo attivo "Witch n' Wiz (World) (Digital Release) (Aftermarket) (Unl).nes" ha le
// schermate sporche dopo la selezione dello slot di salvataggio
// !!!! : Se Lascio questo controllo attivo "Witch n' Wiz (World) (Digital Release) (Aftermarket) (Unl).nes" ha le
// schermate sporche dopo la selezione dello slot di salvataggio
// const BYTE wram_enabled = mmc1tmp.type == MMC1B
// ? (info.mapper.submapper == 0
// ? (mmc1.reg[3] | (mmc1.reg[1] | mmc1.reg[2])) & 0x10 ? FALSE : TRUE
Expand Down
2 changes: 1 addition & 1 deletion src/core/mappers/mapper_547.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ INLINE static void wram_fix_547(void) {
wram_swap_547(0x7000, m547.reg[1]);
}
INLINE static void wram_swap_547(WORD address, WORD value) {
memmap_auto_4k(0, MMCPU(address), (value & 0x01) | ((value & 0x80) >> 2));
memmap_auto_4k(0, MMCPU(address), ((value & 0x08) >> 2) | (value & 0x01));
}
INLINE static void mirroring_fix_547(void) {
if (m547.reg[10] & 0x02) {
Expand Down
6 changes: 3 additions & 3 deletions src/core/ppu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1086,9 +1086,9 @@ void ppu_overclock(BYTE nidx, BYTE reset_dmc_in_use) {
nes[nidx].p.overclock.sclines.vb = 0;
nes[nidx].p.overclock.sclines.pr = 0;

if (cfg->ppu_overclock) {
nes[nidx].p.overclock.sclines.vb = cfg->extra_vb_scanlines;
nes[nidx].p.overclock.sclines.pr = cfg->extra_pr_scanlines;
if (cfg->oclock && (cfg->oclock->enabled == PERGAME_ON)) {
nes[nidx].p.overclock.sclines.vb = cfg->oclock->extra_slines.vblank;
nes[nidx].p.overclock.sclines.pr = cfg->oclock->extra_slines.postrender;
}

nes[nidx].p.overclock.sclines.total = nes[nidx].p.overclock.sclines.vb + nes[nidx].p.overclock.sclines.pr;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/gui/designer/resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
<file>pics/overlay_controller.png</file>
<file>pics/overlay_family_basic_keyboard.png</file>
<file>pics/overlay_controller_left.png</file>
<file>pics/overlay_fastforward_gray.png</file>
<file>pics/overlay_subor_keyboard_sb97.png</file>
<file>pics/hostkey.png</file>
<file>pics/hostkey_captured.png</file>
Expand Down
16 changes: 16 additions & 0 deletions src/gui/designer/wdgOverlayUi.ui
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@
</property>
</widget>
</item>
<item>
<widget class="overlayWidgetFastForward" name="overlayFastForward" native="true">
<property name="minimumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="overlayWidgetFrame" name="overlayFrame" native="true">
<property name="minimumSize">
Expand Down Expand Up @@ -272,6 +282,12 @@
<header>wdgOverlayUi.hpp</header>
<container>1</container>
</customwidget>
<customwidget>
<class>overlayWidgetFastForward</class>
<extends>QWidget</extends>
<header>wdgOverlayUi.hpp</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="resources.qrc"/>
Expand Down
Loading

0 comments on commit 7554dc6

Please sign in to comment.