added cSDL_LogToFile() function

This commit is contained in:
Sylvain PILLOT 2022-05-03 21:51:35 +02:00
parent 96e71f5395
commit de4776e7de
8 changed files with 282 additions and 274 deletions

View File

@ -17,41 +17,46 @@
<Unit filename="README.md" />
<Unit filename="TODO.txt" />
<Unit filename="cSDL1_2_15.layout" />
<Unit filename="include/SDL.h" />
<Unit filename="include/SDL_active.h" />
<Unit filename="include/SDL_audio.h" />
<Unit filename="include/SDL_byteorder.h" />
<Unit filename="include/SDL_cdrom.h" />
<Unit filename="include/SDL_config.h" />
<Unit filename="include/SDL_config_minimal.h" />
<Unit filename="include/SDL_config_prizm.h" />
<Unit filename="include/SDL_copying.h" />
<Unit filename="include/SDL_cpuinfo.h" />
<Unit filename="include/SDL_endian.h" />
<Unit filename="include/SDL_error.h" />
<Unit filename="include/SDL_events.h" />
<Unit filename="include/SDL_getenv.h" />
<Unit filename="include/SDL_joystick.h" />
<Unit filename="include/SDL_keyboard.h" />
<Unit filename="include/SDL_keysym.h" />
<Unit filename="include/SDL_loadso.h" />
<Unit filename="include/SDL_main.h" />
<Unit filename="include/SDL_mouse.h" />
<Unit filename="include/SDL_mutex.h" />
<Unit filename="include/SDL_name.h" />
<Unit filename="include/SDL_opengl.h" />
<Unit filename="include/SDL_platform.h" />
<Unit filename="include/SDL_quit.h" />
<Unit filename="include/SDL_rwops.h" />
<Unit filename="include/SDL_stdinc.h" />
<Unit filename="include/SDL_syswm.h" />
<Unit filename="include/SDL_thread.h" />
<Unit filename="include/SDL_timer.h" />
<Unit filename="include/SDL_types.h" />
<Unit filename="include/SDL_version.h" />
<Unit filename="include/SDL_video.h" />
<Unit filename="include/begin_code.h" />
<Unit filename="include/close_code.h" />
<Unit filename="include/SDL/SDL.h" />
<Unit filename="include/SDL/SDL_active.h" />
<Unit filename="include/SDL/SDL_audio.h" />
<Unit filename="include/SDL/SDL_byteorder.h" />
<Unit filename="include/SDL/SDL_cdrom.h" />
<Unit filename="include/SDL/SDL_config_minimal.h" />
<Unit filename="include/SDL/SDL_config_prizm.h" />
<Unit filename="include/SDL/SDL_copying.h" />
<Unit filename="include/SDL/SDL_cpuinfo.h" />
<Unit filename="include/SDL/SDL_endian.h" />
<Unit filename="include/SDL/SDL_error.h" />
<Unit filename="include/SDL/SDL_events.h" />
<Unit filename="include/SDL/SDL_framerate.h" />
<Unit filename="include/SDL/SDL_getenv.h" />
<Unit filename="include/SDL/SDL_gfxBlitFunc.h" />
<Unit filename="include/SDL/SDL_gfxPrimitives.h" />
<Unit filename="include/SDL/SDL_gfxPrimitives_font.h" />
<Unit filename="include/SDL/SDL_imageFilter.h" />
<Unit filename="include/SDL/SDL_joystick.h" />
<Unit filename="include/SDL/SDL_keyboard.h" />
<Unit filename="include/SDL/SDL_keysym.h" />
<Unit filename="include/SDL/SDL_loadso.h" />
<Unit filename="include/SDL/SDL_main.h" />
<Unit filename="include/SDL/SDL_mouse.h" />
<Unit filename="include/SDL/SDL_mutex.h" />
<Unit filename="include/SDL/SDL_name.h" />
<Unit filename="include/SDL/SDL_opengl.h" />
<Unit filename="include/SDL/SDL_platform.h" />
<Unit filename="include/SDL/SDL_quit.h" />
<Unit filename="include/SDL/SDL_rotozoom.h" />
<Unit filename="include/SDL/SDL_rwops.h" />
<Unit filename="include/SDL/SDL_stdinc.h" />
<Unit filename="include/SDL/SDL_syswm.h" />
<Unit filename="include/SDL/SDL_thread.h" />
<Unit filename="include/SDL/SDL_timer.h" />
<Unit filename="include/SDL/SDL_types.h" />
<Unit filename="include/SDL/SDL_version.h" />
<Unit filename="include/SDL/SDL_video.h" />
<Unit filename="include/SDL/begin_code.h" />
<Unit filename="include/SDL/close_code.h" />
<Unit filename="include/doxyfile" />
<Unit filename="src/SDL.c">
<Option compilerVar="CC" />

View File

@ -2,12 +2,22 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="src/video/prizm/SDL_prizmevents_c.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/events/SDL_keyboard.c" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1473" topLine="13" />
<Cursor1 position="14509" topLine="194" />
</Cursor>
<Folding>
<Collapse line="41" />
<Collapse line="58" />
<Collapse line="337" />
<Collapse line="342" />
<Collapse line="357" />
<Collapse line="368" />
<Collapse line="374" />
<Collapse line="378" />
<Collapse line="383" />
<Collapse line="573" />
<Collapse line="596" />
<Collapse line="609" />
</Folding>
</File>
<File name="src/video/prizm/SDL_prizmnti.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -18,27 +28,82 @@
<Collapse line="5" />
</Folding>
</File>
<File name="src/events/SDL_events_c.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/file/SDL_rwops.c" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="55" />
</Cursor>
</File>
<File name="src/video/SDL_bmp.c" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2950" topLine="72" />
<Cursor1 position="11060" topLine="43" />
</Cursor>
<Folding>
<Collapse line="415" />
<Collapse line="48" />
<Collapse line="186" />
<Collapse line="222" />
<Collapse line="269" />
<Collapse line="301" />
<Collapse line="323" />
<Collapse line="334" />
<Collapse line="379" />
<Collapse line="406" />
<Collapse line="426" />
<Collapse line="435" />
<Collapse line="440" />
<Collapse line="451" />
<Collapse line="456" />
<Collapse line="495" />
<Collapse line="544" />
<Collapse line="561" />
<Collapse line="578" />
<Collapse line="595" />
<Collapse line="606" />
<Collapse line="613" />
<Collapse line="620" />
<Collapse line="627" />
<Collapse line="634" />
<Collapse line="641" />
<Collapse line="648" />
<Collapse line="656" />
<Collapse line="661" />
<Collapse line="666" />
<Collapse line="671" />
<Collapse line="676" />
<Collapse line="681" />
</Folding>
</File>
<File name="include/SDL_stdinc.h" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/video/prizm/SDL_prizmevents.c" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2433" topLine="65" />
<Cursor1 position="6421" topLine="150" />
</Cursor>
</File>
<File name="src/SDL.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/video/prizm/SDL_prizmevents_c.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1394" topLine="78" />
<Cursor1 position="1473" topLine="13" />
</Cursor>
<Folding>
<Collapse line="41" />
</Folding>
</File>
<File name="src/timer/SDL_timer_c.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="9" />
</Cursor>
</File>
<File name="src/video/SDL_video.c" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="29549" topLine="860" />
</Cursor>
<Folding>
<Collapse line="156" />
<Collapse line="1047" />
<Collapse line="1051" />
<Collapse line="1113" />
</Folding>
</File>
<File name="src/events/SDL_sysevents.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="src/video/SDL_sysvideo.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="12039" topLine="392" />
</Cursor>
</File>
<File name="src/video/SDL_surface.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -46,6 +111,78 @@
<Cursor1 position="14589" topLine="710" />
</Cursor>
</File>
<File name="src/events/SDL_events.c" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2769" topLine="6" />
</Cursor>
</File>
<File name="src/events/SDL_events_c.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="55" />
</Cursor>
</File>
<File name="src/stdlib/SDL_string.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7025" topLine="273" />
</Cursor>
</File>
<File name="Makefile.prizm" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="694" topLine="22" />
</Cursor>
</File>
<File name="include/SDL/begin_code.h" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1813" topLine="57" />
</Cursor>
</File>
<File name="src/video/prizm/SDL_prizmutils.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="307" topLine="0" />
</Cursor>
</File>
<File name="src/video/prizm/SDL_prizmvideo.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="11" />
</Cursor>
</File>
<File name="src/SDL.c" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1251" topLine="33" />
</Cursor>
</File>
<File name="src/video/SDL_blit_N.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="153" />
</Cursor>
</File>
<File name="src/video/SDL_blit.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1552" topLine="468" />
</Cursor>
</File>
<File name="src/video/prizm/SDL_prizmfonts.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="86166" topLine="0" />
</Cursor>
<Folding>
<Collapse line="8" />
<Collapse line="268" />
<Collapse line="528" />
<Collapse line="788" />
<Collapse line="1048" />
</Folding>
</File>
<File name="src/timer/SDL_systimer.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1134" topLine="3" />
</Cursor>
</File>
<File name="src/video/prizm/SDL_prizmvideo.c" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6352" topLine="195" />
</Cursor>
</File>
<File name="src/video/SDL_pixels.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="8603" topLine="83" />
@ -76,195 +213,17 @@
<Collapse line="617" />
</Folding>
</File>
<File name="src/timer/SDL_systimer.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/video/SDL_bmp.c" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1134" topLine="3" />
</Cursor>
</File>
<File name="src/events/SDL_keyboard.c" open="1" top="1" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="14509" topLine="194" />
<Cursor1 position="2950" topLine="72" />
</Cursor>
<Folding>
<Collapse line="58" />
<Collapse line="337" />
<Collapse line="342" />
<Collapse line="357" />
<Collapse line="368" />
<Collapse line="374" />
<Collapse line="378" />
<Collapse line="383" />
<Collapse line="573" />
<Collapse line="596" />
<Collapse line="609" />
<Collapse line="415" />
</Folding>
</File>
<File name="src/video/prizm/SDL_prizmvideo.c" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="include/SDL/SDL_rwops.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6352" topLine="195" />
</Cursor>
</File>
<File name="include/SDL_endian.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3019" topLine="87" />
</Cursor>
</File>
<File name="src/file/SDL_rwops.c" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="17253" topLine="108" />
</Cursor>
<Folding>
<Collapse line="48" />
<Collapse line="186" />
<Collapse line="222" />
<Collapse line="269" />
<Collapse line="301" />
<Collapse line="323" />
<Collapse line="332" />
<Collapse line="342" />
<Collapse line="352" />
<Collapse line="367" />
<Collapse line="394" />
<Collapse line="414" />
<Collapse line="423" />
<Collapse line="428" />
<Collapse line="439" />
<Collapse line="444" />
<Collapse line="483" />
<Collapse line="532" />
<Collapse line="549" />
<Collapse line="566" />
<Collapse line="583" />
<Collapse line="594" />
<Collapse line="608" />
<Collapse line="615" />
<Collapse line="622" />
<Collapse line="629" />
<Collapse line="636" />
<Collapse line="644" />
<Collapse line="649" />
<Collapse line="654" />
<Collapse line="659" />
<Collapse line="664" />
<Collapse line="669" />
</Folding>
</File>
<File name="src/video/SDL_video.c" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="29549" topLine="860" />
</Cursor>
<Folding>
<Collapse line="156" />
<Collapse line="1047" />
<Collapse line="1051" />
<Collapse line="1113" />
</Folding>
</File>
<File name="include/SDL_timer.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="21" />
</Cursor>
</File>
<File name="include/SDL_keyboard.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3548" topLine="100" />
</Cursor>
</File>
<File name="Makefile.prizm" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1235" topLine="26" />
</Cursor>
</File>
<File name="src/video/prizm/SDL_prizmfonts.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="113" topLine="2" />
</Cursor>
</File>
<File name="src/SDL_error.c" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1517" topLine="48" />
</Cursor>
</File>
<File name="src/video/prizm/SDL_prizmvideo.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="11" />
</Cursor>
</File>
<File name="src/video/prizm/SDL_prizmevents.c" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="6421" topLine="150" />
</Cursor>
</File>
<File name="src/stdlib/SDL_string.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7025" topLine="273" />
</Cursor>
</File>
<File name="src/events/SDL_sysevents.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="src/events/SDL_events.c" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2769" topLine="6" />
</Cursor>
</File>
<File name="include/SDL_video.h" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="8865" topLine="271" />
</Cursor>
</File>
<File name="include/SDL_keysym.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="9028" topLine="337" />
</Cursor>
</File>
<File name="include/SDL_config_prizm.h" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2856" topLine="91" />
</Cursor>
</File>
<File name="src/video/SDL_blit.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1552" topLine="468" />
</Cursor>
</File>
<File name="src/video/SDL_blit_N.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="153" />
</Cursor>
</File>
<File name="include/SDL_error.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1459" topLine="47" />
</Cursor>
</File>
<File name="include/SDL_config.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1297" topLine="15" />
</Cursor>
</File>
<File name="src/video/prizm/SDL_prizmfonts.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="86166" topLine="0" />
</Cursor>
<Folding>
<Collapse line="8" />
<Collapse line="268" />
<Collapse line="528" />
<Collapse line="788" />
<Collapse line="1048" />
</Folding>
</File>
<File name="src/timer/prizm/SDL_systimer.c" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="4" zoom_2="0">
<Cursor>
<Cursor1 position="1839" topLine="63" />
</Cursor>
</File>
<File name="src/video/SDL_sysvideo.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="12039" topLine="392" />
<Cursor1 position="3257" topLine="102" />
</Cursor>
</File>
<File name="src/video/SDL_blit_0.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -286,14 +245,23 @@
<Collapse line="443" />
</Folding>
</File>
<File name="src/video/prizm/SDL_prizmutils.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/SDL_error.c" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="307" topLine="0" />
<Cursor1 position="1176" topLine="0" />
</Cursor>
<Folding>
<Collapse line="50" />
<Collapse line="118" />
</Folding>
</File>
<File name="src/timer/prizm/SDL_systimer.c" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="4" zoom_2="0">
<Cursor>
<Cursor1 position="1839" topLine="63" />
</Cursor>
</File>
<File name="src/timer/SDL_timer_c.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/video/prizm/SDL_prizmfonts.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="9" />
<Cursor1 position="113" topLine="2" />
</Cursor>
</File>
</CodeBlocks_layout_file>

View File

@ -87,6 +87,8 @@ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
*/
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
extern DECLSPEC void SDLCALL cSDL_LogToFile(const char *fmt, ... );
/** This function cleans up all initialized subsystems and unloads the
* dynamically linked library. You should call it upon all exit conditions.
*/

View File

@ -74,7 +74,7 @@ typedef struct SDL_RWops {
} buffer;
} win32io;
#endif
#ifdef HAVE_STDIO_H
#ifdef HAVE_STDIO_H
struct {
int autoclose;
FILE *fp;
@ -120,10 +120,10 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area);
/** @name Macros to easily read and write from an SDL_RWops structure */
/*@{*/
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
#define SDL_RWclose(ctx) (ctx)->close(ctx)
#define SDL_RWclose(ctx) (ctx)->close(ctx)
/*@}*/
/** @name Read an item of the specified endianness and return in native format */

View File

@ -25,7 +25,7 @@
#define FXCG50 1
#include "SDL_platform.h"
#include "SDL/SDL_platform.h"
@ -45,7 +45,7 @@
/// Added a config_file for Casio fx-CG10/20/50/PRIZM/Graph 90+E
#elif defined(__CASIOPRIZM__)
#include "SDL_config_prizm.h"
#include "SDL/SDL_config_prizm.h"
#else
#include "SDL_config_minimal.h"

View File

@ -23,7 +23,7 @@
/* Initialization code for SDL */
#include "SDL.h"
#include "SDL/SDL.h"
#include "SDL_fatal.h"
#if !SDL_VIDEO_DISABLED
#include "video/SDL_leaks.h"
@ -33,6 +33,27 @@
#include <pth.h>
#endif
#include <gint/gint.h>
#include <stdarg.h>
#include <stdio.h>
void cSDL_LogToFile(const char *fmt, ... )
{
FILE * fp = fopen( "OutLog.txt", "a" );
if (fp==NULL) return;
va_list args;
va_start( args, fmt );
vfprintf( fp, fmt, args );
fprintf( fp, "\n");
va_end( args );
fclose( fp );
}
/* Initialization/Cleanup routines */
#if !SDL_JOYSTICK_DISABLED
extern int SDL_JoystickInit(void);
@ -49,7 +70,7 @@ extern void SDL_TimerQuit(void);
#endif
/* The current SDL version */
static SDL_version version =
static SDL_version version =
{ SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL };
/* The initialized subsystems */
@ -228,7 +249,7 @@ void SDL_Quit(void)
/* Print the number of surfaces not freed */
if ( surfaces_allocated != 0 ) {
fprintf(stderr, "SDL Warning: %d SDL surfaces extant\n",
fprintf(stderr, "SDL Warning: %d SDL surfaces extant\n",
surfaces_allocated);
}
#endif
@ -332,8 +353,8 @@ unsigned _System LibMain(unsigned hmod, unsigned termination)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
BOOL APIENTRY _DllMainCRTStartup( HANDLE hModule,
DWORD ul_reason_for_call,
BOOL APIENTRY _DllMainCRTStartup( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved )
{
switch (ul_reason_for_call) {

View File

@ -23,7 +23,7 @@
/* Simple error handling in SDL */
#include "SDL_error.h"
#include "SDL/SDL_error.h"
#include "SDL_error_c.h"
/* Routine to get the thread-specific error variable */

View File

@ -27,13 +27,13 @@
#include "SDL_endian.h"
#include "SDL_rwops.h"
#include "SDL/SDL.h"
#if defined(__WIN32__) && !defined(__SYMBIAN32__)
/* Functions to read/write Win32 API file pointers */
/* Will not use it on WinCE because stdio is buffered, it means
faster, and all stdio functions anyway are embedded in coredll.dll -
faster, and all stdio functions anyway are embedded in coredll.dll -
the main wince dll*/
#define WINDOWS_LEAN_AND_MEAN
@ -57,7 +57,7 @@ static int SDLCALL win32_file_open(SDL_RWops *context, const char *filename, con
if (!context)
return -1; /* failed (invalid call) */
context->hidden.win32io.h = INVALID_HANDLE_VALUE; /* mark this as unusable */
context->hidden.win32io.buffer.data = NULL;
context->hidden.win32io.buffer.size = 0;
@ -69,7 +69,7 @@ static int SDLCALL win32_file_open(SDL_RWops *context, const char *filename, con
/* "a" = writing, append file may not exist */
/* "a+"= append + read, file may not exist */
/* "w+" = read, write, truncate. file may not exist */
must_exist = ( SDL_strchr(mode,'r') != NULL ) ? OPEN_EXISTING : 0;
truncate = ( SDL_strchr(mode,'w') != NULL ) ? CREATE_ALWAYS : 0;
r_right = ( SDL_strchr(mode,'+') != NULL || must_exist ) ? GENERIC_READ : 0;
@ -97,7 +97,7 @@ static int SDLCALL win32_file_open(SDL_RWops *context, const char *filename, con
SDL_SetError("Unable to convert filename to Unicode");
return -1;
}
h = CreateFile(filenameW, (w_right|r_right), (w_right)? 0 : FILE_SHARE_READ,
h = CreateFile(filenameW, (w_right|r_right), (w_right)? 0 : FILE_SHARE_READ,
NULL, (must_exist|truncate|a_mode), FILE_ATTRIBUTE_NORMAL,NULL);
SDL_stack_free(filenameW);
}
@ -187,7 +187,7 @@ static int SDLCALL win32_file_seek(SDL_RWops *context, int offset, int whence)
{
DWORD win32whence;
int file_pos;
if (!context || context->hidden.win32io.h == INVALID_HANDLE_VALUE) {
SDL_SetError("win32_file_seek: invalid context/file not opened");
return -1;
@ -200,14 +200,14 @@ static int SDLCALL win32_file_seek(SDL_RWops *context, int offset, int whence)
context->hidden.win32io.buffer.left = 0;
switch (whence) {
case RW_SEEK_SET:
case RW_SEEK_SET:
win32whence = FILE_BEGIN; break;
case RW_SEEK_CUR:
win32whence = FILE_CURRENT; break;
case RW_SEEK_END:
win32whence = FILE_END; break;
default:
SDL_SetError("win32_file_seek: Unknown value for 'whence'");
SDL_SetError("win32_file_seek: Unknown value for 'whence'");
return -1;
}
@ -215,27 +215,27 @@ static int SDLCALL win32_file_seek(SDL_RWops *context, int offset, int whence)
if ( file_pos != INVALID_SET_FILE_POINTER )
return file_pos; /* success */
SDL_Error(SDL_EFSEEK);
return -1; /* error */
}
static int SDLCALL win32_file_read(SDL_RWops *context, void *ptr, int size, int maxnum)
{
int total_need;
int total_read = 0;
int total_need;
int total_read = 0;
int read_ahead;
DWORD byte_read;
total_need = size*maxnum;
if (!context || context->hidden.win32io.h == INVALID_HANDLE_VALUE || total_need<=0 || !size)
if (!context || context->hidden.win32io.h == INVALID_HANDLE_VALUE || total_need<=0 || !size)
return 0;
if (context->hidden.win32io.buffer.left > 0) {
void *data = (char *)context->hidden.win32io.buffer.data +
context->hidden.win32io.buffer.size -
context->hidden.win32io.buffer.left;
read_ahead = SDL_min(total_need, context->hidden.win32io.buffer.left);
read_ahead = SDL_min(total_need, context->hidden.win32io.buffer.left);
SDL_memcpy(ptr, data, read_ahead);
context->hidden.win32io.buffer.left -= read_ahead;
@ -243,7 +243,7 @@ static int SDLCALL win32_file_read(SDL_RWops *context, void *ptr, int size, int
return maxnum;
}
ptr = (char *)ptr + read_ahead;
total_need -= read_ahead;
total_need -= read_ahead;
total_read += read_ahead;
}
@ -268,13 +268,13 @@ static int SDLCALL win32_file_read(SDL_RWops *context, void *ptr, int size, int
}
static int SDLCALL win32_file_write(SDL_RWops *context, const void *ptr, int size, int num)
{
int total_bytes;
int total_bytes;
DWORD byte_written,nwritten;
total_bytes = size*num;
if (!context || context->hidden.win32io.h==INVALID_HANDLE_VALUE || total_bytes<=0 || !size)
if (!context || context->hidden.win32io.h==INVALID_HANDLE_VALUE || total_bytes<=0 || !size)
return 0;
if (context->hidden.win32io.buffer.left) {
@ -289,19 +289,19 @@ static int SDLCALL win32_file_write(SDL_RWops *context, const void *ptr, int siz
return 0;
}
}
if (!WriteFile(context->hidden.win32io.h,ptr,total_bytes,&byte_written,NULL)) {
SDL_Error(SDL_EFWRITE);
return 0;
}
nwritten = byte_written/size;
return nwritten;
}
static int SDLCALL win32_file_close(SDL_RWops *context)
{
if ( context ) {
if ( context ) {
if (context->hidden.win32io.h != INVALID_HANDLE_VALUE) {
CloseHandle(context->hidden.win32io.h);
context->hidden.win32io.h = INVALID_HANDLE_VALUE; /* to be sure */
@ -322,6 +322,8 @@ static int SDLCALL win32_file_close(SDL_RWops *context)
static int SDLCALL stdio_seek(SDL_RWops *context, int offset, int whence)
{
///cSDL_LogToFile( "je suis dans stdio_seek" );
if ( fseek(context->hidden.stdio.fp, offset, whence) == 0 ) {
return(ftell(context->hidden.stdio.fp));
} else {
@ -331,26 +333,36 @@ static int SDLCALL stdio_seek(SDL_RWops *context, int offset, int whence)
}
static int SDLCALL stdio_read(SDL_RWops *context, void *ptr, int size, int maxnum)
{
cSDL_LogToFile( "je suis dans stdio_read" );
size_t nread;
nread = fread(ptr, size, maxnum, context->hidden.stdio.fp);
nread = fread(ptr, size, maxnum, context->hidden.stdio.fp);
if ( nread == 0 && ferror(context->hidden.stdio.fp) ) {
cSDL_LogToFile( "error SDL_EFREAD" );
SDL_Error(SDL_EFREAD);
}
cSDL_LogToFile( "nread is equal to %d", (int) nread );
return(nread);
}
static int SDLCALL stdio_write(SDL_RWops *context, const void *ptr, int size, int num)
{
size_t nwrote;
///cSDL_LogToFile( "je suis dans stdio_write" );
nwrote = fwrite(ptr, size, num, context->hidden.stdio.fp);
if ( nwrote == 0 && ferror(context->hidden.stdio.fp) ) {
SDL_Error(SDL_EFWRITE);
}
return(nwrote);
}
static int SDLCALL stdio_close(SDL_RWops *context)
{
///cSDL_LogToFile( "je suis dans stdio_close" );
if ( context ) {
if ( context->hidden.stdio.autoclose ) {
/* WARNING: Check the return value here! */
@ -499,7 +511,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
if (win32_file_open(rwops,file,mode) < 0) {
SDL_FreeRW(rwops);
return NULL;
}
}
rwops->seek = win32_file_seek;
rwops->read = win32_file_read;
rwops->write = win32_file_write;