Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows SDL 1.x: Add ncurses to Windows builds and enable debugger interface #515

Closed
bulletshot60 opened this issue Feb 20, 2018 · 11 comments

Comments

Projects
None yet
2 participants
@bulletshot60
Copy link
Contributor

commented Feb 20, 2018

What is the recommended method of building dosbox-x with --enable-debugger=heavy on windows 10? Can this be done using Visual Studio or is a GNU toolchain like MinGW or Cygwin needed?

@joncampbell123

This comment has been minimized.

Copy link
Owner

commented Feb 20, 2018

You'll need cygwin or mingw at the moment. The VS2015 project file would need to incorporate the windows version of the ncurses library to add the debugger interface.

@joncampbell123 joncampbell123 changed the title Building on Windows 10 Windows SDL 1.x: Add ncurses to Windows builds and enable debugger interface Feb 20, 2018

@bulletshot60

This comment has been minimized.

Copy link
Contributor Author

commented Feb 20, 2018

Alright, will the versions of the libraries used to build vanilla DosBox suffice? If not, which versions would you recommend? Also, just use the build-debug script in the repo?

@joncampbell123

This comment has been minimized.

Copy link
Owner

commented Feb 20, 2018

I recommend build-debug, or build-debug-no-avcodec

@joncampbell123

This comment has been minimized.

Copy link
Owner

commented Feb 20, 2018

@bulletshot60

This comment has been minimized.

Copy link
Contributor Author

commented Feb 20, 2018

So starting from a vanilla install of latest Windows 10 and the latest MinGW, here is a copy of what I had to do to get a successful build. Everything appears to be working except debugbox is not behaving as expected. It displays, but I can't scroll through the assembly or step.

Building DosBox-X on Windows 10 with the Debug Interface using MinGW

MinGW & DosBox-X

  1. Download MinGW
  2. During the install, select mingw-developer-tools, mingw32-base, mingw32-gcc-g++, and msys-base.
  3. Run the msys.bat file under C:\MinGW\msys\1.0
  4. cd .. in the opened command prompt then ls. Ensure there is not a space in the home directory that was created for you. If yes, then remove the space from your name with the mv command. (i.e. mv John\ Doe/ JohnDoe)
  5. cd into your home directory and then clone dosbox-x with git clone git@github.com:joncampbell123/dosbox-x.git then cd doxbox-x
  6. I would highly recommend switching to the code for the last public release. To find this go to the releases tab, and get the SHA code for the last release. (i.e. 6da38ea0cbdb4bf0eb0d465cb3d04a1ac12221b8)
  7. git checkout -b last-release <your sha>
  8. You'll also need to have PDCurses, DInput, ZLib, LibPNG & Automake. See instructions below for installing them.
  9. Under src/dos, open the drive_local.cpp file. Replace #define ht_stat_t struct _stat64i32 with #define ht_stat_t struct _stat and #define ht_stat(x,y) _wstat64i32(x,y) with #define ht_stat(x,y) _wstat(x,y).
  10. Under src/gui, open the sdlmain.cpp file. Add #include <imm.h> below #ifdef __WIN32__.
  11. Run the build-debug-no-avcodec script.
  12. Copy the exe created in the src directory to the location of your choice.

Installing PDCurses

  1. Download PDCurses 3.4 and copy the file to your MinGW home directory.
  2. tar xvf PDCurses-3.4.tar.gz
  3. cd PDCurses-3.4/win32
  4. make -f gccwin32.mak
  5. cp pdcurses.a /mingw/lib/libpdcurses.a
  6. cd ..
  7. cp curses.h panel.h /mingw/include

Installing Automake

  1. Download Automake 1.14 and copy the file to your MinGW home directory.
  2. tar xvf automake-1.14.tar.gz
  3. cd automake-1.14
  4. ./configure --prefix=/mingw
  5. make
  6. make install

Installing ZLib

  1. Download ZLib 1.2.8 and copy the file to your MinGW home directory.
  2. tar xvf zlib-1.2.8.tar.xz
  3. cd zlib-1.2.8
  4. make -f win32/Makefile.gcc
  5. cp libz.a /mingw/lib/
  6. cp zlib.h zconf.h /mingw/include/

Installing LibPNG

  1. Download LibPNG 1.6.18 and copy the file to your MinGW home directory.
  2. tar xvf libpng-1.6.18.tar.gz
  3. cd libpng-1.6.18
  4. ./configure --prefix=/mingw
  5. The configure process has a bad habit of placing newlines in define statements which you will have to manually remove. Open pnglibconf.h and start removing the newlines in the define statements starting on line 200.
  6. make
  7. make install

Adding DInput Header

  1. Create a file in include/ named dinput.h and copy the below into the file.
/*
 * Copyright (C) the Wine project
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#ifndef __DINPUT_INCLUDED__
#define __DINPUT_INCLUDED__

#ifndef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION	0x0800
#endif

#define DI_OK                           S_OK
#define DI_NOTATTACHED                  S_FALSE
#define DI_BUFFEROVERFLOW               S_FALSE
#define DI_PROPNOEFFECT                 S_FALSE
#define DI_NOEFFECT                     S_FALSE
#define DI_POLLEDDEVICE                 ((HRESULT)0x00000002L)
#define DI_DOWNLOADSKIPPED              ((HRESULT)0x00000003L)
#define DI_EFFECTRESTARTED              ((HRESULT)0x00000004L)
#define DI_TRUNCATED                    ((HRESULT)0x00000008L)
#define DI_SETTINGSNOTSAVED             ((HRESULT)0x0000000BL)
#define DI_TRUNCATEDANDRESTARTED        ((HRESULT)0x0000000CL)
#define DI_WRITEPROTECT                 ((HRESULT)0x00000013L)

#define DIK_ESCAPE          0x01
#define DIK_1               0x02
#define DIK_2               0x03
#define DIK_3               0x04
#define DIK_4               0x05
#define DIK_5               0x06
#define DIK_6               0x07
#define DIK_7               0x08
#define DIK_8               0x09
#define DIK_9               0x0A
#define DIK_0               0x0B
#define DIK_MINUS           0x0C    /* - on main keyboard */
#define DIK_EQUALS          0x0D
#define DIK_BACK            0x0E    /* backspace */
#define DIK_TAB             0x0F
#define DIK_Q               0x10
#define DIK_W               0x11
#define DIK_E               0x12
#define DIK_R               0x13
#define DIK_T               0x14
#define DIK_Y               0x15
#define DIK_U               0x16
#define DIK_I               0x17
#define DIK_O               0x18
#define DIK_P               0x19
#define DIK_LBRACKET        0x1A
#define DIK_RBRACKET        0x1B
#define DIK_RETURN          0x1C    /* Enter on main keyboard */
#define DIK_LCONTROL        0x1D
#define DIK_A               0x1E
#define DIK_S               0x1F
#define DIK_D               0x20
#define DIK_F               0x21
#define DIK_G               0x22
#define DIK_H               0x23
#define DIK_J               0x24
#define DIK_K               0x25
#define DIK_L               0x26
#define DIK_SEMICOLON       0x27
#define DIK_APOSTROPHE      0x28
#define DIK_GRAVE           0x29    /* accent grave */
#define DIK_LSHIFT          0x2A
#define DIK_BACKSLASH       0x2B
#define DIK_Z               0x2C
#define DIK_X               0x2D
#define DIK_C               0x2E
#define DIK_V               0x2F
#define DIK_B               0x30
#define DIK_N               0x31
#define DIK_M               0x32
#define DIK_COMMA           0x33
#define DIK_PERIOD          0x34    /* . on main keyboard */
#define DIK_SLASH           0x35    /* / on main keyboard */
#define DIK_RSHIFT          0x36
#define DIK_MULTIPLY        0x37    /* * on numeric keypad */
#define DIK_LMENU           0x38    /* left Alt */
#define DIK_SPACE           0x39
#define DIK_CAPITAL         0x3A
#define DIK_F1              0x3B
#define DIK_F2              0x3C
#define DIK_F3              0x3D
#define DIK_F4              0x3E
#define DIK_F5              0x3F
#define DIK_F6              0x40
#define DIK_F7              0x41
#define DIK_F8              0x42
#define DIK_F9              0x43
#define DIK_F10             0x44
#define DIK_NUMLOCK         0x45
#define DIK_SCROLL          0x46    /* Scroll Lock */
#define DIK_NUMPAD7         0x47
#define DIK_NUMPAD8         0x48
#define DIK_NUMPAD9         0x49
#define DIK_SUBTRACT        0x4A    /* - on numeric keypad */
#define DIK_NUMPAD4         0x4B
#define DIK_NUMPAD5         0x4C
#define DIK_NUMPAD6         0x4D
#define DIK_ADD             0x4E    /* + on numeric keypad */
#define DIK_NUMPAD1         0x4F
#define DIK_NUMPAD2         0x50
#define DIK_NUMPAD3         0x51
#define DIK_NUMPAD0         0x52
#define DIK_DECIMAL         0x53    /* . on numeric keypad */
#define DIK_OEM_102         0x56    /* < > | on UK/Germany keyboards */
#define DIK_F11             0x57
#define DIK_F12             0x58
#define DIK_F13             0x64    /*                     (NEC PC98) */
#define DIK_F14             0x65    /*                     (NEC PC98) */
#define DIK_F15             0x66    /*                     (NEC PC98) */
#define DIK_KANA            0x70    /* (Japanese keyboard)            */
#define DIK_ABNT_C1         0x73    /* / ? on Portugese (Brazilian) keyboards */
#define DIK_CONVERT         0x79    /* (Japanese keyboard)            */
#define DIK_NOCONVERT       0x7B    /* (Japanese keyboard)            */
#define DIK_YEN             0x7D    /* (Japanese keyboard)            */
#define DIK_ABNT_C2         0x7E    /* Numpad . on Portugese (Brazilian) keyboards */
#define DIK_NUMPADEQUALS    0x8D    /* = on numeric keypad (NEC PC98) */
#define DIK_CIRCUMFLEX      0x90    /* (Japanese keyboard)            */
#define DIK_AT              0x91    /*                     (NEC PC98) */
#define DIK_COLON           0x92    /*                     (NEC PC98) */
#define DIK_UNDERLINE       0x93    /*                     (NEC PC98) */
#define DIK_KANJI           0x94    /* (Japanese keyboard)            */
#define DIK_STOP            0x95    /*                     (NEC PC98) */
#define DIK_AX              0x96    /*                     (Japan AX) */
#define DIK_UNLABELED       0x97    /*                        (J3100) */
#define DIK_NEXTTRACK       0x99    /* Next Track */
#define DIK_NUMPADENTER     0x9C    /* Enter on numeric keypad */
#define DIK_RCONTROL        0x9D
#define DIK_MUTE	    0xA0    /* Mute */
#define DIK_CALCULATOR      0xA1    /* Calculator */
#define DIK_PLAYPAUSE       0xA2    /* Play / Pause */
#define DIK_MEDIASTOP       0xA4    /* Media Stop */
#define DIK_VOLUMEDOWN      0xAE    /* Volume - */
#define DIK_VOLUMEUP        0xB0    /* Volume + */
#define DIK_WEBHOME         0xB2    /* Web home */
#define DIK_NUMPADCOMMA     0xB3    /* , on numeric keypad (NEC PC98) */
#define DIK_DIVIDE          0xB5    /* / on numeric keypad */
#define DIK_SYSRQ           0xB7
#define DIK_RMENU           0xB8    /* right Alt */
#define DIK_PAUSE           0xC5    /* Pause */
#define DIK_HOME            0xC7    /* Home on arrow keypad */
#define DIK_UP              0xC8    /* UpArrow on arrow keypad */
#define DIK_PRIOR           0xC9    /* PgUp on arrow keypad */
#define DIK_LEFT            0xCB    /* LeftArrow on arrow keypad */
#define DIK_RIGHT           0xCD    /* RightArrow on arrow keypad */
#define DIK_END             0xCF    /* End on arrow keypad */
#define DIK_DOWN            0xD0    /* DownArrow on arrow keypad */
#define DIK_NEXT            0xD1    /* PgDn on arrow keypad */
#define DIK_INSERT          0xD2    /* Insert on arrow keypad */
#define DIK_DELETE          0xD3    /* Delete on arrow keypad */
#define DIK_LWIN            0xDB    /* Left Windows key */
#define DIK_RWIN            0xDC    /* Right Windows key */
#define DIK_APPS            0xDD    /* AppMenu key */
#define DIK_POWER           0xDE
#define DIK_SLEEP           0xDF
#define DIK_WAKE            0xE3    /* System Wake */
#define DIK_WEBSEARCH       0xE5    /* Web Search */
#define DIK_WEBFAVORITES    0xE6    /* Web Favorites */
#define DIK_WEBREFRESH      0xE7    /* Web Refresh */
#define DIK_WEBSTOP         0xE8    /* Web Stop */
#define DIK_WEBFORWARD      0xE9    /* Web Forward */
#define DIK_WEBBACK         0xEA    /* Web Back */
#define DIK_MYCOMPUTER      0xEB    /* My Computer */
#define DIK_MAIL            0xEC    /* Mail */
#define DIK_MEDIASELECT     0xED    /* Media Select */

#define DIK_BACKSPACE       DIK_BACK            /* backspace */
#define DIK_NUMPADSTAR      DIK_MULTIPLY        /* * on numeric keypad */
#define DIK_LALT            DIK_LMENU           /* left Alt */
#define DIK_CAPSLOCK        DIK_CAPITAL         /* CapsLock */
#define DIK_NUMPADMINUS     DIK_SUBTRACT        /* - on numeric keypad */
#define DIK_NUMPADPLUS      DIK_ADD             /* + on numeric keypad */
#define DIK_NUMPADPERIOD    DIK_DECIMAL         /* . on numeric keypad */
#define DIK_NUMPADSLASH     DIK_DIVIDE          /* / on numeric keypad */
#define DIK_RALT            DIK_RMENU           /* right Alt */
#define DIK_UPARROW         DIK_UP              /* UpArrow on arrow keypad */
#define DIK_PGUP            DIK_PRIOR           /* PgUp on arrow keypad */
#define DIK_LEFTARROW       DIK_LEFT            /* LeftArrow on arrow keypad */
#define DIK_RIGHTARROW      DIK_RIGHT           /* RightArrow on arrow keypad */
#define DIK_DOWNARROW       DIK_DOWN            /* DownArrow on arrow keypad */
#define DIK_PGDN            DIK_NEXT            /* PgDn on arrow keypad */

#endif /* __DINPUT_INCLUDED__ */
@joncampbell123

This comment has been minimized.

Copy link
Owner

commented Feb 20, 2018

Thanks! I'll leave this open as well as a reminder to incorporate pdcurses into the source tree and VS2015 project files.

@bulletshot60

This comment has been minimized.

Copy link
Contributor Author

commented Feb 20, 2018

Just a heads up in case you didn't see that part of the comment amongst all the other documentation I left, the debugbox debugger is currently broken if you run it on the latest version of windows 10. (Vanilla DosBox has the same issue). You cannot step or scroll through memory / instructions. So might want to open a bug report for that.

@joncampbell123

This comment has been minimized.

Copy link
Owner

commented Feb 20, 2018

Perhaps the ncurses library for Windows has issues with returning the right codes for function keys and arrow keys?

@bulletshot60

This comment has been minimized.

Copy link
Contributor Author

commented Feb 20, 2018

I've been compiling with the DosBox recommended version of PDCurses. I'll try upping the version.

bulletshot60 added a commit to bulletshot60/dosbox-x that referenced this issue Feb 21, 2018

@bulletshot60

This comment has been minimized.

Copy link
Contributor Author

commented Feb 21, 2018

I included pdcurses 3.6 into the VS 2015 build. Tested on VS 2017 and the debugging issue with the fall creators update and dosbox appears to be resolved.

Building Dosbox-X with Visual Studio 2017

  1. Install VS 2017 (community edition is fine) ensuring that you install the default C++ Tools.
  2. Install Windows 8.1 SDK selecting all options.
  3. Install DirectX SDK (June 2010) selecting the default options.
  4. Open the .sln file in the vs2015 directory using VS 2017.
  5. Build all solutions. Note: You might need to restart after installing the above.
  6. Note that the exe will be put in the bin folder in the repository root.

joncampbell123 added a commit that referenced this issue Feb 21, 2018

Merge pull request #520 from bulletshot60/pdcurses-included
#515 include pdcurses 3.6 in the vs2015 build
@joncampbell123

This comment has been minimized.

Copy link
Owner

commented Feb 21, 2018

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.