Add MSVC 2010 project file and a make the project compile

This commit is contained in:
Thomas Bernard
2018-02-06 18:18:16 +01:00
parent ee1ec1a1b0
commit 6f48d7fefe
27 changed files with 678 additions and 19 deletions

View File

@@ -24,7 +24,7 @@
#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__)
#include <proto/dos.h>
#include <sys/types.h>
#elif defined(__WIN32__)
#elif defined(__WIN32__) || defined(WIN32)
#include <windows.h>
#endif
@@ -37,9 +37,19 @@
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#if !defined(_MSC_VER)
#include <strings.h>
#else
#if (_MSC_VER >= 1400)
#define strncasecmp _memicmp
#else
#define strncasecmp memicmp
#endif
#endif
#include <stdlib.h>
#if !defined(__VBCC__) && !defined(_MSC_VER)
#include <unistd.h>
#endif
#include <ctype.h>
#include <sys/stat.h>
#include <SDL.h>
@@ -81,7 +91,9 @@
#include <mint/sysbind.h>
#include <dirent.h>
#elif defined(__WIN32__)
#ifndef _MSC_VER
#include <dirent.h>
#endif
#include <windows.h>
#else
#include <dirent.h>

View File

@@ -38,6 +38,12 @@
#else
#include <limits.h> // for PATH_MAX
#endif
#ifndef PATH_MAX
#ifdef _MSC_VER
#include <windows.h>
#endif
#define PATH_MAX MAX_PATH
#endif
#ifndef M_2PI
#define M_2PI 6.28318530717958647692528676656 ///< Hmm, pie...

View File

@@ -26,6 +26,9 @@
#ifdef __VBCC__
#define __func__ "stupid compiler !"
#endif
#ifdef _MSC_VER
#define __func__ __FUNCTION__
#endif
/// Prints the source filename, line number, function name, a string and an integer.
#define DEBUG(y,z) printf("%s %d %s | %s : %d###\n",__FILE__,__LINE__,__func__,y,(unsigned int)z)

View File

@@ -41,11 +41,15 @@
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#ifdef _MSC_VER
#include <stdio.h>
#define snprintf _snprintf
#else
#include <strings.h>
#include <unistd.h>
#endif
#include <ctype.h>
#include <unistd.h>
#include <sys/types.h>
#include <unistd.h>
#include "const.h"
#include "struct.h"
@@ -97,12 +101,15 @@ byte Native_filesel(byte load)
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";
ofn.lpstrFilter = TEXT("Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0");
#ifdef UNICODE
#else
ofn.lpstrFile = szFileName;
#endif
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER;
if(load) ofn.Flags |= OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "txt";
ofn.lpstrDefExt = TEXT("txt");
if(load)
{
@@ -682,7 +689,7 @@ void Read_list_of_drives(T_Fileselector *list, byte name_length)
char drive_path[]="A:\\";
// Cette API Windows est étrange, je dois m'y faire...
drive_path[0]='A'+bit_index;
switch (GetDriveType(drive_path))
switch (GetDriveTypeA(drive_path))
{
case DRIVE_CDROM:
icon=ICON_CDROM;
@@ -1572,7 +1579,7 @@ byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context
else if (context->Type == CONTEXT_PALETTE)
Open_window(310,200,"Save palette");
else
assert(false);
assert(0);
Window_set_normal_button(198,180,51,14,"Save",0,1,SDLK_RETURN); // 1
if (Selector->Format_filter<=FORMAT_ALL_FILES) // Correction du *.*
{

1
src/gfx2.rc Normal file
View File

@@ -0,0 +1 @@
1 ICON "gfx2.ico"

View File

@@ -25,8 +25,11 @@
#include <stdio.h>
#include <string.h>
#if defined(__WIN32__)
#if defined(__WIN32__) || defined(WIN32)
#include <windows.h>
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
#elif defined(__macosx__) || defined(__FreeBSD__)
#include <sys/param.h>
#include <sys/mount.h>
@@ -61,6 +64,9 @@
extern char Program_version[]; // generated in pversion.c
extern char SVN_revision[]; // generated in pversion.c
#ifdef _MSC_VER//TODO TEMP
#define SVN_revision "MSC_0000"
#endif
// Recherche un raccourci clavier:
word * Shortcut(word shortcut_number)
@@ -785,7 +791,7 @@ void Button_Stats(void)
#if defined(__WIN32__)
{
ULARGE_INTEGER tailleU;
GetDiskFreeSpaceEx(Main.selector.Directory,&tailleU,NULL,NULL);
GetDiskFreeSpaceExA(Main.selector.Directory,&tailleU,NULL,NULL);
mem_size = tailleU.QuadPart;
}
#elif defined(__linux__) || defined(__macosx__) || defined(__FreeBSD__) || defined(__SYLLABLE__) || defined(__AROS__)

View File

@@ -23,7 +23,7 @@
#include "global.h"
#include "hotkeys.h"
#ifdef __VBCC__
#if defined(__VBCC__) || defined(_MSC_VER)
#define false 0
#define true 1
#endif

View File

@@ -26,7 +26,7 @@
/// The actual data is in hotkeys.c
//////////////////////////////////////////////////////////////////////////////
#if !defined(__VBCC__)
#if !defined(__VBCC__) && !defined(_MSC_VER)
#include <stdbool.h>
#else
#define bool char

View File

@@ -38,7 +38,7 @@
//#include <fcntl.h>
#include <string.h>
#ifndef __VBCC__
#if !defined(__VBCC__) && !defined(_MSC_VER)
#include <unistd.h>
#endif
@@ -58,6 +58,10 @@
#ifdef GRAFX2_CATCHES_SIGNALS
#include <signal.h>
#endif
#ifdef _MSC_VER
#include <stdio.h>
#define snprintf _snprintf
#endif
#include "buttons.h"
#include "const.h"

View File

@@ -30,14 +30,20 @@
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__)
#include <proto/dos.h>
#include <sys/types.h>
#include <dirent.h>
#elif defined(__WIN32__)
#ifdef _MSC_VER
#include <direct.h>
#else
#include <dirent.h>
#endif
#include <windows.h>
//#include <commdlg.h>
#elif defined(__MINT__)
@@ -297,6 +303,9 @@ int Directory_exists(char * directory)
// Détermine si un répertoire passé en paramètre existe ou non dans le
// répertoire courant.
{
#ifdef _MSC_VER // TODO
return 1;
#else
DIR* entry; // Structure de lecture des éléments
if (strcmp(directory,PARENT_DIR)==0)
@@ -315,6 +324,7 @@ int Directory_exists(char * directory)
return 1;
}
}
#endif
}
/// Check if a file or directory is hidden.
@@ -360,6 +370,8 @@ int File_length_file(FILE * file)
void For_each_file(const char * directory_name, void Callback(const char *, const char *))
{
#ifdef _MSC_VER
#else
// Pour scan de répertoire
DIR* current_directory; //Répertoire courant
struct dirent* entry; // Structure de lecture des éléments
@@ -389,11 +401,14 @@ void For_each_file(const char * directory_name, void Callback(const char *, cons
}
}
closedir(current_directory);
#endif
}
/// Scans a directory, calls Callback for each file or directory in it,
void For_each_directory_entry(const char * directory_name, void * pdata, T_File_dir_cb Callback)
{
#ifdef _MSC_VER // TODO !
#else
DIR* current_directory; // current directory
struct dirent* entry; // directory entry struct
char full_filename[MAX_PATH_CHARACTERS];
@@ -446,6 +461,7 @@ void For_each_directory_entry(const char * directory_name, void * pdata, T_File_
File_is_hidden(entry->d_name, full_filename));
}
closedir(current_directory);
#endif
}
@@ -491,7 +507,7 @@ byte Create_lock_file(const char *file_directory)
#ifdef __WIN32__
// Windowzy method for creating a lock file
Lock_file_handle = CreateFile(
Lock_file_handle = CreateFileA(
lock_filename,
GENERIC_WRITE,
0, // No sharing

View File

@@ -28,7 +28,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include <limits.h>
#include <SDL_image.h>
#include <SDL_endian.h>

View File

@@ -35,7 +35,9 @@
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include <SDL.h>
#include <SDL_image.h>

View File

@@ -23,7 +23,9 @@
*/
#include <SDL.h>
#include <string.h>
#ifndef _MSC_VER
#include <strings.h>
#endif
#include <stdlib.h>
#include <math.h>
#include "struct.h"

View File

@@ -20,7 +20,7 @@
*/
// This file is not used on some platforms, so don't do anything for them
#if(!defined(__WIN32__))&&(!defined(__amigaos4__))&&(!defined(__AROS__))&&(!defined(__MORPHOS__))&&(!defined(__amigaos__))
#if(!(defined(__WIN32__)||defined(WIN32)))&&(!defined(__amigaos4__))&&(!defined(__AROS__))&&(!defined(__MORPHOS__))&&(!defined(__amigaos__))
// We don't use autoconf and all that in grafx2, so let's do the config here ...
#if defined(__macosx__) || defined(__FreeBSD__) || defined(__OpenBSD__) // MacOS X is POSIX compliant
@@ -63,7 +63,9 @@
#include <fcntl.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#if HAVE_SYS_PARAM_H
# include <sys/param.h>

View File

@@ -28,8 +28,8 @@
#ifndef MOUNTLIST_H_
# define MOUNTLIST_H_
#if !defined(__VBCC__)
# include <stdbool.h>
#if !defined(__VBCC__) && !defined(_MSC_VER)
#include <stdbool.h>
#else
#define bool char
#endif

View File

@@ -22,7 +22,9 @@
*/
#include <SDL.h>
#include <string.h>
#ifndef _MSC_VER
#include <strings.h>
#endif
#include <stdlib.h>
#include <math.h>
#include "struct.h"

View File

@@ -21,7 +21,9 @@
along with Grafx2; if not, see <http://www.gnu.org/licenses/>
*/
#include <assert.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

View File

@@ -47,6 +47,7 @@
#ifdef __WIN32__
#include <windows.h>
#include <SDL_syswm.h>
#elif defined __HAIKU__
#include "haiku.h"
#elif defined(__AROS__)
@@ -57,6 +58,11 @@
#include <SDL_screenkeyboard.h>
#endif
#ifdef _MSC_VER
#include <stdio.h>
#define snprintf _snprintf
#endif
// Virtual keyboard is ON by default on these platforms:
#if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) || defined(GCWZERO)
#define VIRT_KEY_DEFAULT_ON 1

View File

@@ -8,7 +8,9 @@
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#if defined(__AROS__) || defined(__linux__) || defined(__GLIBC__)|| defined(__MINT__) || defined(__FreeBSD__)
#include <limits.h>
#endif
@@ -114,7 +116,7 @@
return resolved_path;
}
#elif defined (__WIN32__)
#elif defined(__WIN32__) || defined(WIN32)
// Mingw has a working equivalent. It only has reversed arguments.
char *Realpath(const char *_path, char *resolved_path)
{

View File

@@ -29,9 +29,12 @@
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#if defined(__WIN32__)
#if defined(__WIN32__) || defined(WIN32)
#include <windows.h>
#include <io.h> // Mingw's _mkdir()
#ifdef _MSC_VER
#include <direct.h>
#endif
#elif defined(__macosx__)
#import <corefoundation/corefoundation.h>
#import <sys/param.h>
@@ -58,7 +61,7 @@
int Create_ConfigDirectory(char * config_dir)
{
#ifdef __WIN32__
#if defined(__WIN32__) || defined(WIN32)
// Mingw's mkdir has a weird name and only one argument
return _mkdir(config_dir);
#else

View File

@@ -50,6 +50,11 @@
#import <sys/param.h>
#endif
#ifdef _MSC_VER
#include <stdio.h>
#define snprintf _snprintf
#endif
#include <SDL_image.h>
#include "SFont.h"

View File

@@ -29,6 +29,11 @@
#include <stdlib.h> // atoi()
#include <string.h> // strncpy() strlen()
#ifdef _MSC_VER
#include <stdio.h>
#define snprintf _snprintf
#endif
#include "windows.h"
#include "engine.h"
@@ -1437,6 +1442,7 @@ void Warning_with_format(const char *template, ...) {
va_start(arg_ptr, template);
vsnprintf(message, sizeof(message), template, arg_ptr);
Verbose_message("Warning", message);
va_end(arg_ptr);
}