Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
initial libretro port:
Browse files Browse the repository at this point in the history
- restore files from upstream
- enable dynarecs
- new makefiles
- bake-in SDL
- refine core options
- add SVN_VERSION
- add more granularity to core options
- proper config file saving
- add SDL_net for Android
- fix disney sound system
- allow baking in SDL in more platforms
- use dynrec instead of dynamic_x86 on linux
  • Loading branch information
andres-asm committed Dec 6, 2019
1 parent 238b428 commit 4774c16
Show file tree
Hide file tree
Showing 862 changed files with 273,830 additions and 25 deletions.
114 changes: 114 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
## DOSBox-SVN libretro

Upstream port of DOSBox to libretro.

### Keeping up-to-date
Clone the repo from the svn upstream:

```bash
git svn clone svn://svn.code.sf.net/p/dosbox/code-0/dosbox/ dosbox-svn
```

This takes a few hours. Then add a remote for the git repo:

```bash
cd dosbox-svn
git remote add origin https://github.com/fr500/dosbox-svn.git --> replace this with your repo URL if you're working in a fork
git fetch
git checkout master
git svn rebase
```
Switch to libretro branch and work there instead, don't make any changes to master:

```
git checkout libretro
git rebase master
```

Do your work, resolve conflicts if any, and then:
```bash
git push --force
```

### Compilation
So far it's compiling on Windows, Linux, Android and OSX.
####Requirements
- SDL1.2
- SDL_net
To build on Windows we recommend MSYS2 (https://www.msys2.org/).
Install MSYS2, and follow these instructions:
#### Update Environment
Start the MSYS2 shell and run:
```bash
pacman --noconfirm -Sy
pacman --needed --noconfirm -S bash pacman pacman-mirrors msys2-runtime
```
Restart MSYS2 and run:
```bash
pacman --noconfirm -Su
```
#### Install the Toolchain
For 32-bit builds run:
```bash
pacman -S --noconfirm --needed wget git make mingw-w64-i686-toolchain mingw-w64-i686-ntldd mingw-w64-i686-zlib mingw-w64-i686-pkg-config mingw-w64-i686-SDL2 mingw-w64-i686-SDL mingw-w64-i686-SDL_net
```
For 64-bit builds run:
```bash
pacman -S --noconfirm --needed wget git make mingw-w64-x86_64-toolchain mingw-w64-x86_64-ntldd mingw-w64-x86_64-zlib mingw-w64-x86_64-pkg-config mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL mingw-w64-x86_64-SDL_net
```
#### Building
```bash
cd libretro
make -j4
```
If you want to enable the dynarec:
```bash
make -j8 WITH_DYNAREC=$ABI
```
The valid ABI choices are `arm, oldarm, x86_64, x86, ppc, mips`
The `x86_64` dynarec doesn't work on windows so far. For better performance x86 is recommended

### Usage

Use like normal DOSbox, you can load exe files or conf files directly.

Cycle increase hot-keys **do-not-work**. Instead you should leverage *Core Options*. Refer to your libretro frontend documentation for reference on how to access these options.

For GLIDE support (non-hw accelerated) use the glide branch.

### Screenshots

![RetroArch GUI](docs/images/screenshot_gui.png "RetroArch GUI")
![DOOM II](docs/images/screenshot_doom.png "DOOM II")
![Duke Nukem 3D](docs/images/screenshot_duke.png "Duke Nukem 3D")
![Tyrian](docs/images/screenshot_tyrian.png "Tyrian")

As with official DOSBox, Windows is not officially supported (but it works)

![Windows 95](docs/images/screenshot_win.png "Windows 95")






Binary file added docs/images/screenshot_doom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/screenshot_duke.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/screenshot_gui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/screenshot_tyrian.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/screenshot_win.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
154 changes: 154 additions & 0 deletions include/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.in by autoheader. */


/*
* Copyright (C) 2002-2013 The DOSBox Team
*
* This program 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 program 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 Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/


// ----- OS ! YOU MUST CHANGE THIS FOR THE BUILD PLATFORM
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* #undef BSD */
/* #undef LINUX */
/* #undef MACOSX */
/* #undef OS2 */

#ifdef __WIN32__
# define WIN32 1
#else
//# define MACOSX 1
#endif

// ----- RECOMPILER ! YOU MUST CHANGE THIS FOR THE BUILD PLATFORM
#ifndef __POWERPC__
/* #undef C_DYNAMIC_X86 */ /* Define to 1 to use x86 dynamic cpu core */
/* #undef C_DYNREC */ /* Define to 1 to use recompiling cpu core. Can not be used together with the dynamic-x86 core */
/* #undef C_FPU_X86 */ /* Define to 1 to use a x86 assembly fpu core */
/* #undef C_TARGETCPU */ /* The type of cpu this target has */
#endif

#define C_UNALIGNED_MEMORY 1 /* Define to 1 to use a unaligned memory access */

// ----- DOSBOX CORE FEATURES: Many of these probably won't work even if you enable them
#define C_FPU 1 /* Define to 1 to enable floating point emulation */
/* #undef C_CORE_INLINE */ /* Define to 1 to use inlined memory functions in cpu core */
/* #undef C_DIRECTSERIAL */ /* Define to 1 if you want serial passthrough support (Win32, Posix and OS/2). */
/* #undef C_IPX */ /* Define to 1 to enable IPX over Internet networking, requires SDL_net */
/* #undef C_MODEM */ /* Define to 1 to enable internal modem support, requires SDL_net */
/* #undef C_SDL_SOUND */ /* Define to 1 to enable SDL_sound support */

// ----- HEADERS: Define if headers exist in build environment
#define HAVE_INTTYPES_H 1
#define HAVE_MEMORY_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1

#if !defined(__WIN32__) && !defined(__POWERPC__) && !defined(VITA) && !defined(_3DS)
# define HAVE_PWD_H 1
#endif

// ----- STANDARD LIBRARY FEATURES
#ifndef __QNX__
#define DIRENT_HAS_D_TYPE 1 /* struct dirent has d_type */
#endif
/* #undef DB_HAVE_NO_POWF */ /* libm doesn't include powf */
/* #undef TM_IN_SYS_TIME */ /* Define to 1 if your <sys/time.h> declares `struct tm'. */
/* #undef size_t */ /* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef socklen_t */ /* Define to `int` if you don't have socklen_t */

// ----- COMPILER FEATURES
#define C_ATTRIBUTE_ALWAYS_INLINE 1
#define C_HAS_ATTRIBUTE 1
#define C_HAS_BUILTIN_EXPECT 1
/* #undef C_ATTRIBUTE_FASTCALL */



///////////////////

/* Version number of package */
#define VERSION "SVN-libretro"

/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif

/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */

/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif

#ifndef INLINE
#if C_ATTRIBUTE_ALWAYS_INLINE
#define INLINE inline __attribute__((always_inline))
#else
#define INLINE inline
#endif
#endif

#if C_ATTRIBUTE_FASTCALL
#define DB_FASTCALL __attribute__((fastcall))
#else
#define DB_FASTCALL
#endif

#if C_HAS_ATTRIBUTE
#define GCC_ATTRIBUTE(x) __attribute__ ((x))
#else
#define GCC_ATTRIBUTE(x) /* attribute not supported */
#endif

#if C_HAS_BUILTIN_EXPECT
#define GCC_UNLIKELY(x) __builtin_expect((x),0)
#define GCC_LIKELY(x) __builtin_expect((x),1)
#else
#define GCC_UNLIKELY(x) (x)
#define GCC_LIKELY(x) (x)
#endif

#include <stdint.h>
typedef double Real64;
typedef uint8_t Bit8u;
typedef int8_t Bit8s;
typedef uint16_t Bit16u;
typedef int16_t Bit16s;
typedef uint32_t Bit32u;
typedef int32_t Bit32s;
typedef uint64_t Bit64u;
typedef int64_t Bit64s;
typedef uintptr_t Bitu;
typedef intptr_t Bits;
2 changes: 1 addition & 1 deletion include/ipx.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#endif

// For Uint8 type
#include "SDL_net.h"
#include <SDL/SDL_net.h>

struct PackedIP {
Uint32 host;
Expand Down
2 changes: 1 addition & 1 deletion include/ipxserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#if C_IPX

#include "SDL_net.h"
#include <SDL/SDL_net.h>

struct packetBuffer {
Bit8u buffer[1024];
Expand Down
3 changes: 2 additions & 1 deletion include/mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class MixerChannel {
Bit32s volmul[2];

//This gets added the frequency counter each mixer step
Bitu freq_add;
Bits last[2];
Bitu freq_add, freq_index;
//When this flows over a new sample needs to be read from the device
Bitu freq_counter;
//Timing on how many samples have been done and were needed by th emixer
Expand Down
2 changes: 2 additions & 0 deletions include/render.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
// 1: complex scalers off, scaler cache off, all simple scalers on
// 2: complex scalers off, scaler cache on
// 3: complex scalers on
#ifndef RENDER_USE_ADVANCED_SCALERS
#define RENDER_USE_ADVANCED_SCALERS 3
#endif

#include "../src/gui/render_scalers.h"

Expand Down
2 changes: 1 addition & 1 deletion include/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define DOSBOX_TIMER_H

/* underlying clock rate in HZ */
#include <SDL.h>
#include <SDL/SDL.h>

#define PIT_TICK_RATE 1193182

Expand Down
1 change: 1 addition & 0 deletions libretro/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include Makefile.libretro
Loading

0 comments on commit 4774c16

Please sign in to comment.