Opening player render window
This commit is contained in:
parent
410bbd9338
commit
d310134441
|
@ -1,7 +1,7 @@
|
||||||
#ifndef __HQN_H__
|
#ifndef __HQN_H__
|
||||||
#define __HQN_H__
|
#define __HQN_H__
|
||||||
|
|
||||||
#include <Nes_Emu.h>
|
#include <core/Nes_Emu.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#define BLIT_SIZE 65536
|
#define BLIT_SIZE 65536
|
||||||
|
|
|
@ -218,9 +218,12 @@ void GUIController::update_blit(int32_t* blit, SDL_Surface* base, SDL_Surface* b
|
||||||
SDL_RenderClear(m_renderer);
|
SDL_RenderClear(m_renderer);
|
||||||
SDL_RenderCopy(m_renderer, m_tex, &NES_BLIT_RECT, &m_nesDest);
|
SDL_RenderCopy(m_renderer, m_tex, &NES_BLIT_RECT, &m_nesDest);
|
||||||
|
|
||||||
auto overlayTex = SDL_CreateTextureFromSurface(m_renderer, base);
|
if (base != NULL)
|
||||||
SDL_RenderCopy(m_renderer, overlayTex, &OVERLAY_BLIT_RECT_SRC, &OVERLAY_BLIT_RECT_DST);
|
{
|
||||||
SDL_DestroyTexture(overlayTex);
|
auto overlayTex = SDL_CreateTextureFromSurface(m_renderer, base);
|
||||||
|
SDL_RenderCopy(m_renderer, overlayTex, &OVERLAY_BLIT_RECT_SRC, &OVERLAY_BLIT_RECT_DST);
|
||||||
|
SDL_DestroyTexture(overlayTex);
|
||||||
|
}
|
||||||
|
|
||||||
if (button_a != NULL)
|
if (button_a != NULL)
|
||||||
{
|
{
|
||||||
|
|
74
meson.build
74
meson.build
|
@ -7,41 +7,41 @@ project('quickerNES','c','cpp',
|
||||||
# quickerNES Core sources
|
# quickerNES Core sources
|
||||||
|
|
||||||
quickerNESCoreSrc = [
|
quickerNESCoreSrc = [
|
||||||
'core/abstract_file.cpp',
|
'source/core/abstract_file.cpp',
|
||||||
'core/Nes_Apu.cpp',
|
'source/core/Nes_Apu.cpp',
|
||||||
'core/Nes_File.cpp',
|
'source/core/Nes_File.cpp',
|
||||||
'core/Nes_Oscs.cpp',
|
'source/core/Nes_Oscs.cpp',
|
||||||
'core/apu_state.cpp',
|
'source/core/apu_state.cpp',
|
||||||
'core/Nes_Buffer.cpp',
|
'source/core/Nes_Buffer.cpp',
|
||||||
'core/Nes_Fme7_Apu.cpp',
|
'source/core/Nes_Fme7_Apu.cpp',
|
||||||
'core/Nes_Ppu.cpp',
|
'source/core/Nes_Ppu.cpp',
|
||||||
'core/Blip_Buffer.cpp',
|
'source/core/Blip_Buffer.cpp',
|
||||||
'core/Nes_Cart.cpp',
|
'source/core/Nes_Cart.cpp',
|
||||||
'core/Nes_Mapper.cpp',
|
'source/core/Nes_Mapper.cpp',
|
||||||
'core/Nes_Ppu_Impl.cpp',
|
'source/core/Nes_Ppu_Impl.cpp',
|
||||||
'core/Data_Reader.cpp',
|
'source/core/Data_Reader.cpp',
|
||||||
'core/Nes_Core.cpp',
|
'source/core/Nes_Core.cpp',
|
||||||
'core/Nes_Ppu_Rendering.cpp',
|
'source/core/Nes_Ppu_Rendering.cpp',
|
||||||
'core/Effects_Buffer.cpp',
|
'source/core/Effects_Buffer.cpp',
|
||||||
'core/Nes_Cpu.cpp',
|
'source/core/Nes_Cpu.cpp',
|
||||||
'core/Nes_State.cpp',
|
'source/core/Nes_State.cpp',
|
||||||
'core/emu2413.cpp',
|
'source/core/emu2413.cpp',
|
||||||
'core/nes_data.cpp',
|
'source/core/nes_data.cpp',
|
||||||
'core/nes_util.cpp',
|
'source/core/nes_util.cpp',
|
||||||
'core/emu2413_state.cpp',
|
'source/core/emu2413_state.cpp',
|
||||||
'core/Nes_Effects_Buffer.cpp',
|
'source/core/Nes_Effects_Buffer.cpp',
|
||||||
'core/Nes_Namco_Apu.cpp',
|
'source/core/Nes_Namco_Apu.cpp',
|
||||||
'core/Nes_Vrc6_Apu.cpp',
|
'source/core/Nes_Vrc6_Apu.cpp',
|
||||||
'core/Multi_Buffer.cpp',
|
'source/core/Multi_Buffer.cpp',
|
||||||
'core/Nes_Emu.cpp',
|
'source/core/Nes_Emu.cpp',
|
||||||
'core/nes_ntsc.cpp',
|
'source/core/nes_ntsc.cpp',
|
||||||
'core/Nes_Vrc7.cpp',
|
'source/core/Nes_Vrc7.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
# quickerNES Core Configuration
|
# quickerNES Core Configuration
|
||||||
|
|
||||||
quickerNESCoreCPPFlags = [ '-Wfatal-errors','-Wall' ]
|
quickerNESCoreCPPFlags = [ '-Wfatal-errors','-Wall' ]
|
||||||
quickerNESCoreIncludeDirs = include_directories(['core', 'extern/metrohash128', 'extern/argparse', 'extern/phmap'])
|
quickerNESCoreIncludeDirs = include_directories(['source/core', 'extern'])
|
||||||
quickerNESCoreDependencies = [ ]
|
quickerNESCoreDependencies = [ ]
|
||||||
quickerNESCoreCPPFlags = [ ]
|
quickerNESCoreCPPFlags = [ ]
|
||||||
quickerNESCoreCFlags = [ ]
|
quickerNESCoreCFlags = [ ]
|
||||||
|
@ -50,21 +50,21 @@ quickerNESCoreLinkArgs = [ ]
|
||||||
# Building playback/validation tool
|
# Building playback/validation tool
|
||||||
|
|
||||||
quickerNESPlayerSrc = [
|
quickerNESPlayerSrc = [
|
||||||
'player/hqn/hqn.cpp',
|
'extern/hqn/hqn.cpp',
|
||||||
'player/hqn/hqn_gui_controller.cpp',
|
'extern/hqn/hqn_gui_controller.cpp',
|
||||||
'player/hqn/hqn_surface.cpp',
|
'extern/hqn/hqn_surface.cpp',
|
||||||
'player/hqn/hqn_util.cpp',
|
'extern/hqn/hqn_util.cpp',
|
||||||
'player/hqn/options.cpp'
|
'extern/hqn/options.cpp'
|
||||||
]
|
]
|
||||||
|
|
||||||
quickerNESPlayerIncludeDirs = include_directories([ 'player'])
|
quickerNESPlayerIncludeDirs = include_directories([ 'source'])
|
||||||
quickerNESPlayerDependencies = [ dependency('sdl2'), dependency('SDL2_image') ]
|
quickerNESPlayerDependencies = [ dependency('sdl2'), dependency('SDL2_image') ]
|
||||||
quickerNESPlayerCPPFlags = [ ]
|
quickerNESPlayerCPPFlags = [ ]
|
||||||
quickerNESPlayerCFlags = [ ]
|
quickerNESPlayerCFlags = [ ]
|
||||||
quickerNESPlayerLinkArgs = [ '-lncurses' ]
|
quickerNESPlayerLinkArgs = [ '-lncurses' ]
|
||||||
|
|
||||||
executable('player',
|
executable('player',
|
||||||
'player/player.cpp',
|
'source/player.cpp',
|
||||||
sources: [ quickerNESCoreSrc, quickerNESPlayerSrc ],
|
sources: [ quickerNESCoreSrc, quickerNESPlayerSrc ],
|
||||||
include_directories: [ quickerNESCoreIncludeDirs, quickerNESPlayerIncludeDirs ],
|
include_directories: [ quickerNESCoreIncludeDirs, quickerNESPlayerIncludeDirs ],
|
||||||
dependencies: [ quickerNESCoreDependencies, quickerNESPlayerDependencies ],
|
dependencies: [ quickerNESCoreDependencies, quickerNESPlayerDependencies ],
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Nes_Emu.h>
|
#include <core/Nes_Emu.h>
|
||||||
#include <Nes_State.h>
|
#include <core/Nes_State.h>
|
||||||
#include <utils.hpp>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utils.hpp>
|
#include <utils.hpp>
|
||||||
|
|
||||||
|
@ -15,6 +14,11 @@ class EmuInstance
|
||||||
|
|
||||||
typedef uint8_t inputType;
|
typedef uint8_t inputType;
|
||||||
|
|
||||||
|
// Deleting default constructors
|
||||||
|
EmuInstance() = delete;
|
||||||
|
EmuInstance(EmuInstance& e) = delete;
|
||||||
|
~EmuInstance() = default;
|
||||||
|
|
||||||
EmuInstance(const std::string& romFilePath, const std::string& stateFilePath)
|
EmuInstance(const std::string& romFilePath, const std::string& stateFilePath)
|
||||||
{
|
{
|
||||||
// Creating new emulator
|
// Creating new emulator
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <utils.hpp>
|
#include <utils.hpp>
|
||||||
#include <hqn/hqn.h>
|
#include <hqn/hqn.h>
|
||||||
#include <hqn/hqn_gui_controller.h>
|
#include <hqn/hqn_gui_controller.h>
|
||||||
#include "core/emuInstance.hpp"
|
#include "emuInstance.hpp"
|
||||||
|
|
||||||
#define _INVERSE_FRAME_RATE 16667
|
#define _INVERSE_FRAME_RATE 16667
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class PlaybackInstance
|
||||||
|
|
||||||
// Overlay info
|
// Overlay info
|
||||||
std::string _overlayPath;
|
std::string _overlayPath;
|
||||||
SDL_Surface* _overlayBaseSurface;
|
SDL_Surface* _overlayBaseSurface = NULL;
|
||||||
SDL_Surface* _overlayButtonASurface;
|
SDL_Surface* _overlayButtonASurface;
|
||||||
SDL_Surface* _overlayButtonBSurface;
|
SDL_Surface* _overlayButtonBSurface;
|
||||||
SDL_Surface* _overlayButtonSelectSurface;
|
SDL_Surface* _overlayButtonSelectSurface;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "argparse.hpp"
|
#include "argparse/argparse.hpp"
|
||||||
#include "utils.hpp"
|
#include "utils.hpp"
|
||||||
#include "core/emuInstance.hpp"
|
#include "emuInstance.hpp"
|
||||||
|
#include "playbackInstance.hpp"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -18,7 +19,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
program.add_argument("stateFile")
|
program.add_argument("stateFile")
|
||||||
.help("(Optional) Path to the initial state file to load.")
|
.help("(Optional) Path to the initial state file to load.")
|
||||||
.default_value("");
|
.default_value(std::string(""));
|
||||||
|
|
||||||
program.add_argument("--reproduce")
|
program.add_argument("--reproduce")
|
||||||
.help("Plays the entire sequence without interruptions and exit at the end.")
|
.help("Plays the entire sequence without interruptions and exit at the end.")
|
||||||
|
@ -38,15 +39,28 @@ int main(int argc, char *argv[])
|
||||||
std::string romFilePath = program.get<std::string>("romFile");
|
std::string romFilePath = program.get<std::string>("romFile");
|
||||||
|
|
||||||
// Getting sequence file path
|
// Getting sequence file path
|
||||||
std::string sequenceFile = program.get<std::string>("sequenceFile");
|
std::string sequenceFilePath = program.get<std::string>("sequenceFile");
|
||||||
|
|
||||||
// If initial state file is specified, load it
|
// If initial state file is specified, load it
|
||||||
std::string sequenceFile = program.get<std::string>("stateFile");
|
std::string stateFilePath = program.get<std::string>("stateFile");
|
||||||
|
|
||||||
// Getting reproduce flag
|
// Getting reproduce flag
|
||||||
bool isReproduce = program.get<bool>("--reproduce");
|
bool isReproduce = program.get<bool>("--reproduce");
|
||||||
|
|
||||||
// Getting reproduce flag
|
// Getting reproduce flag
|
||||||
bool disableRender = program.get<bool>("--disableRender");
|
bool disableRender = program.get<bool>("--disableRender");
|
||||||
|
|
||||||
|
// Printing provided parameters
|
||||||
|
printf("Rom File Path: %s\n", romFilePath.c_str());
|
||||||
|
printf("Sequence File Path: %s\n", sequenceFilePath.c_str());
|
||||||
|
printf("State File Path: %s\n", stateFilePath.c_str());
|
||||||
|
|
||||||
|
// Creating emulator instance
|
||||||
|
auto e = EmuInstance(romFilePath, stateFilePath);
|
||||||
|
|
||||||
|
// Creating playback instance
|
||||||
|
auto p = PlaybackInstance(&e);
|
||||||
|
|
||||||
|
while(true) p.renderFrame(0, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue