Mercurial > repos > blastem
comparison render_sdl.c @ 816:7ed55a361e79
Use binary mode for reading shaders and config files so we actually get the number of bytes we expect
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 27 Jul 2015 23:49:14 -0700 |
parents | ec23202df6a6 |
children | b6842dfb8edf |
comparison
equal
deleted
inserted
replaced
815:1f3ddeaacaee | 816:7ed55a361e79 |
---|---|
115 | 115 |
116 GLuint load_shader(char * fname, GLenum shader_type) | 116 GLuint load_shader(char * fname, GLenum shader_type) |
117 { | 117 { |
118 char * parts[] = {get_home_dir(), "/.config/blastem/shaders/", fname}; | 118 char * parts[] = {get_home_dir(), "/.config/blastem/shaders/", fname}; |
119 char * shader_path = alloc_concat_m(3, parts); | 119 char * shader_path = alloc_concat_m(3, parts); |
120 FILE * f = fopen(shader_path, "r"); | 120 FILE * f = fopen(shader_path, "rb"); |
121 free(shader_path); | 121 free(shader_path); |
122 if (!f) { | 122 if (!f) { |
123 parts[0] = get_exe_dir(); | 123 parts[0] = get_exe_dir(); |
124 parts[1] = "/shaders/"; | 124 parts[1] = "/shaders/"; |
125 shader_path = alloc_concat_m(3, parts); | 125 shader_path = alloc_concat_m(3, parts); |
126 f = fopen(shader_path, "r"); | 126 f = fopen(shader_path, "rb"); |
127 free(shader_path); | 127 free(shader_path); |
128 if (!f) { | 128 if (!f) { |
129 warning("Failed to open shader file %s for reading\n", fname); | 129 warning("Failed to open shader file %s for reading\n", fname); |
130 return 0; | 130 return 0; |
131 } | 131 } |