include(FindPkgConfig)
-pkg_search_module(SDL2 REQUIRED sdl2)
-include_directories(${SDL2_INCLUDE_DIRS})
+if(CMAKE_CROSSCOMPILING)
+ include_directories(${SDL2_INCLUDE_DIRS})
+else()
+ pkg_search_module(SDL2 REQUIRED sdl2)
+ include_directories(${SDL2_INCLUDE_DIRS})
+endif()
#if(ICONV_FOUND)
# include_directories(${ICONV_INCLUDE_DIRS})
${OPENMP_LIBRARY}
# ${SDL_LIBRARY}
${SDL2_LIBRARIES}
+ ${ADDITIONAL_LIBRARIES}
)
if(USE_QT_5)
set(BUNDLE_LIBS ${BUNDLE_LIBS} ${QT_LIBRARIES})
--- /dev/null
+# the name of the target operating system
+SET(CMAKE_SYSTEM_NAME Windows)
+
+# which compilers to use for C and C++
+SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
+SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)
+SET(CMAKE_RC_COMPILER i586-mingw32msvc-windres)
+
+# here is the target environment located
+SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc
+ /usr/local/i586-mingw-msvc
+ /usr/local/i586-mingw-msvc/SDL/i686-w64-mingw32
+ /usr/local/i586-mingw-msvc/5.5/mingw492_32)
+
+
+
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search
+# programs in the host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+set(SDL2_LIBRARIES
+ /usr/local/i586-mingw-msvc/SDL/i686-w64-mingw32/lib/libSDL2.dll.a
+ /usr/local/i586-mingw-msvc/SDL/i686-w64-mingw32/lib/libSDL2main.a)
+set(SDL2_INCLUDE_DIRS /usr/local/i586-mingw-msvc/SDL/i686-w64-mingw32/include/SDL2)
+set(SDLMAIN_LIBRARY "")
+
+set(ADDITIONAL_LIBRARIES libwinmm.a)
\ No newline at end of file
--- /dev/null
+#!/bin/bash
+
+CMAKE=/usr/bin/cmake
+TOOLCHAIN_SCRIPT="../../cmake/toolchain_mingw_cross_linux.cmake"
+
+#MAKEFLAGS_CXX="-g -O2 -DNDEBUG"
+#MAKEFLAGS_CC="-g -O2 -DNDEBUG"
+BUILD_TYPE="Relwithdebinfo"
+CMAKE_APPENDFLAG=""
+
+#if [ -e ./buildvars.dat ] ; then
+# . ./buildvars.dat
+#fi
+#MAKEFLAGS_CXX="-g -O3 -ftree-vectorize -flto -DNDEBUG"
+#MAKEFLAGS_CC="-g -O3 -ftree-vectorize -flto -DNDEBUG"
+#MAKEFLAGS_GENERAL="-j4"
+
+#CMAKE_LINKFLAG="-DCMAKE_EXE_LINKER_FLAGS='${CMAKE_EXE_LINKER_FLAGS} -flto -O3 -ftree-vectorize -g'"
+#CMAKE_LINKFLAG=""
+#CMAKE_APPENDFLAG="-DCMAKE_AR=/usr/bin/gcc-ar -DCMAKE_NM=/usr/bin/gcc-nm -DCMAKE_RANLIB=/usr/bin/gcc-ranlib"
+
+case ${BUILD_TYPE} in
+ "Debug" | "DEBUG" | "debug" )
+ CMAKE_FLAGS1="-DCMAKE_BUILD_TYPE:STRING=debug"
+ CMAKE_FLAGS2="-DCMAKE_CXX_FLAGS_DEBUG:STRING"
+ CMAKE_FLAGS3="-DCMAKE_C_FLAGS_DEBUG:STRING"
+ ;;
+ "Release" | "RELEASE" | "release" )
+ CMAKE_FLAGS1="-DCMAKE_BUILD_TYPE:STRING=Release"
+ CMAKE_FLAGS2="-DCMAKE_CXX_FLAGS_RELEASE:STRING"
+ CMAKE_FLAGS3="-DCMAKE_C_FLAGS_RELEASE:STRING"
+ ;;
+ "Relwithdebinfo" | "RELWITHDEBINFO" | "relwithdebinfo" )
+ CMAKE_FLAGS1="-DCMAKE_BUILD_TYPE:STRING=Relwithdebinfo"
+ CMAKE_FLAGS2="-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING"
+ CMAKE_FLAGS3="-DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING"
+ ;;
+ * )
+ echo "Specify BUILD_TYPE in buildvars.dat to Debug, Release, Relwithdebinfo."
+ exit -1
+ ;;
+esac
+
+for SRCDATA in $@ ; do\
+
+ mkdir -p ${SRCDATA}/build-win32
+ cd ${SRCDATA}/build-win32
+
+ echo ${CMAKE_FLAGS1} ${CMAKE_FLAGS2}
+ ${CMAKE} -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_SCRIPT} \
+ ${CMAKE_FLAGS1} \
+ "${CMAKE_FLAGS2}=${MAKEFLAGS_CXX}" \
+ "${CMAKE_FLAGS3}=${MAKEFLAGS_CC}" \
+ ${CMAKE_APPENDFLAG} \
+ ${CMAKE_LINKFLAG} \
+ .. | tee make.log
+
+ ${CMAKE} ${CMAKE_FLAGS1} \
+ "${CMAKE_FLAGS2}=${MAKEFLAGS_CXX}" \
+ "${CMAKE_FLAGS3}=${MAKEFLAGS_CC}" \
+ ${CMAKE_APPENDFLAG} \
+ ${CMAKE_LINKFLAG} \
+ .. | tee -a make.log
+
+ make clean
+
+ make ${MAKEFLAGS_GENERAL} 2>&1 | tee -a ./make.log
+# case $? in
+# 0 ) sudo make install 2>&1 | tee -a ./make.log ;;
+# * ) exit $? ;;
+# esac
+
+# make clean
+ cd ../..
+done
+
+exit 0
+
// return errno;
// }
//}
-
errno_t _strcpy_s(char *strDestination, size_t numberOfElements, const char *strSource)
{
strcpy(strDestination, strSource);
return 0;
}
+# if !defined(Q_OS_WIN32)
errno_t _tcscpy_s(_TCHAR *strDestination, size_t numberOfElements, const _TCHAR *strSource)
{
_tcscpy(strDestination, strSource);
{
return _tcstok(strToken, strDelimit);
}
-
+# endif
int _stprintf_s(_TCHAR *buffer, size_t sizeOfBuffer, const _TCHAR *format, ...)
{
va_list ap;
#include <agar/core.h>
#include <stdarg.h>
#elif defined(_USE_QT)
-#include <SDL2/SDL.h>
+#include <SDL.h>
#include <stdarg.h>
-
+# if defined(Q_OS_WIN32)
+# include <tchar.h>
+# endif
# if defined(_USE_QT5)
# include <QString>
# include <QFile>
#if defined(_USE_AGAR) || defined(_USE_SDL) || defined(_USE_QT)
-#ifndef uint8
+# ifndef uint8
typedef uint8_t uint8;
-# endif
-# ifndef int8
+# endif
+# ifndef int8
typedef int8_t int8;
-# endif
-# ifndef uint16
+# endif
+# ifndef uint16
typedef uint16_t uint16;
-# endif
-# ifndef int16
+# endif
+# ifndef int16
typedef int16_t int16;
-# endif
-# ifndef uint32
+# endif
+# ifndef uint32
typedef uint32_t uint32;
-# endif
-# ifndef int32
+# endif
+# ifndef int32
typedef int32_t int32;
-# endif
-# ifndef uint64
+# endif
+# ifndef uint64
typedef uint64_t uint64;
-# endif
-# ifndef int64
+# endif
+# ifndef int64
typedef int64_t int64;
-# endif
-# ifndef BOOL
+# endif
+# ifndef BOOL
typedef int BOOL;
-# endif
-# ifndef BYTE
+# endif
+# ifndef Q_OS_WIN32
+# ifndef BYTE
typedef uint8_t BYTE;
-# endif
-# ifndef WORD
+# endif
+# ifndef WORD
typedef uint16_t WORD;
-# endif
-# ifndef DWORD
+# endif
+# ifndef DWORD
typedef uint32_t DWORD;
-# endif
-# ifndef QWORD
+# endif
+# ifndef QWORD
typedef uint64_t QWORD;
-# endif
+# endif
-# ifndef UINT8
+# ifndef UINT8
typedef uint8_t UINT8;
-# endif
-# ifndef UINT16
+# endif
+# ifndef UINT16
typedef uint16_t UINT16;
-# endif
-# ifndef UINT32
+# endif
+# ifndef UINT32
typedef uint32_t UINT32;
-# endif
-# ifndef UINT64
+# endif
+# ifndef UINT64
typedef uint64_t UINT64;
-# endif
+# endif
-# ifndef INT8
+# ifndef INT8
typedef int8_t INT8;
-# endif
-# ifndef INT16
+# endif
+# ifndef INT16
typedef int16_t INT16;
-# endif
-# ifndef INT32
+# endif
+# ifndef INT32
typedef int32_t INT32;
-# endif
-# ifndef INT64
+# endif
+# ifndef INT64
typedef int64_t INT64;
-# endif
+# endif
+//# ifndef Q_OS_WIN32
static inline void _stprintf(char *s, const char *fmt, ...) {
va_list args;
sprintf(s, fmt, args);
va_end(args);
}
-#define stricmp(a,b) strcmp(a,b)
-#define strnicmp(a,b,n) strncmp(a,b,n)
+# define stricmp(a,b) strcmp(a,b)
+# define strnicmp(a,b,n) strncmp(a,b,n)
// tchar.h
static inline char *_tcsncat(_TCHAR *d, _TCHAR *s, int n) {
return strncat((char *)d, (char *)s, n);
}
+# endif
+#endif
+#if defined(_USE_AGAR) || defined(_USE_SDL) || defined(_USE_QT)
-static inline int DeleteFile(_TCHAR *path)
+# if defined(Q_OS_WIN32)
+ typedef char _TCHAR;
+# endif
+static int DeleteFile(_TCHAR *path)
{
#ifdef _USE_QT
QString fpath = (char *)path;
}
#include <algorithm>
+# ifndef Q_OS_WIN32
# ifdef USE_GETTEXT
# include <libintl.h>
# define _N(x) gettext(x)
# else
# define _N(x) _T(x)
# endif
+# endif
+#endif
+
+#if defined(_USE_AGAR) || defined(_USE_SDL) || defined(_USE_QT)
+# if defined(Q_OS_WIN32)
+# include <tchar.h>
+# endif
#undef __LITTLE_ENDIAN___
#undef __BIG_ENDIAN___
# if (SDL_BYTEORDER == SDL_LIL_ENDIAN)
# define __LITTLE_ENDIAN__
-static inline DWORD EndianToLittle_DWORD(DWORD x)
+static inline uint32_t EndianToLittle_DWORD(uint32_t x)
{
return x;
}
-static inline WORD EndianToLittle_WORD(WORD x)
+static inline uint16_t EndianToLittle_WORD(uint16_t x)
{
return x;
}
# else // BIG_ENDIAN
# define __BIG_ENDIAN__
-static inline DWORD EndianToLittle_DWORD(DWORD x)
+static inline uint32_t EndianToLittle_DWORD(uint32_t x)
{
- DWORD y;
+ uint32_t y;
y = ((x & 0x000000ff) << 24) | ((x & 0x0000ff00) << 8) |
((x & 0x00ff0000) >> 8) | ((x & 0xff000000) >> 24);
return y;
}
-static inline WORD EndianToLittle_WORD(WORD x)
+static inline uint16_t EndianToLittle_WORD(uint16_t x)
{
- WORD y;
+ uint16_t y;
y = ((x & 0x00ff) << 8) | ((x & 0xff00) >> 8);
return y;
}
#endif
-
typedef union {
struct {
#ifdef __BIG_ENDIAN__
#define _tfopen fopen
#define _tcscmp strcmp
#define _tcscpy strcpy
-#define _tcsicmp stricmp
+# if !defined(_tcsicmp)
+# define _tcsicmp stricmp
+# endif
#define _tcslen strlen
#define _tcsncat strncat
#define _tcsncpy strncpy
+# if !defined(_tcsncicmp)
#define _tcsncicmp strnicmp
+# endif
#define _tcsstr strstr
#define _tcstok strtok
#define _tcstol strtol
#endif
// secture functions
#ifndef SUPPORT_SECURE_FUNCTIONS
-#ifndef errno_t
+# ifndef errno_t
typedef int errno_t;
-#endif
+# endif
//errno_t _tfopen_s(FILE** pFile, const _TCHAR *filename, const _TCHAR *mode);
errno_t _strcpy_s(char *strDestination, size_t numberOfElements, const char *strSource);
+# if !defined(Q_OS_WIN32)
errno_t _tcscpy_s(_TCHAR *strDestination, size_t numberOfElements, const _TCHAR *strSource);
_TCHAR *_tcstok_s(_TCHAR *strToken, const char *strDelimit, _TCHAR **context);
+# endif
int _stprintf_s(_TCHAR *buffer, size_t sizeOfBuffer, const _TCHAR *format, ...);
int _vstprintf_s(_TCHAR *buffer, size_t numberOfElements, const _TCHAR *format, va_list argptr);
#else
#endif
#elif defined(_USE_QT)
-# include <SDL2/SDL.h>
+# include <SDL.h>
//# include "menuclasses.h"
//# include "mainwidget.h"
//# include "qt_gldraw.h"
#include <QSemaphore>
#include <QMutex>
#include <QThread>
-#include "qt_input.h"
+//#include "qt_input.h"
#endif
#if defined(_USE_AGAR) || defined(_USE_QT)
char strbuf2[256];
char strbuf3[24];
struct timeval tv;
+#if !defined(Q_OS_WIN32)
int level_flag = LOG_USER;
if(log_onoff == 0) return;
} else {
level_flag |= LOG_DEBUG;
}
-
+#endif
char *p;
char *p_bak;
const char delim[2] = "\n";
do {
if(p != NULL) {
if(log_cons != 0) fprintf(stdout, "%s : %s%s %s\n", log_sysname, strbuf2, strbuf3, p);
+#if !defined(Q_OS_WIN32)
if(syslog_flag != 0) syslog(level_flag, "uS=%06ld %s", tv.tv_usec, p);
+#endif
p = strtok_r(NULL, delim, &p_bak);
}
} while(p != NULL);
void AGAR_CloseLog(void)
{
+#if !defined(Q_OS_WIN32)
if(syslog_flag != 0) {
closelog();
}
+#endif
syslog_flag = 0;
log_cons = 0;
log_onoff = 0;
#include <stdarg.h>
#include <stdio.h>
-
-#include <syslog.h>
-
+#include <QWidget>
+#if !defined(Q_OS_WIN32)
+# include <syslog.h>
+#endif
#include <time.h>
#include <sys/time.h>
#include <Qt>
#include <QApplication>
-#include <SDL2/SDL.h>
+#include <SDL.h>
#include "emu.h"
#include "vm/vm.h"
#include "fifo.h"
vm->key_up(VK_SHIFT);
# endif
// check l/r shift
+# if defined(Q_OS_WIN32) //
+ if(!(GetAsyncKeyState(VK_LSHIFT) & 0x8000)) key_status[VK_LSHIFT] &= 0x7f;
+ if(!(GetAsyncKeyState(VK_RSHIFT) & 0x8000)) key_status[VK_RSHIFT] &= 0x7f;
+# else
if(!(GetAsyncKeyState(VK_LSHIFT, modkey_status) & 0x8000)) key_status[VK_LSHIFT] &= 0x7f;
if(!(GetAsyncKeyState(VK_RSHIFT, modkey_status) & 0x8000)) key_status[VK_RSHIFT] &= 0x7f;
+#endif
}
if(key_status[VK_LSHIFT] != 0) {
// shift key is newly released
vm->key_up(VK_LSHIFT);
# endif
// check l/r shift
+# if defined(Q_OS_WIN32) //
+ if(!(GetAsyncKeyState(VK_LSHIFT) & 0x8000)) key_status[VK_LSHIFT] &= 0x7f;
+# else
if(!(GetAsyncKeyState(VK_LSHIFT, modkey_status) & 0x8000)) key_status[VK_LSHIFT] &= 0x7f;
+# endif
}
if(key_status[VK_RSHIFT] != 0) {
// shift key is newly released
vm->key_up(VK_RSHIFT);
# endif
// check l/r shift
+# if defined(Q_OS_WIN32) //
+ if(!(GetAsyncKeyState(VK_RSHIFT) & 0x8000)) key_status[VK_RSHIFT] &= 0x7f;
+# else
if(!(GetAsyncKeyState(VK_RSHIFT, modkey_status) & 0x8000)) key_status[VK_RSHIFT] &= 0x7f;
+# endif
}
}
key_shift_pressed = key_shift_released = false;
uint8 code = sym;
if(code == VK_SHIFT){
#ifndef USE_SHIFT_NUMPAD_KEY
+# if defined(Q_OS_WIN32) //
+ if(GetAsyncKeyState(VK_SHIFT) & 0x8000) {
+# else
if(GetAsyncKeyState(VK_SHIFT, modkey_status) & 0x8000) {
+# endif
key_status[VK_LSHIFT] = 0x80;
key_status[VK_RSHIFT] = 0x80;
key_status[VK_SHIFT] = 0x80;
#endif
} else if(code == VK_LSHIFT){
#ifndef USE_SHIFT_NUMPAD_KEY
+# if defined(Q_OS_WIN32)
+ if(GetAsyncKeyState(VK_LSHIFT) & 0x8000) key_status[VK_LSHIFT] = 0x80;
+# else
if(GetAsyncKeyState(VK_LSHIFT, modkey_status) & 0x8000) key_status[VK_LSHIFT] = 0x80;
+# endif
#endif
} else if(code == VK_RSHIFT){
#ifndef USE_SHIFT_NUMPAD_KEY
+# if defined(Q_OS_WIN32)
+ if(GetAsyncKeyState(VK_RSHIFT) & 0x8000) key_status[VK_RSHIFT] = 0x80;
+# else
if(GetAsyncKeyState(VK_RSHIFT, modkey_status) & 0x8000) key_status[VK_RSHIFT] = 0x80;
+# endif
#endif
} else if(code == VK_CONTROL) {
+# if defined(Q_OS_WIN32)
+ if(GetAsyncKeyState(VK_CONTROL) & 0x8000) {
+# else
if(GetAsyncKeyState(VK_CONTROL, modkey_status) & 0x8000) {
+# endif
key_status[VK_LCONTROL] = 0x80;
key_status[VK_RCONTROL] = 0x80;
key_status[VK_CONTROL] = 0x80;
}
} else if(code == VK_LCONTROL) {
+# if defined(Q_OS_WIN32)
+ if(GetAsyncKeyState(VK_LCONTROL) & 0x8000) key_status[VK_LCONTROL] = 0x80;
+# else
if(GetAsyncKeyState(VK_LCONTROL, modkey_status) & 0x8000) key_status[VK_LCONTROL] = 0x80;
+# endif
} else if(code == VK_RCONTROL) {
+# if defined(Q_OS_WIN32)
+ if(GetAsyncKeyState(VK_RCONTROL) & 0x8000) key_status[VK_RCONTROL] = 0x80;
+# else
if(GetAsyncKeyState(VK_RCONTROL, modkey_status) & 0x8000) key_status[VK_RCONTROL] = 0x80;
+# endif
} else if(code == VK_MENU) {
+# if defined(Q_OS_WIN32)
+ if(GetAsyncKeyState(VK_MENU) & 0x8000) {
+# else
if(GetAsyncKeyState(VK_MENU, modkey_status) & 0x8000) {
+# endif
key_status[VK_LMENU] = 0x80;
key_status[VK_RMENU] = 0x80;
key_status[VK_MENU] = 0x80;
}
} else if(code == VK_LMENU) {
+# if defined(Q_OS_WIN32)
+ if(GetAsyncKeyState(VK_LMENU) & 0x8000) key_status[VK_LMENU] = 0x80;
+# else
if(GetAsyncKeyState(VK_LMENU, modkey_status) & 0x8000) key_status[VK_LMENU] = 0x80;
+# endif
} else if(code == VK_RMENU) {
+# if defined(Q_OS_WIN32)
+ if(GetAsyncKeyState(VK_RMENU) & 0x8000) key_status[VK_RMENU] = 0x80;
+# else
if(GetAsyncKeyState(VK_RMENU, modkey_status) & 0x8000) key_status[VK_RMENU] = 0x80;
+# endif
} else if(code == 0xf0) {
code = VK_CAPITAL;
keep_frames = true;
uint8 code = sym;
if(code == VK_SHIFT) {
#ifndef USE_SHIFT_NUMPAD_KEY
+# if defined(Q_OS_WIN32)
+ if(!(GetAsyncKeyState(VK_SHIFT) & 0x8000)) {
+# else
if(!(GetAsyncKeyState(VK_SHIFT, modkey_status) & 0x8000)) {
+# endif
key_status[VK_LSHIFT] &= 0x7f;
key_status[VK_RSHIFT] &= 0x7f;
key_status[VK_SHIFT] &= 0x7f;
#endif
} else if(code == VK_LSHIFT) {
#ifndef USE_SHIFT_NUMPAD_KEY
+# if defined(Q_OS_WIN32)
+ if(!(GetAsyncKeyState(VK_LSHIFT) & 0x8000)) key_status[VK_LSHIFT] &= 0x7f;
+# else
if(!(GetAsyncKeyState(VK_LSHIFT, modkey_status) & 0x8000)) key_status[VK_LSHIFT] &= 0x7f;
+# endif
#endif
} else if(code == VK_RSHIFT) {
#ifndef USE_SHIFT_NUMPAD_KEY
+# if defined(Q_OS_WIN32)
+ if(!(GetAsyncKeyState(VK_RSHIFT) & 0x8000)) key_status[VK_RSHIFT] &= 0x7f;
+# else
if(!(GetAsyncKeyState(VK_RSHIFT, modkey_status) & 0x8000)) key_status[VK_RSHIFT] &= 0x7f;
+# endif
#endif
} else if(code == VK_CONTROL) {
+# if defined(Q_OS_WIN32)
+ if(!(GetAsyncKeyState(VK_CONTROL) & 0x8000)) {
+# else
if(!(GetAsyncKeyState(VK_CONTROL, modkey_status) & 0x8000)) {
+# endif
key_status[VK_LCONTROL] &= 0x7f;
key_status[VK_RCONTROL] &= 0x7f;
key_status[VK_CONTROL] &= 0x7f;
}
} else if(code == VK_LCONTROL) {
+# if defined(Q_OS_WIN32)
+ if(!(GetAsyncKeyState(VK_LCONTROL) & 0x8000)) key_status[VK_LCONTROL] &= 0x7f;
+# else
if(!(GetAsyncKeyState(VK_LCONTROL, modkey_status) & 0x8000)) key_status[VK_LCONTROL] &= 0x7f;
+# endif
} else if(code == VK_RCONTROL) {
+# if defined(Q_OS_WIN32)
+ if(!(GetAsyncKeyState(VK_RCONTROL) & 0x8000)) key_status[VK_RCONTROL] &= 0x7f;
+# else
if(!(GetAsyncKeyState(VK_RCONTROL, modkey_status) & 0x8000)) key_status[VK_RCONTROL] &= 0x7f;
+# endif
} else if(code == VK_MENU) {
+# if defined(Q_OS_WIN32)
+ if(!(GetAsyncKeyState(VK_MENU) & 0x8000)) {
+# else
if(!(GetAsyncKeyState(VK_MENU, modkey_status) & 0x8000)) {
+# endif
key_status[VK_LMENU] &= 0x7f;
key_status[VK_RMENU] &= 0x7f;
key_status[VK_MENU] &= 0x7f;
}
} else if(code == VK_LMENU) {
+# if defined(Q_OS_WIN32)
+ if(!(GetAsyncKeyState(VK_LMENU) & 0x8000)) key_status[VK_LMENU] &= 0x7f;
+# else
if(!(GetAsyncKeyState(VK_LMENU, modkey_status) & 0x8000)) key_status[VK_LMENU] &= 0x7f;
+# endif
} else if(code == VK_RMENU) {
+# if defined(Q_OS_WIN32)
+ if(!(GetAsyncKeyState(VK_RMENU) & 0x8000)) key_status[VK_RMENU] &= 0x7f;
+# else
if(!(GetAsyncKeyState(VK_RMENU, modkey_status) & 0x8000)) key_status[VK_RMENU] &= 0x7f;
+# endif
}
#ifdef USE_SHIFT_NUMPAD_KEY
#include "emu.h"
#include "qt_main.h"
+#if !defined(Q_OS_WIN32)
extern "C" {
extern uint32_t timeGetTime(void);
}
+#endif
#if defined(USE_FD1) || defined(USE_FD2) || defined(USE_FD3) || defined(USE_FD4) || \
defined(USE_FD5) || defined(USE_FD6) || defined(USE_FD7) || defined(USE_FD8)
#include <QRect>
#endif
//#include <SDL/SDL.h>
-#ifdef _WINDOWS
+#if defined(_WINDOWS) || defined(Q_OS_WIN32)
#include <GL/gl.h>
#include <GL/glext.h>
#else
class EMU;
struct NativeScanCode {
- uint32 vk;
- uint32 scan;
+ uint32_t vk;
+ uint32_t scan;
};
struct NativeVirtualKeyCode {
- uint32 vk;
- uint32 key;
+ uint32_t vk;
+ uint32_t key;
};
#if defined(_USE_GLAPI_QT5_4)
#include <QtGui>
#include <QMouseEvent>
#include <QApplication>
-#ifdef _WINDOWS
+#if defined(_WINDOWS) || defined(Q_OS_WIN32)
#include <GL/gl.h>
#include <GL/glext.h>
#else
extern "C" {
#endif
// Include from gui/drv_wgl_keymaps.h , libagar.
-enum {
+ enum {
VK_LBUTTON = 0x01,
VK_RBUTTON = 0x02,
VK_OME_CLEAR = 0xfe,
};
+# if !defined(Q_OS_WIN32)
uint32_t GetAsyncKeyState(uint32_t vk, uint32_t mod);
+# endif
uint8_t convert_AGKey2VK(uint32_t sym);
#ifdef __cplusplus
{
if(frames >= 0) draw_frames += frames;
if(calc_message) {
- DWORD current_time = timeGetTime();
+ uint32_t current_time = timeGetTime();
if(update_fps_time <= current_time && update_fps_time != 0) {
_TCHAR buf[256];
QString message;
nErrorCode = MainLoop(argc, argv);
return nErrorCode;
}
+#if defined(Q_OS_WIN32)
+int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
+{
+ main(0, NULL);
+}
+#endif
#include <QImage>
#include <QString>
-#include <SDL2/SDL.h>
+#include <SDL.h>
#include "sdl_cpuid.h"
#include "simd_types.h"
#include "common.h"
#include "agar_logger.h"
typedef struct {
- DWORD dwRIFF;
- DWORD dwFileSize;
- DWORD dwWAVE;
- DWORD dwfmt_;
- DWORD dwFormatSize;
- WORD wFormatTag;
- WORD wChannels;
- DWORD dwSamplesPerSec;
- DWORD dwAvgBytesPerSec;
- WORD wBlockAlign;
- WORD wBitsPerSample;
- DWORD dwdata;
- DWORD dwDataLength;
+ uint32_t dwRIFF;
+ uint32_t dwFileSize;
+ uint32_t dwWAVE;
+ uint32_t dwfmt_;
+ uint32_t dwFormatSize;
+ uint16_t wFormatTag;
+ uint16_t wChannels;
+ uint32_t dwSamplesPerSec;
+ uint32_t dwAvgBytesPerSec;
+ uint16_t wBlockAlign;
+ uint16_t wBitsPerSample;
+ uint32_t dwdata;
+ uint32_t dwDataLength;
} wavheader_t;
extern "C" {
SDL_SemPost(*pData->pSndApplySem);
if(spos >= (len / 2)) return;
// while(nSndDataLen <= 0) {
+#if defined(Q_OS_WIN32)
+ SDL_Delay(1);
+#else
nanosleep(&req, &remain); // Wait 500uS
+#endif
if(bSndExit) return;
// }
}
now_mute = false;
if(sound_ok) {
- DWORD play_c, offset, size1, size2;
+ uint32_t play_c, offset, size1, size2;
Sint16 *ptr1, *ptr2;
// start play
{
if(!now_mute && sound_ok) {
// check current position
- DWORD size1, size2;
+ uint32_t size1, size2;
Sint16 *ptr1, *ptr2;
// WIP
#include <QThread>
#include <QMetaObject>
+#include <math.h>
#include "./qt_debugger.h"
void CSP_DebuggerThread::my_printf(const _TCHAR *format, ...)
{
- DWORD dwWritten;
_TCHAR buffer[4096];
va_list ap;
#include <stdio.h>
#include <string.h>
-#include <termios.h>
+
#include <unistd.h>
#include <fcntl.h>
#include <QObject>
uint32_t GLDrawClass::get106Scancode2VK(uint32_t data)
{
- uint32 val = 0;
- uint32 vk;
+ uint32_t val = 0;
+ uint32_t vk;
int i = 0;
while(NativeScanCode[i].vk != 0xffffffff) {
val = NativeScanCode[i].scan;
NativeScanCode[i].vk = 0xffffffff;
NativeScanCode[i].scan = 0xffffffff;
+#if !defined(Q_OS_WIN32)
for(i = 0; i < 255; i++) {
if(convTable_QTKey[i].vk == 0xffffffff) break;
NativeVirtualKeyCode[i].vk = convTable_QTKey[i].vk;
}
NativeVirtualKeyCode[i].vk = 0xffffffff;
NativeVirtualKeyCode[i].key = 0xffffffff;
-
+#endif
// Replace only ScanCode
FILEIO *fio = new FILEIO();
std::string app_path2;
nstr = QString::fromUtf8(buf);
nlist = nstr.split(",", QString::SkipEmptyParts);
if(nlist.count() < 2) continue;
- uint32 vk = nlist.at(0).toULong(&ok1, 16);
- uint32 scan = nlist.at(1).toULong(&ok2, 16);
+ uint32_t vk = nlist.at(0).toULong(&ok1, 16);
+ uint32_t scan = nlist.at(1).toULong(&ok2, 16);
if((vk == 0) || (vk > 255)) continue;
if(ok1 && ok2) {
for(i = 0; i < 255; i++) {
if(NativeScanCode[i].vk == 0xffffffff) break;
if(NativeScanCode[i].scan == scan) {
- NativeScanCode[i].vk = (uint32)vk;
+ NativeScanCode[i].vk = (uint32_t)vk;
break;
}
}
void GLDrawClass::keyReleaseEvent(QKeyEvent *event)
{
int key = event->key();
- uint32 mod = event->modifiers();
- uint32 scan;
- uint32 vk;
+ uint32_t mod = event->modifiers();
+ uint32_t scan;
+ uint32_t vk;
if(event->isAutoRepeat()) return;
//scan = event->nativeVirtualKey();
//vk = getNativeKey2VK(scan);
void GLDrawClass::keyPressEvent(QKeyEvent *event)
{
int key = event->key();
- uint32 mod = event->modifiers();;
- uint32 scan;
- uint32 vk;
+ uint32_t mod = event->modifiers();;
+ uint32_t scan;
+ uint32_t vk;
if(event->isAutoRepeat()) return;
//scan = event->nativeVirtualKey();
emu->UnlockVM();
}
-
+#if !defined(Q_OS_WIN32)
extern "C"{
uint32_t GetAsyncKeyState(uint32_t vk, uint32_t mod)
{
}
-
+#endif
#include "../emu.h"
#include "device.h"
#if defined(_USE_QT)
-#include <SDL2/SDL.h>
+#include <SDL.h>
#define Sleep(n) SDL_Delay(n)
+# if defined(Q_OS_WIN32)
+# include <tchar.h>
+# endif
#endif
#ifdef USE_DEBUGGER
#endif // _FM77AV_VARIANTS
-// Test header
-#if !defined(_MSC_VER)
-#include <SDL2/SDL.h>
-#endif
// Timing values from XM7 . Thanks Ryu.
void DISPLAY::event_callback(int event_id, int err)
#include "../../fileio.h"
#include "fm7_common.h"
+#if defined(_USE_QT)
+# include "qt_input.h"
+#endif
+
#if defined(_FM77AV_VARIANTS)
class BEEP;
#endif
#include "hd6844.h"
#endif
-// TEST
-#if !defined(_MSC_VER)
-#include <SDL2/SDL.h>
-#endif
FM7_MAINIO::FM7_MAINIO(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
{
#include "fm7_mainio.h"
#include "../../config.h"
-// TEST
-//#include <SDL2/SDL.h>
-
void FM7_MAINIO::reset_sound(void)
{
int i, j, k;
#include "mc6809.h"
#include "mc6809_consts.h"
+#include "common.h"
#ifdef USE_DEBUGGER
#include "debugger.h"
#endif
break;
case REL:
- offset = (INT8)operandarray[0];
+ offset = (int8)operandarray[0];
buffer += _stprintf(buffer, _T("$%04X"), (pc + offset) & 0xffff);
break;
case LREL:
- offset = (INT16)((operandarray[0] << 8) + operandarray[1]);
+ offset = (int16)((operandarray[0] << 8) + operandarray[1]);
buffer += _stprintf(buffer, _T("$%04X"), (pc + offset) & 0xffff);
break;
//break;
case 0x88: // (+/- 7 bit offset),R
- offset = (INT8)opram[p++];
+ offset = (int8)opram[p++];
buffer += _stprintf(buffer, _T("%s"), (offset < 0) ? "-" : "");
buffer += _stprintf(buffer, _T("$%02X,"), (offset < 0) ? -offset : offset);
buffer += _stprintf(buffer, _T("%s"), m6809_regs[reg]);
break;
case 0x89: // (+/- 15 bit offset),R
- offset = (INT16)((opram[p+0] << 8) + opram[p+1]);
+ offset = (int16)((opram[p+0] << 8) + opram[p+1]);
p += 2;
buffer += _stprintf(buffer, _T("%s"), (offset < 0) ? "-" : "");
buffer += _stprintf(buffer, _T("$%04X,"), (offset < 0) ? -offset : offset);
break;
case 0x8c: // (+/- 7 bit offset),PC
- offset = (INT8)opram[p++];
+ offset = (int8)opram[p++];
buffer += _stprintf(buffer, _T("%s"), (offset < 0) ? "-" : "");
buffer += _stprintf(buffer, _T("$%02X,PC"), (offset < 0) ? -offset : offset);
break;
case 0x8d: // (+/- 15 bit offset),PC
- offset = (INT16)((opram[p+0] << 8) + opram[p+1]);
+ offset = (int16)((opram[p+0] << 8) + opram[p+1]);
p += 2;
buffer += _stprintf(buffer, _T("%s"), (offset < 0) ? "-" : "");
buffer += _stprintf(buffer, _T("$%04X,PC"), (offset < 0) ? -offset : offset);
case 0x8e: // $FFFFF
//_tcscpy(buffer, _T("Illegal Postbyte"));
- offset = (INT16)0xffff;
+ offset = (int16)0xffff;
//p += 2;
buffer += _stprintf(buffer, _T("$%04X"), offset);
break;
#if !(defined(HAS_AY_3_8910) || defined(HAS_AY_3_8912) || defined(HAS_AY_3_8913))
#define HAS_YM_SERIES
-#if defined(_WIN32) && !defined(SDL)
+#if defined(_WIN32) && !defined(SDL) && !defined(_USE_QT)
#define SUPPORT_MAME_FM_DLL
#include "fmdll/fmdll.h"
#endif