Don't write in text mode (uio/Win32 conflict; Bug #912) - Michael

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2437 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2006-09-13 03:40:52 +00:00
parent e274356965
commit 9d41ddcc1a
7 changed files with 22 additions and 6 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.6:
- All output done in binary mode, due to uio/Win32 conflicts (#912) - Michael
- Online key configuration menu actually functional now - Michael
- Tweak to Lander UI - Special Weapon is now explicitly Lander Escape,
just as Warp Escape is - Michael
+1 -1
View File
@@ -454,7 +454,7 @@ SaveKeyConfiguration (uio_DirHandle *path, const char *fname)
{
uio_Stream *f;
f = res_OpenResFile (path, fname, "wt");
f = res_OpenResFile (path, fname, "wb");
if (f)
{
VControl_Dump (f);
+5 -3
View File
@@ -964,7 +964,7 @@ dump_keybindings (uio_Stream *out, keybinding *kb, char *name)
PutResFileChar (':', out);
PutResFileChar (' ', out);
WriteResFile (name, 1, strlen (name), out);
PutResFileChar ('\n', out);
PutResFileNewline (out);
kb = kb->next;
}
@@ -976,8 +976,9 @@ VControl_Dump (uio_Stream *out)
int i;
char namebuffer[64];
sprintf (namebuffer, "version %d\n", version);
sprintf (namebuffer, "version %d", version);
WriteResFile (namebuffer, 1, strlen (namebuffer), out);
PutResFileNewline (out);
/* Print out keyboard bindings */
for (i = 0; i < SDLK_LAST; i++)
@@ -998,8 +999,9 @@ VControl_Dump (uio_Stream *out)
{
int j;
sprintf (namebuffer, "joystick %d threshold %d\n", i, joysticks[i].threshold);
sprintf (namebuffer, "joystick %d threshold %d", i, joysticks[i].threshold);
WriteResFile (namebuffer, 1, strlen (namebuffer), out);
PutResFileNewline (out);
for (j = 0; j < joysticks[i].numaxes; j++)
{
+1
View File
@@ -60,6 +60,7 @@ extern int WriteResFile (PCVOID lpBuf, COUNT size, COUNT count,
uio_Stream *fp);
extern int GetResFileChar (uio_Stream *fp);
extern int PutResFileChar (char ch, uio_Stream *fp);
extern int PutResFileNewline (uio_Stream *fp);
extern long SeekResFile (uio_Stream *fp, long offset, int whence);
extern long TellResFile (uio_Stream *fp);
extern long LengthResFile (uio_Stream *fp);
+1 -1
View File
@@ -222,7 +222,7 @@ Alist_Dump (alist *m, uio_Stream *s, const char *prefix)
PutResFileChar('=', s);
PutResFileChar(' ', s);
WriteResFile (e->value, 1, strlen (e->value), s);
PutResFileChar('\n', s);
PutResFileNewline(s);
}
e = e->next;
}
+12
View File
@@ -99,6 +99,18 @@ PutResFileChar (char ch, uio_Stream *fp)
return (retval);
}
int
PutResFileNewline (uio_Stream *fp)
{
int retval;
#ifdef WIN32
PutResFileChar ('\r', fp);
#endif
retval = PutResFileChar ('\n', fp);
return (retval);
}
long
SeekResFile (uio_Stream *fp, long offset, int whence)
{
+1 -1
View File
@@ -109,7 +109,7 @@ res_SaveFilename (uio_DirHandle *path, const char *fname, const char *root)
uio_Stream *f;
check_map_init ();
f = res_OpenResFile (path, fname, "wt");
f = res_OpenResFile (path, fname, "wb");
if (f) {
res_SaveFile (f, root);
res_CloseResFile (f);