137 Commits

Author SHA1 Message Date
Adrien Destugues
32ec828835 Group all copyright statements in a single file.
This gives a much clearer overview of the licensing.

It also shows there are some problems:
- Some files are under GPLv3 only
- Some files have no known license at all.
2020-12-19 21:56:33 +00:00
Jordan Christiansen
ff7e5c9ee2 Prevent a file path buffer overrun
If a filename passed from the command line arguments is ever longer than
the current working directory (and it usually is longer), strcpy will
overrun the working directory buffer. This usually doesn't cause a crash
right away, but it caused weird bugs for me, like an assertion failure
in free() when trying to free the buffer later:

    free(): invalid next size (fast)

Valgrind helped me track down the cause:

    $ valgrind bin/grafx2-sdl ~/Projects/kind-of-longish-directory-name/file.gif

    ...

    ==116375== Invalid write of size 1
    ==116375==    at 0x483DDE6: strcpy (vg_replace_strmem.c:511)
    ==116375==    by 0x1265B2: Init_program (main.c:1104)
    ==116375==    by 0x12704F: main (main.c:1536)
    ==116375==  Address 0x5534a81 is 21 bytes after a block of size 28 alloc'd
    ==116375==    at 0x483CD7B: realloc (vg_replace_malloc.c:834)
    ==116375==    by 0x4E70F3F: getcwd (in /usr/lib/libc-2.32.so)
    ==116375==    by 0x17277E: Get_current_directory (io.c:1096)
    ==116375==    by 0x125B02: Init_program (main.c:655)
    ==116375==    by 0x12704F: main (main.c:1536)
2020-12-15 12:25:15 -06:00
Thomas Bernard
100776eca7
Win32 debug: show OEM Code Page as well 2020-12-13 19:17:35 +01:00
Thomas Bernard
7de6a95291
SDL2: restore window position on startup 2020-12-10 00:13:40 +01:00
Thomas Bernard
e2ff6fd441
improve gfx2.ini is corrupt message 2020-06-20 15:41:36 +02:00
Thomas Bernard
b0f1117bbc
GFX2_MessageBox()
Especially useful to display startup errors
2020-05-05 21:39:20 +02:00
Thomas Bernard
80ff6f7dfd
update help urls 2020-05-05 21:36:04 +02:00
Thomas Bernard
2c9b79a6af
Warning() => GFX2_Log(GFX2_WARNING) 2020-04-13 01:34:12 +02:00
Thomas Bernard
d5953ad51a
move some functions from loadsave.c to loadsavefuncs.c 2019-11-09 02:42:33 +01:00
Thomas Bernard
2892f0330f
fix call to SDL_JoystickName() with SDL 1.2
SDL 1.2 :
const char *SDL_JoystickName(int index);

SDL 2.0 :
const char* SDL_JoystickName(SDL_Joystick* joystick);
2019-07-25 00:04:41 +02:00
Thomas Bernard
5a292d744e fix wrong allocation size
fix bug introduced in d287d557106677ef0da052106d6b0cc5a001589a
2019-05-28 16:02:44 +02:00
Thomas Bernard
537334f327
win32: silent 2 warnings 2019-05-24 10:55:00 +02:00
Thomas Bernard
d287d55710
do not use MAX_PATH anymore in main.c 2019-05-24 10:43:39 +02:00
Thomas Bernard
fdb317ebdf
fix retrieval of program path for MinGW builds without sdl
force usage of "W" functions when not compiled with -DUNICODE
2019-05-23 11:42:25 +02:00
Thomas Bernard
2d645edbc0 win32: save the "not maximized" window size
also fix the window start up position

see http://pulkomandy.tk/projects/GrafX2/ticket/102
2019-05-21 20:45:21 +02:00
Thomas Bernard
01c67739d1
Add debug output 2019-05-16 11:52:37 +02:00
Thomas Bernard
450d5f06a4
Allow Analyze_command_line() to be executed earlier 2019-05-16 11:51:07 +02:00
Thomas Bernard
c051ac2189
use GFX2_malloc() to log allocation errors
also check malloc() return more often
2019-05-07 17:25:18 +02:00
Thomas Bernard
7f78f3ec72
Win32: open a console for debugging when -v option is passed 2019-05-07 17:25:18 +02:00
Thomas Bernard
7d5f287737
Change Selector_filename to Selector->filename 2019-05-07 17:25:17 +02:00
Thomas Bernard
79446a9c72
get rid of MAX_PATH_CHARACTERS in T_Page and T_Selector_Settings
strdup() the dynammicaly allocated filename and directory strings
2019-05-07 17:25:17 +02:00
Thomas Bernard
c6781cd7cd
Brush_file_directory, Brush_filename, Brush_filename_unicode are no longer static strings 2019-05-07 17:25:17 +02:00
Thomas Bernard
8f0d036fe1
remove big static strings in Init_Program() 2019-05-07 17:25:05 +02:00
Thomas Bernard
75c93b0ce4
Get_unicode_filename() can malloc() the return string 2019-05-07 17:25:05 +02:00
Thomas Bernard
f90a2331dd
Scripts_directory is now dynamically allocated 2019-05-07 17:25:05 +02:00
Thomas Bernard
f5cc3a0aba
Remove some static length strings
There are too many MAX_PATH_CHARACTERS length string.
make Initial_directory, Data_directory, Config_directory
dynamically allocated.
2019-05-07 17:04:45 +02:00
Romain Graillot
d36e59ca9c Add Nintendo Switch support (including gitlab-ci, gitlab-pages etc.) 2019-04-28 11:18:23 +02:00
Thomas Bernard
609eb7061d
minor 2019-03-09 15:15:17 +01:00
Thomas Bernard
01c16b488d
Log info about Joysticks 2019-02-21 09:51:03 +01:00
Thomas Bernard
508b2ef3f5
Set mouse cursor at the center of the screen at start 2019-02-20 13:56:01 +01:00
Thomas Bernard
bf16f3fe7d Atari: Exit_handler 2019-02-09 04:10:36 +01:00
Thomas Bernard
08b2448e33
Do not need SDL Joystick module unless built with USE_JOYSTICK 2019-01-28 11:54:40 +01:00
Nic Soudée
228e651b4f Correct some spelling mistakes
Automaticaly --> Automatically
Invalide --> Invalid
Strech --> Stretch
allows to --> allows one to
attachement --> attachment
contraints --> constraints
inconsistant --> inconsistent
occured --> occurred
occurences --> occurrences
permits to --> permits one to
postion --> position
regularily --> regularly
transfered --> transferred
2019-01-24 08:32:58 -05:00
Thomas Bernard
8372736c98
fix compilation of Init_program() 2019-01-20 22:15:31 +01:00
Thomas Bernard
e68c16dd34 move Get_unicode_filename() to io.c. correclty select last directory in
filesel
2018-12-19 14:03:30 +01:00
Thomas Bernard
b706566f57 WIN32: get Unicode filename of Dropped files 2018-12-18 17:52:28 +01:00
Thomas Bernard
c81ffb0d6e
Automatically set Drawing mode when loading Thomson, C64 and Apple 2 files 2018-12-11 12:25:39 +01:00
Thomas Bernard
ec4ad8adb2
Load "default.pal" at startup 2018-12-09 22:03:47 +01:00
Thomas Bernard
b2f310d1d5 Make Light_color/Dark_color ini settings work
see http://pulkomandy.tk/projects/GrafX2/ticket/81

I don't know why they were disabled...
2018-12-08 18:32:48 +01:00
Thomas Bernard
878568c7f5
round() is not available in old MSVC++ versions 2018-11-28 23:02:11 +01:00
Thomas Bernard
a880045aba
minor things
- link to HTML version of inline help
- fix type in Test_C64()
- remove extra spaces at end of line
2018-11-22 10:19:58 +01:00
Thomas Bernard
50f3b99106 store unicode filename for brush 2018-11-09 12:50:45 +01:00
Thomas Bernard
725da6307e
Remove warnings with GCC 7
GCC 7 introduced a new warning in switch() statements :
warning: this statement may fall through [-Wimplicit-fallthrough=]
2018-10-17 16:42:54 +02:00
Thomas Bernard
65c761345f fix: MSVC defines _DEBUG, not DEBUG 2018-09-16 00:23:13 +02:00
Nic Soudée
0953bc1f9b Fix bug in -help video mode listing
The mode_index is being incremented by 12, but we are
only displaying 6 video modes per line. This results in
the "Available video modes" listing to ignore half of the
valid video modes.
2018-08-16 09:15:57 -04:00
Nic Soudée
78d99fd337 Move command line analysis down a bit
This is necessary so that the list of available video modes
is populated, making the -mode parameter work again.
2018-08-16 09:14:33 -04:00
Thomas Bernard
72972a8b49 doxygen comments in main.c.
Includes the mainpage section
2018-07-27 14:29:25 +02:00
Thomas Bernard
715bda292b silence a warning 2018-07-20 12:27:58 +02:00
Thomas Bernard
05d6a4b3dd properly handle long filenames of preloade files 2018-07-16 14:39:25 +02:00
Thomas Bernard
4978a7cfe2 convert Warning() and DEBUG() to GFX2_Log() 2018-07-12 20:41:49 +02:00