kill QT port

This commit is contained in:
zeromus 2016-08-10 20:58:38 -05:00
parent ac500c8249
commit 6489452867
45 changed files with 7 additions and 3043 deletions

View File

@ -576,7 +576,7 @@ void DrawHUD()
drawPad(Hud.GraphicalInputDisplay.x, Hud.GraphicalInputDisplay.y, 2.5);
}
#if defined(WIN32) && !defined(DESMUME_QT)
#if defined(WIN32)
if (CommonSettings.hud.ShowMicrophone)
{
osd->addFixed(Hud.Microphone.x, Hud.Microphone.y, "%03d [%07d]",MicDisplay, Hud.cpuloopIterationCount);

View File

@ -24,7 +24,7 @@
#include <assert.h>
//for pcsx2 method
#if defined(_MSC_VER) || defined(HAVE_LIBSOUNDTOUCH) || defined(DESMUME_COCOA) || defined(DESMUME_QT)
#if defined(_MSC_VER) || defined(HAVE_LIBSOUNDTOUCH) || defined(DESMUME_COCOA)
#include "SndOut.h"
#endif
@ -465,7 +465,7 @@ private:
}; //NitsujaSynchronizer
#if defined(_MSC_VER) || defined(HAVE_LIBSOUNDTOUCH) || defined(DESMUME_COCOA) || defined(DESMUME_QT)
#if defined(_MSC_VER) || defined(HAVE_LIBSOUNDTOUCH) || defined(DESMUME_COCOA)
class PCSX2Synchronizer : public ISynchronizingAudioBuffer
{
public:
@ -512,7 +512,7 @@ ISynchronizingAudioBuffer* metaspu_construct(ESynchMethod method)
{
case ESynchMethod_N: return new NitsujaSynchronizer();
case ESynchMethod_Z: return new ZeromusSynchronizer();
#if defined(_MSC_VER) || defined(HAVE_LIBSOUNDTOUCH) || defined(DESMUME_COCOA) || defined(DESMUME_QT)
#if defined(_MSC_VER) || defined(HAVE_LIBSOUNDTOUCH) || defined(DESMUME_COCOA)
case ESynchMethod_P: return new PCSX2Synchronizer();
#endif
default: return NULL;

View File

@ -18,7 +18,7 @@
* Boston, MA 02111-1307, USA.
*/
#if !defined(WIN32) || defined(DESMUME_QT)
#if !defined(WIN32)
#include <stdlib.h>
#include "mic.h"

View File

@ -957,7 +957,7 @@ bool mov_loadstate(EMUFILE* fp, int size)
if(tempMovieData.guid != currMovieData.guid)
{
//mbg 8/18/08 - this code can be used to turn the error message into an OK/CANCEL
#if defined(WIN32) && !defined(DESMUME_QT)
#if defined(WIN32)
std::string msg = "There is a mismatch between savestate's movie and current movie.\ncurrent: " + currMovieData.guid.toString() + "\nsavestate: " + tempMovieData.guid.toString() + "\n\nThis means that you have loaded a savestate belonging to a different movie than the one you are playing now.\n\nContinue loading this savestate anyway?";
int result = MessageBox(MainWindow->getHWnd(),msg.c_str(),"Error loading savestate",MB_OKCANCEL);
if(result == IDCANCEL)

View File

@ -23,10 +23,8 @@
#include <windows.h>
#include <direct.h>
#ifndef DESMUME_QT
#include "windows/winutil.h"
#include "windows/resource.h"
#endif
#elif !defined(DESMUME_COCOA)
#include <glib.h>
#endif /* HOST_WINDOWS */
@ -143,13 +141,11 @@ public:
while (p >= pathToModule && *p != DIRECTORY_DELIMITER_CHAR) p--;
if (++p >= pathToModule) *p = 0;
#ifndef DESMUME_QT
extern char* _hack_alternateModulePath;
if(_hack_alternateModulePath)
{
strcpy(pathToModule,_hack_alternateModulePath);
}
#endif
#elif defined(DESMUME_COCOA)
std::string pathStr = Path::GetFileDirectoryPath(path);

View File

@ -1,5 +0,0 @@
TEMPLATE = subdirs
SUBDIRS += \
core \
frontend

View File

@ -1,391 +0,0 @@
QT -= core gui
TEMPLATE = lib
CONFIG += staticlib
CONFIG -= app_bundle
CONFIG -= qt
TARGET = desmume
DEFINES += DESMUME_QT
win32 {
!win32-g++: DEFINES += NOMINMAX \
_CRT_SECURE_NO_DEPRECATE \
WIN32 \
HAVE_LIBZ
DEFINES -= UNICODE
INCLUDEPATH += $$PWD/../../../windows
SOURCES += \
../../../fs-windows.cpp \
../../../metaspu/SoundTouch/3dnow_win.cpp \
../../../metaspu/SoundTouch/cpu_detect_x86_win.cpp
# Windows glib
contains(QMAKE_TARGET.arch, x86_64) {
LIBS += -L$$PWD/../../../windows/.libs/ -lglib-vc8-x64
} else {
LIBS += -L$$PWD/../../../windows/.libs/ -lglib-vc8-Win32
}
LIBS += -lole32 -lshell32 -ladvapi32
INCLUDEPATH += $$PWD/../../../windows/glib-2.20.1/build/glib $$PWD/../../../windows/glib-2.20.1/build
DEPENDPATH += $$PWD/../../../windows/glib-2.20.1/build/glib
# Windows zlib
contains(QMAKE_TARGET.arch, x86_64) {
LIBS += -L$$PWD/../../../windows/zlib123/ -lzlib-vc8-x64
} else {
LIBS += -L$$PWD/../../../windows/zlib123/ -lzlib-vc8-Win32
}
INCLUDEPATH += $$PWD/../../../windows/zlib123
DEPENDPATH += $$PWD/../../../windows/zlib123
# Windows libagg
contains(QMAKE_TARGET.arch, x86_64) {
LIBS += -L$$PWD/../../../windows/agg/ -lagg-2.5-x64
} else {
LIBS += -L$$PWD/../../../windows/agg/ -lagg-2.5
}
INCLUDEPATH += $$PWD/../../../windows/agg/include
DEPENDPATH += $$PWD/../../../windows/agg/include
svnrev.target = userconfig/svnrev.h
svnrev.commands = cd $$PWD & svnrev.cmd
QMAKE_EXTRA_TARGETS += svnrev
PRE_TARGETDEPS += userconfig/svnrev.h
} else:unix:!macx {
DESMUME_ARCH = $$QMAKE_HOST.arch
linux-*-64: DESMUME_ARCH = x86_64
linux-*-32: DESMUME_ARCH = x86
DEFINES += \
HOST_LINUX=1 \
HAVE_LIBZ=1 \
HAVE_LIBAGG=1 \
HAVE_JIT=1 \
_GNU_SOURCE=1 \
_REENTRANT
SOURCES += \
../../../fs-linux.cpp \
../../../metaspu/SoundTouch/cpu_detect_x86_gcc.cpp
QMAKE_CXXFLAGS += -pthread
# Note: If you plan to distribute the binary, remove -march=native
QMAKE_CFLAGS_RELEASE += -Ofast -flto=4 -fuse-linker-plugin -funroll-loops -march=native -minline-all-stringops -ffast-math
QMAKE_CXXFLAGS_RELEASE += -Ofast -flto=4 -fuse-linker-plugin -funroll-loops -march=native -minline-all-stringops -ffast-math
QMAKE_LFLAGS_RELEASE += -Ofast -flto=4 -fuse-linker-plugin -funroll-loops -march=native -minline-all-stringops -ffast-math
contains(DESMUME_ARCH, x86_64) {
message("Build target decided as x86_64")
DEFINES += HOST_64=1
} else {
message("Build target decided as x86")
DEFINES += HOST_32=1
}
CONFIG += link_pkgconfig
PKGCONFIG += glib-2.0 libagg zlib
svnrev.target = userconfig/svnrev.h
svnrev.commands = cd $$PWD; sh svnrev.sh
QMAKE_EXTRA_TARGETS += svnrev
PRE_TARGETDEPS += userconfig/svnrev.h
} else:macx {
error("Mac OS X not supported")
}
INCLUDEPATH += userconfig/ defaultconfig/ ../../../../src
SOURCES += \
../../../armcpu.cpp \
../../../arm_instructions.cpp \
../../../agg2d.inl \
../../../bios.cpp \
../../../commandline.cpp \
../../../common.cpp \
../../../cp15.cpp \
../../../debug.cpp \
../../../Disassembler.cpp \
../../../emufile.cpp \
../../../encrypt.cpp \
../../../FIFO.cpp \
../../../firmware.cpp \
../../../GPU.cpp \
../../../GPU_osd.cpp \
../../../matrix.cpp \
../../../mc.cpp \
../../../MMU.cpp \
../../../NDSSystem.cpp \
../../../ROMReader.cpp \
../../../render3D.cpp \
../../../rtc.cpp \
../../../saves.cpp \
../../../slot1.cpp \
../../../slot2.cpp \
../../../SPU.cpp \
../../../gfx3d.cpp \
../../../thumb_instructions.cpp \
../../../movie.cpp \
../../../utils/advanscene.cpp \
../../../utils/datetime.cpp \
../../../utils/guid.cpp \
../../../utils/emufat.cpp \
../../../utils/fsnitro.cpp \
../../../utils/md5.cpp \
../../../utils/xstring.cpp \
../../../utils/vfat.cpp \
../../../utils/task.cpp \
../../../utils/dlditool.cpp \
../../../utils/ConvertUTF.c \
../../../utils/decrypt/crc.cpp \
../../../utils/decrypt/decrypt.cpp \
../../../utils/decrypt/header.cpp \
../../../utils/libfat/cache.cpp \
../../../utils/libfat/directory.cpp \
../../../utils/libfat/disc.cpp \
../../../utils/libfat/fatdir.cpp \
../../../utils/libfat/fatfile.cpp \
../../../utils/libfat/file_allocation_table.cpp \
../../../utils/libfat/filetime.cpp \
../../../utils/libfat/libfat_public_api.cpp \
../../../utils/libfat/libfat.cpp \
../../../utils/libfat/lock.cpp \
../../../utils/libfat/partition.cpp \
../../../utils/tinyxml/tinystr.cpp \
../../../utils/tinyxml/tinyxml.cpp \
../../../utils/tinyxml/tinyxmlerror.cpp \
../../../utils/tinyxml/tinyxmlparser.cpp \
../../../addons/slot1_none.cpp \
../../../addons/slot1_r4.cpp \
../../../addons/slot1_retail_auto.cpp \
../../../addons/slot1_retail_mcrom_debug.cpp \
../../../addons/slot1_retail_mcrom.cpp \
../../../addons/slot1_retail_nand.cpp \
../../../addons/slot1comp_mc.cpp \
../../../addons/slot1comp_protocol.cpp \
../../../addons/slot1comp_rom.cpp \
../../../addons/slot2_auto.cpp \
../../../addons/slot2_expMemory.cpp \
../../../addons/slot2_gbagame.cpp \
../../../addons/slot2_guitarGrip.cpp \
../../../addons/slot2_mpcf.cpp \
../../../addons/slot2_none.cpp \
../../../addons/slot2_paddle.cpp \
../../../addons/slot2_passme.cpp \
../../../addons/slot2_piano.cpp \
../../../addons/slot2_rumblepak.cpp \
../../../cheatSystem.cpp \
../../../texcache.cpp \
../../../rasterize.cpp \
../../../metaspu/metaspu.cpp \
../../../filter/2xsai.cpp \
../../../filter/bilinear.cpp \
../../../filter/epx.cpp \
../../../filter/hq2x.cpp \
../../../filter/hq3x.cpp \
../../../filter/hq4x.cpp \
../../../filter/lq2x.cpp \
../../../filter/scanline.cpp \
../../../filter/videofilter.cpp \
../../../filter/xbrz.cpp \
../../../version.cpp \
../../../utils/AsmJit/core/assembler.cpp \
../../../utils/AsmJit/core/assert.cpp \
../../../utils/AsmJit/core/buffer.cpp \
../../../utils/AsmJit/core/compiler.cpp \
../../../utils/AsmJit/core/compilercontext.cpp \
../../../utils/AsmJit/core/compilerfunc.cpp \
../../../utils/AsmJit/core/compileritem.cpp \
../../../utils/AsmJit/core/context.cpp \
../../../utils/AsmJit/core/cpuinfo.cpp \
../../../utils/AsmJit/core/defs.cpp \
../../../utils/AsmJit/core/func.cpp \
../../../utils/AsmJit/core/logger.cpp \
../../../utils/AsmJit/core/memorymanager.cpp \
../../../utils/AsmJit/core/memorymarker.cpp \
../../../utils/AsmJit/core/operand.cpp \
../../../utils/AsmJit/core/stringbuilder.cpp \
../../../utils/AsmJit/core/stringutil.cpp \
../../../utils/AsmJit/core/virtualmemory.cpp \
../../../utils/AsmJit/core/zonememory.cpp \
../../../utils/AsmJit/x86/x86assembler.cpp \
../../../utils/AsmJit/x86/x86compiler.cpp \
../../../utils/AsmJit/x86/x86compilercontext.cpp \
../../../utils/AsmJit/x86/x86compilerfunc.cpp \
../../../utils/AsmJit/x86/x86compileritem.cpp \
../../../utils/AsmJit/x86/x86cpuinfo.cpp \
../../../utils/AsmJit/x86/x86defs.cpp \
../../../utils/AsmJit/x86/x86func.cpp \
../../../utils/AsmJit/x86/x86operand.cpp \
../../../utils/AsmJit/x86/x86util.cpp \
../../../mic.cpp \
../../../aggdraw.cpp \
../../../wifi.cpp \
../../../arm_jit.cpp \
../../../readwrite.cpp \
../../../driver.cpp \
../../../path.cpp \
../../../OGLRender.cpp \
../../../metaspu/SoundTouch/AAFilter.cpp \
../../../metaspu/SoundTouch/FIFOSampleBuffer.cpp \
../../../metaspu/SoundTouch/FIRFilter.cpp \
../../../metaspu/SoundTouch/mmx_optimized.cpp \
../../../metaspu/SoundTouch/RateTransposer.cpp \
../../../metaspu/SoundTouch/SoundTouch.cpp \
../../../metaspu/SoundTouch/sse_optimized.cpp \
../../../metaspu/SoundTouch/TDStretch.cpp \
../../../metaspu/SoundTouch/WavFile.cpp \
../../../metaspu/SndOut.cpp \
../../../metaspu/Timestretcher.cpp
HEADERS += \
../../../armcpu.h \
../../../agg2d.h \
../../../bios.h \
../../../bits.h \
../../../commandline.h \
../../../common.h \
../../../cp15.h \
../../../debug.h \
../../../Disassembler.h \
../../../emufile.h \
../../../emufile_types.h \
../../../encrypt.h \
../../../FIFO.h \
../../../firmware.h \
../../../fs.h \
../../../GPU.h \
../../../GPU_osd.h \
../../../instructions.h \
../../../matrix.h \
../../../mem.h \
../../../mc.h \
../../../mic.h \
../../../MMU_timing.h \
../../../MMU.h \
../../../NDSSystem.h \
../../../OGLRender.h \
../../../ROMReader.h \
../../../render3D.h \
../../../rtc.h \
../../../saves.h \
../../../slot1.h \
../../../slot2.h \
../../../SPU.h \
../../../gfx3d.h \
../../../types.h \
../../../shaders.h \
../../../movie.h \
../../../PACKED.h \
../../../PACKED_END.h \
../../../utils/advanscene.h \
../../../utils/datetime.h \
../../../utils/ConvertUTF.h \
../../../utils/guid.h \
../../../utils/emufat.h \
../../../utils/emufat_types.h \
../../../utils/fsnitro.h \
../../../utils/md5.h \
../../../utils/valuearray.h \
../../../utils/xstring.h \
../../../utils/vfat.h \
../../../utils/task.h \
../../../utils/decrypt/crc.h \
../../../utils/decrypt/decrypt.h \
../../../utils/decrypt/header.h \
../../../utils/libfat/bit_ops.h \
../../../utils/libfat/cache.h \
../../../utils/libfat/common.h \
../../../utils/libfat/directory.h \
../../../utils/libfat/disc_io.h \
../../../utils/libfat/disc.h \
../../../utils/libfat/fat.h \
../../../utils/libfat/fatdir.h \
../../../utils/libfat/fatfile.h \
../../../utils/libfat/file_allocation_table.h \
../../../utils/libfat/filetime.h \
../../../utils/libfat/libfat_pc.h \
../../../utils/libfat/libfat_public_api.h \
../../../utils/libfat/lock.h \
../../../utils/libfat/mem_allocate.h \
../../../utils/libfat/partition.h \
../../../utils/tinyxml/tinystr.h \
../../../utils/tinyxml/tinyxml.h \
../../../addons/slot1comp_mc.h \
../../../addons/slot1comp_protocol.h \
../../../addons/slot1comp_rom.h \
../../../cheatSystem.h \
../../../texcache.h \
../../../rasterize.h \
../../../metaspu/metaspu.h \
../../../filter/filter.h \
../../../filter/hq2x.h \
../../../filter/interp.h \
../../../filter/lq2x.h \
../../../filter/videofilter.h \
../../../filter/xbrz.h \
../../../version.h \
../../../utils/AsmJit/AsmJit.h \
../../../utils/AsmJit/Config.h \
../../../utils/AsmJit/core.h \
../../../utils/AsmJit/x86.h \
../../../utils/AsmJit/core/apibegin.h \
../../../utils/AsmJit/core/apiend.h \
../../../utils/AsmJit/core/assembler.h \
../../../utils/AsmJit/core/assert.h \
../../../utils/AsmJit/core/buffer.h \
../../../utils/AsmJit/core/build.h \
../../../utils/AsmJit/core/compiler.h \
../../../utils/AsmJit/core/compilercontext.h \
../../../utils/AsmJit/core/compilerfunc.h \
../../../utils/AsmJit/core/compileritem.h \
../../../utils/AsmJit/core/context.h \
../../../utils/AsmJit/core/cpuinfo.h \
../../../utils/AsmJit/core/defs.h \
../../../utils/AsmJit/core/func.h \
../../../utils/AsmJit/core/intutil.h \
../../../utils/AsmJit/core/lock.h \
../../../utils/AsmJit/core/logger.h \
../../../utils/AsmJit/core/memorymanager.h \
../../../utils/AsmJit/core/memorymarker.h \
../../../utils/AsmJit/core/operand.h \
../../../utils/AsmJit/core/podvector.h \
../../../utils/AsmJit/core/stringbuilder.h \
../../../utils/AsmJit/core/stringutil.h \
../../../utils/AsmJit/core/virtualmemory.h \
../../../utils/AsmJit/core/zonememory.h \
../../../utils/AsmJit/x86/x86assembler.h \
../../../utils/AsmJit/x86/x86compiler.h \
../../../utils/AsmJit/x86/x86compilercontext.h \
../../../utils/AsmJit/x86/x86compilerfunc.h \
../../../utils/AsmJit/x86/x86compileritem.h \
../../../utils/AsmJit/x86/x86cpuinfo.h \
../../../utils/AsmJit/x86/x86defs.h \
../../../utils/AsmJit/x86/x86func.h \
../../../utils/AsmJit/x86/x86operand.h \
../../../utils/AsmJit/x86/x86util.h \
../../../aggdraw.h \
../../../wifi.h \
../../../arm_jit.h \
../../../instruction_attributes.h \
../../../readwrite.h \
../../../driver.h \
../../../path.h \
../../../metaspu/SoundTouch/AAFilter.h \
../../../metaspu/SoundTouch/BPMDetect.h \
../../../metaspu/SoundTouch/cpu_detect.h \
../../../metaspu/SoundTouch/FIFOSampleBuffer.h \
../../../metaspu/SoundTouch/FIFOSamplePipe.h \
../../../metaspu/SoundTouch/FIRFilter.h \
../../../metaspu/SoundTouch/RateTransposer.h \
../../../metaspu/SoundTouch/SoundTouch.h \
../../../metaspu/SoundTouch/STTypes.h \
../../../metaspu/SoundTouch/TDStretch.h \
../../../metaspu/SoundTouch/WavFile.h \
../../../metaspu/SndOut.h \
defaultconfig/svnrev.h

View File

@ -1,7 +0,0 @@
// REVISION TRACKING
// userconfig/svnrev.h should be auto-generated and used,
// but this one is here just to prevent build errors.
#define SVN_REV 0
#define SVN_REV_STR "0"

View File

@ -1,7 +0,0 @@
// REVISION TRACKING
// This file is auto-generated.
// Do not commit this file to the code repository!
#define SVN_REV $WCREV$
#define SVN_REV_STR "$WCREV$"

View File

@ -1,19 +0,0 @@
@echo off
rem Copyright (C) 2013-2014 DeSmuME team
rem
rem This file is free software: you can redistribute it and/or modify
rem it under the terms of the GNU General Public License as published by
rem the Free Software Foundation, either version 2 of the License, or
rem (at your option) any later version.
rem
rem This file is distributed in the hope that it will be useful
rem but WITHOUT ANY WARRANTY; without even the implied warranty of
rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
rem GNU General Public License for more details.
rem
rem You should have received a copy of the GNU General Public License
rem along with the this software. If not, see <http://www.gnu.org/licenses/>.
echo Generating svnrev.h...
..\..\..\windows\defaultconfig\SubWCRev.exe ..\..\..\.. ".\defaultconfig\svnrev_template.h" ".\userconfig\svnrev.h"
exit 0

View File

@ -1,46 +0,0 @@
#!/bin/sh
# Copyright (C) 2013-2014 DeSmuME team
#
# This file is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the this software. If not, see <http://www.gnu.org/licenses/>.
echo "Obtaining svn revision..."
if which svnversion > /dev/null; then
WC_PATH=""
if [ -d "../../../../.svn" ]; then
WC_PATH="../../../../"
elif [ -d "../../../../../.svn" ]; then
WC_PATH="../../../../../"
fi
REV=$(svnversion -n $WC_PATH | sed -e 's/[[:alpha:]]//g' -e 's/^[[:digit:]]*://')
fi
if [ "$REV" = "" ]; then
echo "Cannot obtain svn revision."
REV="0"
else
echo "Obtained svn revision is $REV."
fi
sed 's/\$WCREV\$/'$REV'/' defaultconfig/svnrev_template.h > userconfig/svnrev_gen.h
if which diff > /dev/null && diff -q userconfig/svnrev_gen.h userconfig/svnrev.h > /dev/null 2>&1; then
# Hopefully don't trigger a rebuild
echo "Generated svnrev.h is the same as the existing one. Keeping original."
rm userconfig/svnrev_gen.h
else
echo "Updating svnrev.h..."
rm userconfig/svnrev.h
mv userconfig/svnrev_gen.h userconfig/svnrev.h
fi

View File

@ -1 +0,0 @@
This directory places the autogenerated svnrev.h

View File

@ -1,151 +0,0 @@
/*
Copyright (C) 2014-2015 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ds.h"
#include "NDSSystem.h"
#include "firmware.h"
#include "mc.h"
#include "render3D.h"
#include "rasterize.h"
#include "SPU.h"
#include "slot2.h"
#include "GPU_osd.h"
#include "commandline.h"
//#include "filter/videofilter.h"
#include "video.h"
#include "sndqt.h"
// TODO: Handle pausing correctly
volatile bool execute = false;
// TODO: Create a subclass of BaseDriver for Qt frontend
GPU3DInterface *core3DList[] = {
&gpu3DNull,
&gpu3DRasterize,
#if 0
&gpu3Dgl,
#endif
NULL
};
SoundInterface_struct *SNDCoreList[] = {
&SNDDummy,
&SNDQt,
NULL
};
namespace desmume {
namespace qt {
namespace ds {
Video *video;
Input input;
namespace {
bool romLoaded = false;
bool unpaused = true;
} /* namespace */
void init() {
video = new Video(4);
//video_buffer = video->GetDstBufferPtr();
/*video->SetFilterParameteri(VF_PARAM_SCANLINE_A, _scanline_filter_a);
video->SetFilterParameteri(VF_PARAM_SCANLINE_B, _scanline_filter_b);
video->SetFilterParameteri(VF_PARAM_SCANLINE_C, _scanline_filter_c);
video->SetFilterParameteri(VF_PARAM_SCANLINE_D, _scanline_filter_d);*/
::CommonSettings.use_jit = true;
::CommonSettings.jit_max_block_size = 100;
struct ::NDS_fw_config_data fw_config;
::NDS_FillDefaultFirmwareConfigData(&fw_config);
::slot2_Init();
::slot2_Change(NDS_SLOT2_AUTO);
::NDS_Init();
::SPU_ChangeSoundCore(SNDCORE_QT, 1024 * 4);
::SPU_SetSynchMode(1, 0); // Sync N
//::SPU_SetSynchMode(1, 2); // Sync P
::Desmume_InitOnce();
//Hud.reset();
::NDS_CreateDummyFirmware(&fw_config);
::backup_setManualBackupType(0);
::NDS_3D_ChangeCore(1);
}
void deinit() {
romLoaded = false;
unpaused = false;
::NDS_DeInit();
}
bool loadROM(const char* path) {
bool shouldUnpause = unpaused;
pause();
if (::NDS_LoadROM(path) < 0) {
return false;
} else {
romLoaded = true;
if (shouldUnpause) {
unpause();
}
return true;
}
}
bool isRunning() {
return romLoaded && unpaused;
}
void pause() {
unpaused = false;
::execute = false;
::SPU_Pause(1);
}
void unpause() {
unpaused = true;
if (romLoaded) {
::execute = true;
::SPU_Pause(0);
}
}
void execFrame() {
if (romLoaded && unpaused) {
::NDS_exec<false>();
::SPU_Emulate_user();
}
}
} /* namespace ds */
} /* namespace qt */
} /* namespace desmume */

View File

@ -1,44 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DESMUME_QT_DS_H
#define DESMUME_QT_DS_H
#include "video.h"
#include "ds_input.h"
namespace desmume {
namespace qt {
namespace ds {
extern Video *video;
extern Input input;
void init();
void deinit();
bool loadROM(const char* path);
bool isRunning();
void pause();
void unpause();
void execFrame();
} /* namespace ds */
} /* namespace qt */
} /* namespace desmume */
#endif /* DESMUME_QT_DS_H */

View File

@ -1,83 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ds.h"
#include "ds_input.h"
#include "NDSSystem.h"
namespace desmume {
namespace qt {
namespace ds {
Input::Input() {
for (int i = 0; i < KEY_COUNT; i++) {
mKeyStates[i] = false;
}
}
void Input::updateDSInputRaw() {
::NDS_setPad(
mKeyStates[KEY_RIGHT],
mKeyStates[KEY_LEFT],
mKeyStates[KEY_DOWN],
mKeyStates[KEY_UP],
mKeyStates[KEY_SELECT],
mKeyStates[KEY_START],
mKeyStates[KEY_B],
mKeyStates[KEY_A],
mKeyStates[KEY_Y],
mKeyStates[KEY_X],
mKeyStates[KEY_L],
mKeyStates[KEY_R],
mKeyStates[KEY_DEBUG],
mKeyStates[KEY_LID]
);
//RunAntipodalRestriction(::NDS_getRawUserInput().buttons);
}
void Input::updateDSInputActual() {
::NDS_beginProcessingInput();
{
//UserButtons& input = NDS_getProcessingUserInput().buttons;
//ApplyAntipodalRestriction(input);
}
::NDS_endProcessingInput();
}
void Input::keyPress(KeysEnum key) {
mKeyStates[key] = true;
updateDSInputRaw();
}
void Input::keyRelease(KeysEnum key) {
mKeyStates[key] = false;
updateDSInputRaw();
}
void Input::touchMove(int x, int y) {
::NDS_setTouchPos(x, y);
}
void Input::touchUp() {
::NDS_releaseTouch();
}
} /* namespace ds */
} /* namespace qt */
} /* namespace desmume */

View File

@ -1,60 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DESMUME_QT_DS_INPUT_H
#define DESMUME_QT_DS_INPUT_H
namespace desmume {
namespace qt {
namespace ds {
enum KeysEnum {
KEY_A = 0,
KEY_B,
KEY_SELECT,
KEY_START,
KEY_RIGHT,
KEY_LEFT,
KEY_UP,
KEY_DOWN,
KEY_R,
KEY_L,
KEY_X,
KEY_Y,
KEY_DEBUG,
KEY_LID,
KEY_COUNT
};
class Input {
bool mKeyStates[KEY_COUNT];
public:
Input();
void updateDSInputRaw();
void updateDSInputActual();
void keyPress(KeysEnum key);
void keyRelease(KeysEnum key);
void touchMove(int x, int y);
void touchUp();
};
} /* namespace ds */
} /* namespace qt */
} /* namespace desmume */
#endif /* DESMUME_QT_DS_INPUT_H */

View File

@ -1,114 +0,0 @@
#-------------------------------------------------
#
# Project created by QtCreator 2014-03-08T21:04:19
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
QT += multimedia
TARGET = desmume-qt
TEMPLATE = app
DEFINES += DESMUME_QT
win32 {
!win32-g++: DEFINES += NOMINMAX \
_CRT_SECURE_NO_DEPRECATE \
WIN32 \
HAVE_LIBZ
DEFINES -= UNICODE
RC_ICONS = resources/DeSmuME.ico
# Windows glib
contains(QMAKE_TARGET.arch, x86_64) {
LIBS += -L$$PWD/../../../windows/.libs/ -lglib-vc8-x64
} else {
LIBS += -L$$PWD/../../../windows/.libs/ -lglib-vc8-Win32
}
LIBS += -lole32 -lshell32 -ladvapi32
INCLUDEPATH += $$PWD/../../../windows/glib-2.20.1/build/glib $$PWD/../../../windows/glib-2.20.1/build
DEPENDPATH += $$PWD/../../../windows/glib-2.20.1/build/glib
# Windows zlib
contains(QMAKE_TARGET.arch, x86_64) {
LIBS += -L$$PWD/../../../windows/zlib123/ -lzlib-vc8-x64
} else {
LIBS += -L$$PWD/../../../windows/zlib123/ -lzlib-vc8-Win32
}
INCLUDEPATH += $$PWD/../../../windows/zlib123
DEPENDPATH += $$PWD/../../../windows/zlib123
# Windows libagg
contains(QMAKE_TARGET.arch, x86_64) {
LIBS += -L$$PWD/../../../windows/agg/ -lagg-2.5-x64
} else {
LIBS += -L$$PWD/../../../windows/agg/ -lagg-2.5
}
INCLUDEPATH += $$PWD/../../../windows/agg/include
DEPENDPATH += $$PWD/../../../windows/agg/include
} else:unix:!macx {
DESMUME_ARCH = $$QMAKE_HOST.arch
linux-*-64: DESMUME_ARCH = x86_64
linux-*-32: DESMUME_ARCH = x86
# Note: If you plan to distribute the binary, remove -march=native
QMAKE_CFLAGS_RELEASE += -Ofast -flto=4 -fuse-linker-plugin -funroll-loops -march=native -minline-all-stringops -ffast-math
QMAKE_CXXFLAGS_RELEASE += -Ofast -flto=4 -fuse-linker-plugin -funroll-loops -march=native -minline-all-stringops -ffast-math
QMAKE_LFLAGS_RELEASE += -Ofast -flto=4 -fuse-linker-plugin -funroll-loops -march=native -minline-all-stringops -ffast-math
} else:macx {
error("Mac OS X not supported")
}
INCLUDEPATH += ./
SOURCES += main.cpp\
ui/mainwindow.cpp \
ui/screenwidget.cpp \
mainloop.cpp \
sndqt.cpp \
ds.cpp \
video.cpp \
ui/controlconfigdialog.cpp \
ui/controlitemconfigdialog.cpp \
ds_input.cpp \
keyboardinput.cpp
HEADERS += ui/mainwindow.h \
ui/screenwidget.h \
mainloop.h \
sndqt.h \
ds.h \
video.h \
ui/controlconfigdialog.h \
ui/controlitemconfigdialog.h \
keyboardinput.h \
ds_input.h
RESOURCES += \
resources/resources.qrc
FORMS += ui/mainwindow.ui \
ui/controlconfigdialog.ui \
ui/controlitemconfigdialog.ui
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../core/release/ -ldesmume
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../core/debug/ -ldesmume
else:unix: LIBS += -L$$OUT_PWD/../core/ -ldesmume
INCLUDEPATH += $$PWD/../../..
DEPENDPATH += $$PWD/../../..
win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../core/release/libdesmume.a
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../core/debug/libdesmume.a
else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../core/release/desmume.lib
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../core/debug/desmume.lib
else:unix: PRE_TARGETDEPS += $$OUT_PWD/../core/libdesmume.a
unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += glib-2.0 libagg zlib

View File

@ -1,131 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ds.h"
#include "keyboardinput.h"
#include <cstring>
#include <Qt>
#include <QKeySequence>
namespace desmume {
namespace qt {
KeyboardInput keyboard;
KeyboardInput::KeyboardInput() {
mKeyAssignment[ds::KEY_A] = Qt::Key_X;
mKeyAssignment[ds::KEY_B] = Qt::Key_Z;
mKeyAssignment[ds::KEY_SELECT] = Qt::Key_Shift;
mKeyAssignment[ds::KEY_START] = Qt::Key_Enter;
mKeyAssignment[ds::KEY_RIGHT] = Qt::Key_Right;
mKeyAssignment[ds::KEY_LEFT] = Qt::Key_Left;
mKeyAssignment[ds::KEY_UP] = Qt::Key_Up;
mKeyAssignment[ds::KEY_DOWN] = Qt::Key_Down;
mKeyAssignment[ds::KEY_R] = Qt::Key_W;
mKeyAssignment[ds::KEY_L] = Qt::Key_Q;
mKeyAssignment[ds::KEY_X] = Qt::Key_S;
mKeyAssignment[ds::KEY_Y] = Qt::Key_A;
mKeyAssignment[ds::KEY_DEBUG] = 0;
mKeyAssignment[ds::KEY_LID] = Qt::Key_Backspace;
}
int KeyboardInput::getAssignedKey(ds::KeysEnum key) const {
if (key >= 0 && key < ds::KEY_COUNT) {
return mKeyAssignment[key];
} else {
return 0;
}
}
bool KeyboardInput::isKeyAssigned(int keyboardKey) const {
for (int i = 0; i < ds::KEY_COUNT; i++) {
if (mKeyAssignment[i] == keyboardKey) {
return true;
}
}
return false;
}
void KeyboardInput::setAssignedKey(ds::KeysEnum key, int keyboardKey) {
if (key >= 0 && key < ds::KEY_COUNT) {
mKeyAssignment[key] = keyboardKey;
}
}
bool KeyboardInput::keyPress(int keyboardKey) {
for (int i = 0; i < ds::KEY_COUNT; i++) {
if (mKeyAssignment[i] == keyboardKey) {
ds::input.keyPress((ds::KeysEnum)i);
return true;
}
}
return false;
}
bool KeyboardInput::keyRelease(int keyboardKey) {
for (int i = 0; i < ds::KEY_COUNT; i++) {
if (mKeyAssignment[i] == keyboardKey) {
ds::input.keyRelease((ds::KeysEnum)i);
return true;
}
}
return false;
}
void KeyboardInput::from(const KeyboardInput& other){
::memcpy(mKeyAssignment, other.mKeyAssignment, ds::KEY_COUNT * sizeof(mKeyAssignment[0]));
}
QString KeyboardInput::getKeyDisplayText(int key) {
Qt::Key k = (Qt::Key)key;
QString str;
switch (k) {
case Qt::Key_Shift:
str = QKeySequence(Qt::ShiftModifier).toString();
if (str.endsWith('+')) {
str.chop(1);
}
break;
case Qt::Key_Control:
str = QKeySequence(Qt::ControlModifier).toString();
if (str.endsWith('+')) {
str.chop(1);
}
break;
case Qt::Key_Meta:
str = QKeySequence(Qt::MetaModifier).toString();
if (str.endsWith('+')) {
str.chop(1);
}
break;
case Qt::Key_Alt:
str = QKeySequence(Qt::AltModifier).toString();
if (str.endsWith('+')) {
str.chop(1);
}
break;
default:
str = QKeySequence(k).toString();
}
return str;
}
} /* namespace qt */
} /* namespace desmume */

View File

@ -1,47 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DESMUME_QT_KEYBOARDINPUT_H
#define DESMUME_QT_KEYBOARDINPUT_H
#include "ds_input.h"
#include <QString>
namespace desmume {
namespace qt {
class KeyboardInput {
int mKeyAssignment[ds::KEY_COUNT];
public:
KeyboardInput();
int getAssignedKey(ds::KeysEnum key) const;
bool isKeyAssigned(int keyboardKey) const;
void setAssignedKey(ds::KeysEnum key, int keyboardKey);
bool keyPress(int keyboardKey);
bool keyRelease(int keyboardKey);
void from(const KeyboardInput& other);
static QString getKeyDisplayText(int key);
};
extern KeyboardInput keyboard;
} /* namespace qt */
} /* namespace desmume */
#endif /* DESMUME_QT_KEYBOARDINPUT_H */

View File

@ -1,47 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mainloop.h"
#include "ds.h"
#include "ui/mainwindow.h"
#include <QApplication>
#include <QTimer>
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
QIcon icon;
icon.addFile(QStringLiteral(":/images/DeSmuME-icon-16"));
icon.addFile(QStringLiteral(":/images/DeSmuME-icon-32"));
icon.addFile(QStringLiteral(":/images/DeSmuME-icon"));
a.setWindowIcon(icon);
desmume::qt::MainWindow w;
w.show();
desmume::qt::ds::init();
desmume::qt::MainLoop mainLoop;
mainLoop.kickStart();
QObject::connect(desmume::qt::ds::video, &desmume::qt::Video::screenBufferUpdated, &w, &desmume::qt::MainWindow::screenBufferUpdate);
QObject::connect(&mainLoop, &desmume::qt::MainLoop::screenRedrawRequested, &w, &desmume::qt::MainWindow::screenRedraw);
QObject::connect(&mainLoop, &desmume::qt::MainLoop::fpsUpdated, &w, &desmume::qt::MainWindow::fpsUpdate);
return a.exec();
}

View File

@ -1,131 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ds.h"
#include "mainloop.h"
#include <QBasicTimer>
#include <QElapsedTimer>
#include <QDebug>
namespace desmume {
namespace qt {
MainLoop::MainLoop(QObject *parent)
: QObject(parent)
, mBasicTimer(new QBasicTimer)
, mTime(new QElapsedTimer)
, mLoopInitialized(false)
, mFrameMod3(0)
, mNextFrameTimeNs(0)
, mFpsCounter(0)
, mFps(0)
, mNextFpsCountTime(0)
{
}
void MainLoop::kickStart() {
mBasicTimer->start(100, this);
}
int MainLoop::fps() {
return mFps;
}
void MainLoop::timerEvent(QTimerEvent* event) {
loop();
}
void MainLoop::loop() {
if (mLoopInitialized) {
// I wanted to put some code here but...
} else {
mLoopInitialized = true;
mTime->start();
mNextFrameTimeNs = 0;
mFrameMod3 = 0;
mFpsCounter = 0;
mFps = 0;
mNextFpsCountTime = 1000;
}
// ---- Time keeping ----
// TODO: Add frameskip option
mFrameMod3 = (mFrameMod3 + 1) % 3;
int timerInterval = 16;
// Adjust the time drift
qint64 timeDriftNs = mTime->nsecsElapsed() - mNextFrameTimeNs;
if (timeDriftNs > 0) {
//qDebug("Drift! %lld", timeDriftNs);
if (timeDriftNs < (10 * 1000 * 1000)) {
// If the drift is tolerable, try to catch up the next frame
// It's fine if the drift is less than 1ms
// Hopefully the compiler will generate mul + shr
timerInterval -= timeDriftNs / (1000 * 1000);
} else {
// Otherwise don't, delay the next frame instead.
mNextFrameTimeNs += timeDriftNs;
}
} else {
while (mTime->nsecsElapsed() < mNextFrameTimeNs);
}
// Schedule next frame
if (/* fpsLimiterEnabled */ true) {
mBasicTimer->start(timerInterval, Qt::PreciseTimer, this);
const int frameIntervalNs = (mFrameMod3 == 0) ? 16666666 : 16666667;
mNextFrameTimeNs += frameIntervalNs;
} else {
mBasicTimer->start(0, this);
}
// Count the fps
countFps(mTime->elapsed());
//qDebug("Accumulative: %lld", mTime->elapsed());
// ---- Real action ----
// Redraw last frame
this->screenRedrawRequested(true);
// Update input and emulate!
ds::input.updateDSInputActual();
ds::execFrame();
// Run the video filter
ds::video->runFilter();
// Don't redraw yet...
//this->screenRedrawRequested(false);
}
void MainLoop::countFps(qint64 thisFrameTime) {
mFpsCounter += 1;
if (thisFrameTime >= mNextFpsCountTime) {
mNextFpsCountTime = thisFrameTime + 1000;
mFps = mFpsCounter;
mFpsCounter = 0;
this->fpsUpdated(mFps);
}
}
} /* namespace qt */
} /* namespace desmume */

View File

@ -1,60 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DESMUME_QT_MAINLOOP_H
#define DESMUME_QT_MAINLOOP_H
#include <QObject>
#include <QBasicTimer>
#include <QElapsedTimer>
#include <QSize>
namespace desmume {
namespace qt {
class MainLoop : public QObject {
Q_OBJECT
QBasicTimer* mBasicTimer;
QElapsedTimer* mTime;
bool mLoopInitialized;
int mFrameMod3;
qint64 mNextFrameTimeNs;
int mFpsCounter;
int mFps;
qint64 mNextFpsCountTime;
void loop();
void countFps(qint64 thisFrameTime);
protected:
void timerEvent(QTimerEvent* event);
public:
explicit MainLoop(QObject* parent = 0);
void kickStart();
int fps();
signals:
void screenRedrawRequested(bool immediate);
void fpsUpdated(int fps);
private slots:
};
} /* namespace qt */
} /* namespace desmume */
#endif /* DESMUME_QT_MAINLOOP_H */

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 B

View File

@ -1,9 +0,0 @@
<RCC>
<qresource prefix="/images">
<file alias="open">images/open.png</file>
<file alias="pause">images/pause.png</file>
<file alias="DeSmuME-icon">DeSmuME.png</file>
<file alias="DeSmuME-icon-16">DeSmuME-16.png</file>
<file alias="DeSmuME-icon-32">DeSmuME-32.png</file>
</qresource>
</RCC>

View File

@ -1,117 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "SPU.h"
#include "sndqt.h"
#include <QAudioOutput>
#include <QAudioFormat>
#include <QAudioDeviceInfo>
#include <QIODevice>
#include <QDebug>
int SNDQTInit(int buffersize);
void SNDQTDeInit();
void SNDQTUpdateAudio(s16 *buffer, u32 num_samples);
u32 SNDQTGetAudioSpace();
void SNDQTMuteAudio();
void SNDQTUnMuteAudio();
void SNDQTSetVolume(int volume);
SoundInterface_struct SNDQt = {
SNDCORE_QT,
"Qt QAudioOutput Sound Interface",
SNDQTInit,
SNDQTDeInit,
SNDQTUpdateAudio,
SNDQTGetAudioSpace,
SNDQTMuteAudio,
SNDQTUnMuteAudio,
SNDQTSetVolume
};
namespace {
QAudioOutput *audio = NULL;
QIODevice *aio = NULL;
} /* namespace */
int SNDQTInit(int buffersize) {
QAudioFormat fmt;
fmt.setSampleRate(DESMUME_SAMPLE_RATE);
fmt.setSampleType(QAudioFormat::SignedInt);
fmt.setSampleSize(16);
fmt.setChannelCount(2);
fmt.setCodec("audio/pcm");
fmt.setByteOrder(QAudioFormat::LittleEndian);
QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
if (!info.isFormatSupported(fmt)) {
qWarning() << "Raw audio format not supported by backend, cannot play audio.";
return -1;
}
audio = new QAudioOutput(fmt);
audio->setBufferSize(buffersize * 2 * 2);
aio = audio->start();
return 0;
}
void SNDQTDeInit() {
audio->stop();
aio = NULL;
delete audio;
audio = NULL;
}
void SNDQTUpdateAudio(s16 *buffer, u32 num_samples) {
if (aio == NULL) {
qDebug("%s is called at the wrong time!\n", __FUNCTION__);
return;
}
qint64 written = 0, writtenTotal = 0;
const u32 count = num_samples * 2 * 2;
do {
written = aio->write((char *) buffer, count - writtenTotal);
} while (written >= 0 && (writtenTotal += written) < count);
}
u32 SNDQTGetAudioSpace() {
if (aio == NULL) {
qDebug("%s is called at the wrong time!\n", __FUNCTION__);
return 0;
}
return audio->bytesFree() / 2 / 2;
}
void SNDQTMuteAudio() {
audio->suspend();
//audio->setVolume(0.0);
}
void SNDQTUnMuteAudio() {
audio->resume();
//audio->setVolume(1.0);
}
void SNDQTSetVolume(int volume) {
audio->setVolume(volume / 1.0);
}

View File

@ -1,28 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SNDQT_H
#define SNDQT_H
#include "SPU.h"
#define SNDCORE_QT 778
extern SoundInterface_struct SNDQt;
#endif /* SNDQT_H */

View File

@ -1,223 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ds.h"
#include "keyboardinput.h"
#include "controlconfigdialog.h"
#include "ui_controlconfigdialog.h"
#include "controlitemconfigdialog.h"
namespace desmume {
namespace qt {
ControlConfigDialog::ControlConfigDialog(QWidget* parent)
: QDialog(parent)
, ui(new Ui::ControlConfigDialog)
, mKeyboard(keyboard)
{
ui->setupUi(this);
this->updateButtonText();
}
ControlConfigDialog::~ControlConfigDialog() {
delete ui;
}
void ControlConfigDialog::updateButtonText() {
ui->buttonControlA->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_A)));
ui->buttonControlB->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_B)));
ui->buttonControlX->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_X)));
ui->buttonControlY->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_Y)));
ui->buttonControlUp->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_UP)));
ui->buttonControlDown->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_DOWN)));
ui->buttonControlLeft->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_LEFT)));
ui->buttonControlRight->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_RIGHT)));
ui->buttonControlL->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_L)));
ui->buttonControlR->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_R)));
ui->buttonControlStart->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_START)));
ui->buttonControlSelect->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_SELECT)));
ui->buttonControlLid->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_LID)));
ui->buttonControlDebug->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_DEBUG)));
}
void ControlConfigDialog::on_buttonControlUp_clicked() {
ControlItemConfigDialog dlg;
int res = dlg.exec();
if (res == QDialog::Accepted) {
int key = dlg.key();
mKeyboard.setAssignedKey(ds::KEY_UP, key);
ui->buttonControlUp->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_UP)));
}
}
void ControlConfigDialog::on_buttonControlDown_clicked() {
ControlItemConfigDialog dlg;
int res = dlg.exec();
if (res == QDialog::Accepted) {
int key = dlg.key();
mKeyboard.setAssignedKey(ds::KEY_DOWN, key);
ui->buttonControlDown->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_DOWN)));
}
}
void ControlConfigDialog::on_buttonControlLeft_clicked() {
ControlItemConfigDialog dlg;
int res = dlg.exec();
if (res == QDialog::Accepted) {
int key = dlg.key();
mKeyboard.setAssignedKey(ds::KEY_LEFT, key);
ui->buttonControlLeft->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_LEFT)));
}
}
void ControlConfigDialog::on_buttonControlRight_clicked() {
ControlItemConfigDialog dlg;
int res = dlg.exec();
if (res == QDialog::Accepted) {
int key = dlg.key();
mKeyboard.setAssignedKey(ds::KEY_RIGHT, key);
ui->buttonControlRight->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_RIGHT)));
}
}
void ControlConfigDialog::on_buttonControlA_clicked() {
ControlItemConfigDialog dlg;
int res = dlg.exec();
if (res == QDialog::Accepted) {
int key = dlg.key();
mKeyboard.setAssignedKey(ds::KEY_A, key);
ui->buttonControlA->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_A)));
}
}
void ControlConfigDialog::on_buttonControlB_clicked() {
ControlItemConfigDialog dlg;
int res = dlg.exec();
if (res == QDialog::Accepted) {
int key = dlg.key();
mKeyboard.setAssignedKey(ds::KEY_B, key);
ui->buttonControlB->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_B)));
}
}
void ControlConfigDialog::on_buttonControlX_clicked() {
ControlItemConfigDialog dlg;
int res = dlg.exec();
if (res == QDialog::Accepted) {
int key = dlg.key();
mKeyboard.setAssignedKey(ds::KEY_X, key);
ui->buttonControlX->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_X)));
}
}
void ControlConfigDialog::on_buttonControlY_clicked() {
ControlItemConfigDialog dlg;
int res = dlg.exec();
if (res == QDialog::Accepted) {
int key = dlg.key();
mKeyboard.setAssignedKey(ds::KEY_Y, key);
ui->buttonControlY->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_Y)));
}
}
void ControlConfigDialog::on_buttonControlL_clicked() {
ControlItemConfigDialog dlg;
int res = dlg.exec();
if (res == QDialog::Accepted) {
int key = dlg.key();
mKeyboard.setAssignedKey(ds::KEY_L, key);
ui->buttonControlL->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_L)));
}
}
void ControlConfigDialog::on_buttonControlR_clicked() {
ControlItemConfigDialog dlg;
int res = dlg.exec();
if (res == QDialog::Accepted) {
int key = dlg.key();
mKeyboard.setAssignedKey(ds::KEY_R, key);
ui->buttonControlR->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_R)));
}
}
void ControlConfigDialog::on_buttonControlStart_clicked() {
ControlItemConfigDialog dlg;
int res = dlg.exec();
if (res == QDialog::Accepted) {
int key = dlg.key();
mKeyboard.setAssignedKey(ds::KEY_START, key);
ui->buttonControlStart->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_START)));
}
}
void ControlConfigDialog::on_buttonControlSelect_clicked() {
ControlItemConfigDialog dlg;
int res = dlg.exec();
if (res == QDialog::Accepted) {
int key = dlg.key();
mKeyboard.setAssignedKey(ds::KEY_SELECT, key);
ui->buttonControlSelect->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_SELECT)));
}
}
void ControlConfigDialog::on_buttonControlLid_clicked() {
ControlItemConfigDialog dlg;
int res = dlg.exec();
if (res == QDialog::Accepted) {
int key = dlg.key();
mKeyboard.setAssignedKey(ds::KEY_LID, key);
ui->buttonControlLid->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_LID)));
}
}
void ControlConfigDialog::on_buttonControlDebug_clicked() {
ControlItemConfigDialog dlg;
int res = dlg.exec();
if (res == QDialog::Accepted) {
int key = dlg.key();
mKeyboard.setAssignedKey(ds::KEY_DEBUG, key);
ui->buttonControlDebug->setText(KeyboardInput::getKeyDisplayText(mKeyboard.getAssignedKey(ds::KEY_DEBUG)));
}
}
void ControlConfigDialog::on_buttonBox_accepted() {
keyboard.from(mKeyboard);
this->accept();
}
void ControlConfigDialog::on_buttonBox_rejected() {
this->reject();
}
void ControlConfigDialog::on_buttonBox_clicked(QAbstractButton* button) {
switch (ui->buttonBox->buttonRole(button)) {
case QDialogButtonBox::DestructiveRole:
this->reject();
break;
case QDialogButtonBox::ResetRole:
mKeyboard.from(KeyboardInput());
this->updateButtonText();
break;
default:
break;
}
}
} /* namespace ui */
} /* namespace desmume */

View File

@ -1,68 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DESMUME_QT_CONTROLCONFIGDIALOG_H
#define DESMUME_QT_CONTROLCONFIGDIALOG_H
#include "keyboardinput.h"
#include <QDialog>
#include <QAbstractButton>
namespace desmume {
namespace qt {
namespace Ui {
class ControlConfigDialog;
} /* namespace Ui */
class ControlConfigDialog : public QDialog {
Q_OBJECT
KeyboardInput mKeyboard;
void updateButtonText();
public:
explicit ControlConfigDialog(QWidget* parent = 0);
~ControlConfigDialog();
private slots:
void on_buttonControlUp_clicked();
void on_buttonControlDown_clicked();
void on_buttonControlLeft_clicked();
void on_buttonControlRight_clicked();
void on_buttonControlA_clicked();
void on_buttonControlB_clicked();
void on_buttonControlX_clicked();
void on_buttonControlY_clicked();
void on_buttonControlL_clicked();
void on_buttonControlR_clicked();
void on_buttonControlStart_clicked();
void on_buttonControlSelect_clicked();
void on_buttonControlLid_clicked();
void on_buttonControlDebug_clicked();
void on_buttonBox_accepted();
void on_buttonBox_rejected();
void on_buttonBox_clicked(QAbstractButton* button);
private:
Ui::ControlConfigDialog* ui;
};
} /* namespace qt */
} /* namespace desmume */
#endif /* DESMUME_QT_CONTROLCONFIGDIALOG_H */

View File

@ -1,212 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>desmume::qt::ControlConfigDialog</class>
<widget class="QDialog" name="desmume::qt::ControlConfigDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<height>323</height>
</rect>
</property>
<property name="windowTitle">
<string>Configure Controls</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tabDS">
<attribute name="title">
<string>DS Buttons</string>
</attribute>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,0,1" columnstretch="0,1,0,0,1" columnminimumwidth="0,0,6,0,0">
<item row="4" column="1">
<widget class="QPushButton" name="buttonControlA">
</widget>
</item>
<item row="4" column="4">
<widget class="QPushButton" name="buttonControlLid">
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="buttonControlL">
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Left</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Up</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>A</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>X</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Down</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Y</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Debug</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Right</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Lid</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Start</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="buttonControlUp">
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>B</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_9">
<property name="text">
<string>L</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_10">
<property name="text">
<string>R</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="buttonControlDown">
</widget>
</item>
<item row="2" column="4">
<widget class="QPushButton" name="buttonControlStart">
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="buttonControlLeft">
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="buttonControlR">
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="buttonControlRight">
</widget>
</item>
<item row="7" column="1">
<widget class="QPushButton" name="buttonControlY">
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="buttonControlB">
</widget>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="buttonControlX">
</widget>
</item>
<item row="5" column="4">
<widget class="QPushButton" name="buttonControlDebug">
</widget>
</item>
<item row="3" column="4">
<widget class="QPushButton" name="buttonControlSelect">
</widget>
</item>
<item row="8" column="1">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Discard|QDialogButtonBox::RestoreDefaults|QDialogButtonBox::Save</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -1,55 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "keyboardinput.h"
#include "controlitemconfigdialog.h"
#include "ui_controlitemconfigdialog.h"
#include <QKeyEvent>
namespace desmume {
namespace qt {
ControlItemConfigDialog::ControlItemConfigDialog(QWidget* parent)
: QDialog(parent)
, ui(new Ui::ControlItemConfigDialog)
, mKey(0)
{
ui->setupUi(this);
}
ControlItemConfigDialog::~ControlItemConfigDialog() {
delete ui;
}
void ControlItemConfigDialog::keyPressEvent(QKeyEvent* event) {
if (mKey == 0) {
this->mKey = event->key();
ui->label->setText(KeyboardInput::getKeyDisplayText(this->mKey));
ui->buttonBox->setEnabled(true);
} else {
QDialog::keyPressEvent(event);
}
}
int ControlItemConfigDialog::key() {
return this->mKey;
}
} /* namespace qt */
} /* namespace desmume */

View File

@ -1,48 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DESMUME_QT_CONTROLITEMCONFIGDIALOG_H
#define DESMUME_QT_CONTROLITEMCONFIGDIALOG_H
#include <QDialog>
namespace desmume {
namespace qt {
namespace Ui {
class ControlItemConfigDialog;
}
class ControlItemConfigDialog : public QDialog {
Q_OBJECT
int mKey;
protected:
void keyPressEvent(QKeyEvent* event);
public:
explicit ControlItemConfigDialog(QWidget *parent = 0);
~ControlItemConfigDialog();
int key();
private:
Ui::ControlItemConfigDialog *ui;
};
} /* namespace qt */
} /* namespace desmume */
#endif /* DESMUME_QT_CONTROLITEMCONFIGDIALOG_H */

View File

@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>desmume::qt::ControlItemConfigDialog</class>
<widget class="QDialog" name="desmume::qt::ControlItemConfigDialog">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Configure Control</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Press a key...</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>desmume::qt::ControlItemConfigDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>164</x>
<y>41</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>58</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>desmume::qt::ControlItemConfigDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>164</x>
<y>47</y>
</hint>
<hint type="destinationlabel">
<x>173</x>
<y>58</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -1,168 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ds.h"
#include "keyboardinput.h"
#include "version.h"
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "controlconfigdialog.h"
#include <QImage>
#include <QPainter>
#include <QKeyEvent>
#include <QDebug>
#include <QFileDialog>
#include <QMessageBox>
namespace desmume {
namespace qt {
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
, mFpsLabel(NULL)
{
ui->setupUi(this);
this->populateVideoFilterMenu();
this->setWindowTitle(EMU_DESMUME_NAME_AND_VERSION());
ui->statusBar->showMessage(EMU_DESMUME_NAME_AND_VERSION());
this->ui->screen->setFocus();
}
MainWindow::~MainWindow() {
delete ui;
}
void MainWindow::populateVideoFilterMenu() {
videoFilterActionGroup = new QActionGroup(this);
for (int i = 0; i < VideoFilterTypeIDCount; i++) {
const VideoFilterAttributes& filter = VideoFilterAttributesList[i];
QAction *act = new QAction(videoFilterActionGroup);
act->setObjectName(QStringLiteral("actionVideoFilter") + filter.typeString);
act->setCheckable(true);
act->setData(i);
if (i == VideoFilterTypeID_None) {
act->setText("&None");
act->setChecked(true);
} else {
act->setText(filter.typeString);
}
ui->menuVideoFilter->addAction(act);
}
connect(videoFilterActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(videoFilterActionGroup_triggered(QAction*)));
}
void MainWindow::videoFilterActionGroup_triggered(QAction *action) {
VideoFilterTypeID filterID = (VideoFilterTypeID)action->data().toInt();
ds::video->setFilter(filterID);
}
void MainWindow::screenBufferUpdate(unsigned int *buf, const QSize &size, qreal scale) {
ui->screen->setScreenBuffer(buf, size, scale);
}
void MainWindow::screenRedraw(bool immediate) {
if (immediate) {
ui->screen->repaint();
} else {
ui->screen->update();
}
}
void MainWindow::fpsUpdate(int fps) {
QString fpsText = QStringLiteral("%1 fps").arg(fps);
if (mFpsLabel == NULL) {
mFpsLabel = new QLabel(fpsText, ui->statusBar);
ui->statusBar->addPermanentWidget(mFpsLabel);
} else {
mFpsLabel->setText(fpsText);
}
}
void MainWindow::keyPressEvent(QKeyEvent *event) {
if (!keyboard.keyPress(event->key())) {
QMainWindow::keyPressEvent(event);
}
}
void MainWindow::keyReleaseEvent(QKeyEvent *event) {
if (!keyboard.keyRelease(event->key())) {
QMainWindow::keyPressEvent(event);
}
}
void MainWindow::on_actionOpenROM_triggered() {
QString fileName = QFileDialog::getOpenFileName(this, "Open NDS ROM", "", "NDS ROM Files (*.nds)");
if (fileName.length() > 0) {
if (ds::loadROM(fileName.toLocal8Bit())) {
ui->statusBar->showMessage(QStringLiteral("Loaded ROM ") + fileName);
ui->actionPause->setEnabled(true);
} else {
ui->actionPause->setEnabled(false);
QMessageBox::warning(this, QStringLiteral("DeSmuME"), QStringLiteral("Cannot open ROM ") + fileName);
}
}
}
void MainWindow::on_actionPause_toggled(bool checked) {
if (checked) {
ds::pause();
} else {
ds::unpause();
}
}
void MainWindow::on_actionConfigureControls_triggered() {
ControlConfigDialog dlg(this);
dlg.exec();
}
void MainWindow::on_actionAboutQt_triggered() {
QMessageBox::aboutQt(this);
}
void desmume::qt::MainWindow::on_action_AboutDeSmuME_triggered() {
// TODO: Make a better About dialog
QMessageBox::about(
this,
"About DeSmuME",
QStringLiteral("Version: \n\t") +
EMU_DESMUME_NAME_AND_VERSION() + "\n"
"\n"
"This file is free software: you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation, either version 2 of the License, or\n"
"(at your option) any later version.\n"
"\n"
"This file is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"GNU General Public License for more details.\n"
"\n"
"You should have received a copy of the GNU General Public License\n"
"along with the this software. If not, see <http://www.gnu.org/licenses/>."
);
}
void MainWindow::on_actionQuit_triggered() {
this->close();
}
} /* namespace qt */
} /* namespace desmume */

View File

@ -1,71 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DESMUME_QT_MAINWINDOW_H
#define DESMUME_QT_MAINWINDOW_H
#include <vector>
#include <QMainWindow>
#include <QSize>
#include <QAction>
#include <QActionGroup>
#include <QLabel>
namespace desmume {
namespace qt {
namespace Ui {
class MainWindow;
} /* namespace Ui */
class MainWindow : public QMainWindow
{
Q_OBJECT
QActionGroup* videoFilterActionGroup;
QLabel* mFpsLabel;
void populateVideoFilterMenu();
protected:
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void screenBufferUpdate(unsigned int *buf, const QSize &size, qreal scale);
void screenRedraw(bool immediate);
void fpsUpdate(int fps);
private slots:
void on_actionQuit_triggered();
void videoFilterActionGroup_triggered(QAction* action);
void on_actionConfigureControls_triggered();
void on_actionPause_toggled(bool checked);
void on_actionOpenROM_triggered();
void on_actionAboutQt_triggered();
void on_action_AboutDeSmuME_triggered();
private:
Ui::MainWindow *ui;
};
} /* namespace qt */
} /* namespace desmume */
#endif /* DESMUME_QT_MAINWINDOW_H */

View File

@ -1,196 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>desmume::qt::MainWindow</class>
<widget class="QMainWindow" name="desmume::qt::MainWindow">
<property name="windowTitle">
<string>DeSmuME</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="desmume::qt::ScreenWidget" name="screen" native="true">
<property name="minimumSize">
<size>
<width>256</width>
<height>384</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<widget class="QMenu" name="menuFile">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="actionOpenROM"/>
<addaction name="separator"/>
<addaction name="actionPause"/>
<addaction name="separator"/>
<addaction name="actionQuit"/>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">
<string>&amp;View</string>
</property>
<widget class="QMenu" name="menuVideoFilter">
<property name="title">
<string>Video &amp;Filter</string>
</property>
</widget>
<widget class="QMenu" name="menuLCDsLayout">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>LCDs &amp;Layout</string>
</property>
</widget>
<widget class="QMenu" name="menuScreenRotation">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Screen &amp;Rotation</string>
</property>
</widget>
<addaction name="menuLCDsLayout"/>
<addaction name="menuScreenRotation"/>
<addaction name="menuVideoFilter"/>
</widget>
<widget class="QMenu" name="menuConfig">
<property name="title">
<string>&amp;Config</string>
</property>
<addaction name="actionConfigureControls"/>
</widget>
<widget class="QMenu" name="menuTools">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>&amp;Tools</string>
</property>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="actionAboutQt"/>
<addaction name="action_AboutDeSmuME"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuView"/>
<addaction name="menuConfig"/>
<addaction name="menuTools"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionOpenROM"/>
<addaction name="separator"/>
<addaction name="actionPause"/>
</widget>
<widget class="QStatusBar" name="statusBar">
<property name="sizeGripEnabled">
<bool>false</bool>
</property>
</widget>
<action name="actionOpenROM">
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/images/open</normaloff>:/images/open</iconset>
</property>
<property name="text">
<string>Open ROM</string>
</property>
<property name="toolTip">
<string>Open an NDS ROM file</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
<action name="actionQuit">
<property name="text">
<string>&amp;Quit</string>
</property>
</action>
<action name="actionConfigureControls">
<property name="text">
<string>Configure &amp;Controls</string>
</property>
<property name="toolTip">
<string>Configure input controls</string>
</property>
</action>
<action name="actionPause">
<property name="checkable">
<bool>true</bool>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon">
<iconset resource="../resources/resources.qrc">
<normaloff>:/images/pause</normaloff>:/images/pause</iconset>
</property>
<property name="text">
<string>&amp;Pause</string>
</property>
<property name="toolTip">
<string>Pause the emulation</string>
</property>
<property name="shortcut">
<string>Pause</string>
</property>
</action>
<action name="actionAboutQt">
<property name="text">
<string>About &amp;Qt</string>
</property>
</action>
<action name="action_AboutDeSmuME">
<property name="text">
<string>&amp;About DeSmuME</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>desmume::qt::ScreenWidget</class>
<extends>QWidget</extends>
<header>ui/screenwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../resources/resources.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,171 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ds.h"
#include "screenwidget.h"
#include <QPainter>
#include <QPen>
#include <QImage>
#include <QResizeEvent>
#include <QMouseEvent>
#include <QTransform>
#include <QDebug>
namespace desmume {
namespace qt {
ScreenWidget::ScreenWidget(QWidget* parent)
: QWidget(parent)
, mScreenBuf(NULL)
{
}
void ScreenWidget::calcTransform() {
if (mScreenBuf != NULL) {
QTransform transform;
int daW = this->width(), daH = this->height();
int imgW, imgH;
switch (/* layout */ 0) {
case /* vertical */ 0:
imgW = mScreenSize.width();
imgH = mScreenSize.height() /* + gapSize * mScale */;
break;
case /* horizontal */ 1:
imgW = mScreenSize.width() * 2;
imgH = mScreenSize.height() / 2;
break;
case /* singleScreen */ 2:
imgW = mScreenSize.width();
imgH = mScreenSize.height() / 2;
break;
}
if (/* rotateHorizontal */ false) {
qSwap(imgW, imgH);
}
qreal hRatio = (qreal)daW / (qreal)imgW;
qreal vRatio = (qreal)daH / (qreal)imgH;
if (/* keepAspectRatio */ true) {
hRatio = qMin(hRatio, vRatio);
vRatio = hRatio;
}
// Scale to fit drawing area
transform.translate(daW / 2, daH / 2);
transform.scale(hRatio, vRatio);
transform.rotate(/* rotationAngle */ 0.0);
transform.translate(-mScreenSize.width() / 2, -mScreenSize.height() / 2);
// Transform each screen
if (/* hasMainScreen */ true) {
mMainScreenTransform = transform;
if (/* swapped */ false) {
switch (/* layout */ 0) {
case /* vertical */ 0:
mMainScreenTransform.translate(0, mScreenSize.height() / 2 /* + gapSize * mScale */);
break;
case /* horizontal */ 1:
mMainScreenTransform.translate(mScreenSize.width(), 0);
break;
case /* singleScreen */ 2:
break;
}
}
mMainScreenTransformInv = mMainScreenTransform;
mMainScreenTransformInv.scale(mScale, mScale);
mMainScreenTransformInv = mMainScreenTransformInv.inverted();
}
if (/* hasTouchScreen */ true) {
mTouchScreenTransform = transform;
if (/* !swapped */ true) {
switch (/* layout */ 0) {
case /* vertical */ 0:
mTouchScreenTransform.translate(0, mScreenSize.height() / 2 /* + gapSize * mScale */);
break;
case /* horizontal */ 1:
mTouchScreenTransform.translate(mScreenSize.width(), 0);
break;
case /* singleScreen */ 2:
break;
}
}
mTouchScreenTransformInv = mTouchScreenTransform;
mTouchScreenTransformInv.scale(mScale, mScale);
mTouchScreenTransformInv = mTouchScreenTransformInv.inverted();
}
}
}
void ScreenWidget::resizeEvent(QResizeEvent* event) {
calcTransform();
}
void ScreenWidget::mousePressEvent(QMouseEvent* event) {
this->setFocus();
mAcceptTouchDS = false;
if (ds::isRunning() && event->button() == Qt::LeftButton) {
const QPoint touchScreenPt = mTouchScreenTransformInv.map(event->pos());
const QRect r(0, 0, 255, 191);
if (r.contains(touchScreenPt)) {
mAcceptTouchDS = true;
ds::input.touchMove(touchScreenPt.x(), touchScreenPt.y());
}
}
}
void ScreenWidget::mouseMoveEvent(QMouseEvent* event) {
if (ds::isRunning() && event->buttons() == Qt::LeftButton && mAcceptTouchDS) {
const QPoint touchScreenPt = mTouchScreenTransformInv.map(event->pos());
ds::input.touchMove(touchScreenPt.x(), touchScreenPt.y());
}
}
void ScreenWidget::mouseReleaseEvent(QMouseEvent* event) {
if (mAcceptTouchDS) {
ds::input.touchUp();
}
mAcceptTouchDS = false;
}
void ScreenWidget::setScreenBuffer(unsigned int* buf, const QSize& size, qreal scale) {
this->mScreenBuf = buf;
this->mScreenSize = size;
this->mScale = scale;
calcTransform();
}
void ScreenWidget::paintEvent(QPaintEvent* event) {
QPainter painter(this);
// Fill background with magenta for debugging purpose
painter.fillRect(0, 0, this->width(), this->height(), QColor::fromRgb(255, 0, 255));
if (this->mScreenBuf != NULL) {
QImage img(
(unsigned char*)this->mScreenBuf,
this->mScreenSize.width(),
this->mScreenSize.height(),
QImage::Format_RGBX8888
);
painter.setTransform(mMainScreenTransform);
painter.drawImage(0, 0, img, 0, 0, -1, mScreenSize.height() / 2);
painter.setTransform(mTouchScreenTransform);
painter.drawImage(0, 0, img, 0, mScreenSize.height() / 2);
}
}
} /* namespace qt */
} /* namespace desmume */

View File

@ -1,59 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DESMUME_QT_SCREENWIDGET_H
#define DESMUME_QT_SCREENWIDGET_H
#include <QWidget>
#include <QSize>
#include <QImage>
namespace desmume {
namespace qt {
class ScreenWidget : public QWidget
{
Q_OBJECT
unsigned int* mScreenBuf;
QSize mScreenSize;
qreal mScale;
QTransform mMainScreenTransform;
QTransform mTouchScreenTransform;
QTransform mMainScreenTransformInv;
QTransform mTouchScreenTransformInv;
bool mAcceptTouchDS;
void calcTransform();
protected:
void resizeEvent(QResizeEvent* event);
void mousePressEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent* event);
void paintEvent(QPaintEvent* event);
public:
explicit ScreenWidget(QWidget* parent = 0);
void setScreenBuffer(unsigned int* buf, const QSize& size, qreal scale);
signals:
public slots:
};
} /* namespace qt */
} /* namespace desmume */
#endif /* DESMUME_QT_SCREENWIDGET_H */

View File

@ -1,137 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "video.h"
#include "GPU.h"
#include "GPU_osd.h"
#include <QDebug>
#ifdef HOST_WINDOWS
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
# ifdef _MSC_VER
# define __restrict__ __restrict
# endif
#endif
namespace desmume {
namespace qt {
namespace {
// These conevrsion functions are adapted from Cocoa port.
static const uint8_t bits5to8[] = {
0x00, 0x08, 0x10, 0x19, 0x21, 0x29, 0x31, 0x3A,
0x42, 0x4A, 0x52, 0x5A, 0x63, 0x6B, 0x73, 0x7B,
0x84, 0x8C, 0x94, 0x9C, 0xA5, 0xAD, 0xB5, 0xBD,
0xC5, 0xCE, 0xD6, 0xDE, 0xE6, 0xEF, 0xF7, 0xFF
};
static inline uint32_t RGB555ToRGBA8888(const uint16_t color16)
{
return (bits5to8[((color16 >> 0) & 0x001F)] << 0) |
(bits5to8[((color16 >> 5) & 0x001F)] << 8) |
(bits5to8[((color16 >> 10) & 0x001F)] << 16) |
0xFF000000;
}
static inline uint32_t RGB555ToBGRA8888(const uint16_t color16)
{
return (bits5to8[((color16 >> 10) & 0x001F)] << 0) |
(bits5to8[((color16 >> 5) & 0x001F)] << 8) |
(bits5to8[((color16 >> 0) & 0x001F)] << 16) |
0xFF000000;
}
static inline void RGB555ToRGBA8888Buffer(const uint16_t *__restrict__ srcBuffer, uint32_t *__restrict__ destBuffer, size_t pixelCount)
{
const uint32_t *__restrict__ destBufferEnd = destBuffer + pixelCount;
while (destBuffer < destBufferEnd)
{
*destBuffer++ = RGB555ToRGBA8888(*srcBuffer++);
}
}
static inline void RGB555ToBGRA8888Buffer(const uint16_t *__restrict__ srcBuffer, uint32_t *__restrict__ destBuffer, size_t pixelCount)
{
const uint32_t *__restrict__ destBufferEnd = destBuffer + pixelCount;
while (destBuffer < destBufferEnd)
{
*destBuffer++ = RGB555ToBGRA8888(*srcBuffer++);
}
}
} /* namespace */
Video::Video(int numThreads, QObject* parent)
: QObject(parent)
, mFilter(256, 384, VideoFilterTypeID_None, numThreads)
{
}
bool Video::setFilter(VideoFilterTypeID filterID) {
const VideoFilterAttributes& attrib = VideoFilterAttributesList[filterID];
if (attrib.scaleDivide == 1 || attrib.scaleDivide == 2) {
bool res = this->mFilter.ChangeFilterByID(filterID);
runFilter();
return res;
} else {
qWarning(
"Filter %s has a `scaleDivide` of %d."
"The code currently can't handle this well,"
"so this filter will not be enabled.\n",
attrib.typeString,
(int)attrib.scaleDivide
);
return false;
}
}
unsigned int* Video::runFilter() {
RGB555ToRGBA8888Buffer((const uint16_t *)GPU->GetDisplayInfo().masterNativeBuffer, this->mFilter.GetSrcBufferPtr(), 256 * 384);
unsigned int* buf = this->mFilter.RunFilter();
this->screenBufferUpdated(buf, this->getDstSize(), this->getDstScale());
return buf;
}
unsigned int* Video::getDstBufferPtr() {
return this->mFilter.GetDstBufferPtr();
}
int Video::getDstWidth() {
return this->mFilter.GetDstWidth();
}
int Video::getDstHeight() {
return this->mFilter.GetDstHeight();
}
QSize Video::getDstSize() {
return QSize(this->mFilter.GetDstWidth(), this->mFilter.GetDstHeight());
}
qreal Video::getDstScale() {
const VideoFilterAttributes& attrib = this->mFilter.GetAttributes();
return (qreal)attrib.scaleMultiply / (qreal)attrib.scaleDivide;
}
} /* namespace qt */
} /* namespace desmume */

View File

@ -1,48 +0,0 @@
/*
Copyright (C) 2014 DeSmuME team
Copyright (C) 2014 Alvin Wong
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DESMUME_QT_VIDEO_H
#define DESMUME_QT_VIDEO_H
#include "filter/videofilter.h"
#include <QObject>
#include <QSize>
namespace desmume {
namespace qt {
class Video : public QObject {
Q_OBJECT
VideoFilter mFilter;
public:
Video(int numThreads, QObject* parent = 0);
bool setFilter(VideoFilterTypeID filterID);
unsigned int* runFilter();
unsigned int* getDstBufferPtr();
int getDstWidth();
int getDstHeight();
QSize getDstSize();
qreal getDstScale();
signals:
void screenBufferUpdated(unsigned int *buf, const QSize &size, qreal scale);
};
} /* namespace qt */
} /* namespace desmume */
#endif /* DESMUME_QT_VIDEO_H */

View File

@ -32,7 +32,7 @@
#endif
//todo - everyone will want to support this eventually, i suppose
#if defined(HOST_WINDOWS) || defined(DESMUME_COCOA) || defined(DESMUME_QT)
#if defined(HOST_WINDOWS) || defined(DESMUME_COCOA)
#include "svnrev.h"
#else
#ifndef SVN_REV