Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: examples/games/scummvm/nacl.patch

Issue 37213005: Update scummvm to 1.6.0, also make it a packaged app. (Closed) Base URL: https://naclports.googlecode.com/svn/trunk/src
Patch Set: use default .scummvmrc to have games automatically "loaded" Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 diff -Naur scummvm-1.2.1_orig/backends/midi/timidity.cpp scummvm-1.2.1/backends/ midi/timidity.cpp 1 diff --git a/backends/platform/sdl/posix/posix-main.cpp b/backends/platform/sdl/ posix/posix-main.cpp
2 --- scummvm-1.2.1_orig/backends/midi/timidity.cpp» 2010-12-11 01:38:09.0000 00000 -0800 2 index 5f0914e..4f11f2f 100644
3 +++ scummvm-1.2.1/backends/midi/timidity.cpp» 2011-09-07 11:47:02.000000000 -0 700 3 --- a/backends/platform/sdl/posix/posix-main.cpp
4 @@ -34,8 +34,7 @@ 4 +++ b/backends/platform/sdl/posix/posix-main.cpp
5 @@ -20,6 +20,13 @@
5 * 6 *
6 */ 7 */
7 8
8 -#if defined (UNIX) 9 +#define FORBIDDEN_SYMBOL_EXCEPTION_printf
9 - 10 +#define FORBIDDEN_SYMBOL_EXCEPTION_vprintf
10 +#if defined (UNIX) && !defined(NACL) 11 +#define FORBIDDEN_SYMBOL_EXCEPTION_vfprintf
11 #include "common/util.h" 12 +#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
12 #include "common/endian.h" 13 +#define FORBIDDEN_SYMBOL_EXCEPTION_setenv
13 #include "common/str.h" 14 +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
14 diff -Naur scummvm-1.2.1_orig/backends/platform/sdl/main.cpp scummvm-1.2.1/backe nds/platform/sdl/main.cpp 15 +
15 --- scummvm-1.2.1_orig/backends/platform/sdl/main.cpp» 2010-12-11 01:38:11.0000 00000 -0800 16 #include "common/scummsys.h"
16 +++ scummvm-1.2.1/backends/platform/sdl/main.cpp» 2011-09-07 11:47:02.0000 00000 -0700 17
17 @@ -52,16 +52,18 @@ 18 #if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(MAEMO ) && !defined(WEBOS) && !defined(LINUXMOTO) && !defined(GPH_DEVICE) && !defined( GP2X) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3)
19 @@ -28,7 +35,88 @@
20 #include "backends/plugins/sdl/sdl-provider.h"
21 #include "base/main.h"
22
23 +#if defined(NACL)
24 +#include <fcntl.h>
25 +#include <libtar.h>
26 +#include <stdlib.h>
27 +#include <sys/mount.h>
28 +#include <sys/stat.h>
29 +#include <unistd.h>
30 +#include <SDL/SDL_main.h>
31 +
32 +#include "nacl_io/nacl_io.h"
33 +#endif
34 +
35 +#if defined(NACL)
36 +
37 +#define CHECK(x) ret = x; assert(ret == 0)
38 +
39 +void ExtractAll(const char* data_file) {
40 +» printf("Extracting: %s ...\n", data_file);
41 +» TAR* tar;
42 + int ret;
43 +» CHECK(tar_open(&tar, (char*)data_file, NULL, O_RDONLY, 0, 0));
44 +» CHECK(tar_extract_all(tar, "/"));
45 +» CHECK(tar_close(tar));
46 +}
47 +
48 +void CopyFile(const char* src, const char* dst) {
49 +» const size_t kBufferSize = 1024;
50 +» char buffer[kBufferSize];
51 +»
52 +» int src_fd = open(src, O_RDONLY);
53 +» assert(src_fd != -1);
54 +» int dst_fd = open(dst, O_WRONLY | O_CREAT);
55 +» assert(dst_fd != -1);
56 +»
57 +» int bytes_read;
58 +» int write_offset;
59 +» do {
60 +» » bytes_read = read(src_fd, &buffer[0], kBufferSize);
61 +» » assert(bytes_read >= 0);
62 +» » int bytes_to_write = bytes_read;
63 +» »
64 +» » write_offset = 0;
65 +» » while (bytes_to_write > 0) {
66 +» » » int bytes_written = write(dst_fd, &buffer[write_offset], bytes_to_write);
67 +» » » assert(bytes_written >= 0);
68 +» » » bytes_to_write -= bytes_written;
69 +» » » write_offset += bytes_written;
70 +» » }
71 +» } while(bytes_read > 0);
72 +»
73 +» close(src_fd);
74 +» close(dst_fd);
75 +}
76 +
77 +bool FileExists(const char* path) {
78 +» struct stat buf;
79 +» return stat(path, &buf) == 0;
80 +}
81 +
82 +int SDL_main(int argc, char *argv[]) {
Sam Clegg 2013/10/25 02:08:24 You don't need to call it SDL_main if you include
83 +» int ret;
84 +» CHECK(umount("/"));
85 +» CHECK(mount("", "/", "memfs", 0, NULL));
86 +» CHECK(mount("./", "/mnt/http", "httpfs", 0, NULL));
87 +
88 +» ExtractAll("/mnt/http/runimage.tar");
89 +» ExtractAll("/mnt/http/bass.tar");
90 +» ExtractAll("/mnt/http/lure.tar");
91 +
92 +» CHECK(mkdir("/home", 0777));
93 + CHECK(mount("", "/home", "html5fs", 0, "type=PERSISTENT"));
94 +» CHECK(setenv("HOME", "/home", 1));
95 +
96 +» const char kConfigFile[] = "/home/.scummvmrc";
97 +» if (!FileExists(kConfigFile)) {
98 +» » // Initialize with a default .scummvmrm that already has the
99 +» » // games loaded.
100 +» » CopyFile("/mnt/http/scummvmrc", kConfigFile);
101 + }
102 +#else
103 int main(int argc, char *argv[]) {
104 +#endif
105
106 » // Create our OSystem instance
107 » g_system = new OSystem_POSIX();
108 diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix /posix.cpp
109 index 7a8b1e7..6a9b94f 100644
110 --- a/backends/platform/sdl/posix/posix.cpp
111 +++ b/backends/platform/sdl/posix/posix.cpp
112 @@ -160,6 +160,9 @@ Common::WriteStream *OSystem_POSIX::createLogFile() {
18 } 113 }
19 #endif 114
20 115 bool OSystem_POSIX::displayLogFile() {
21 -int main(int argc, char *argv[]) { 116 +#ifdef NACL
22 - 117 +» return false;
23 +#if defined(NACL) 118 +#else
24 +extern "C" int scummvm_sdl_init(void) { 119 » if (_logFilePath.empty())
25 » // Create our OSystem instance 120 » » return false;
26 » g_system = new OSystem_SDL(); 121
27 » assert(g_system); 122 @@ -208,6 +211,7 @@ bool OSystem_POSIX::displayLogFile() {
28 +}
29 +#endif
30
31 +extern "C" int scummvm_sdl_main(int argc, const char * const argv[]) {
32 #ifdef DYNAMIC_MODULES
33 » PluginManager::instance().addPluginProvider(new SDLPluginProvider());
34 #endif
35 -
36 » // Invoke the actual ScummVM main entry point:
37 » int res = scummvm_main(argc, argv);
38 » ((OSystem_SDL *)g_system)->deinit();
39 diff -Naur scummvm-1.2.1_orig/backends/platform/sdl/module.mk scummvm-1.2.1/back ends/platform/sdl/module.mk
40 --- scummvm-1.2.1_orig/backends/platform/sdl/module.mk» 2010-12-11 01:38:11.0000 00000 -0800
41 +++ scummvm-1.2.1/backends/platform/sdl/module.mk» 2011-09-07 11:47:02.0000 00000 -0700
42 @@ -5,6 +5,8 @@
43 » graphics.o \
44 » hardwarekeys.o \
45 » main.o \
46 +» ppapi/scummvm_pepper_instance.o \
47 +» ppapi/scummvm_pepper_module.o \
48 » sdl.o
49
50 # We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
51 diff -Naur scummvm-1.2.1_orig/backends/platform/sdl/ppapi/module.mk scummvm-1.2. 1/backends/platform/sdl/ppapi/module.mk
52 --- scummvm-1.2.1_orig/backends/platform/sdl/ppapi/module.mk» 1969-12-31 16:00 :00.000000000 -0800
53 +++ scummvm-1.2.1/backends/platform/sdl/ppapi/module.mk»2011-09-07 11:47:02.0000 00000 -0700
54 @@ -0,0 +1,8 @@
55 +MODULE := scummvm_ppapi
56 +
57 +MODULE_OBJS := \
58 +» scummvm_pepper_instance.o \
59 +» scummvm_pepper_module.o
60 +
61 +# Include common rules
62 +include $(srcdir)/rules.mk
63 diff -Naur scummvm-1.2.1_orig/backends/platform/sdl/ppapi/scummvm_pepper_instanc e.cpp scummvm-1.2.1/backends/platform/sdl/ppapi/scummvm_pepper_instance.cpp
64 --- scummvm-1.2.1_orig/backends/platform/sdl/ppapi/scummvm_pepper_instance.cpp» 1969-12-31 16:00:00.000000000 -0800
65 +++ scummvm-1.2.1/backends/platform/sdl/ppapi/scummvm_pepper_instance.cpp» 2011-09-07 11:47:02.000000000 -0700
66 @@ -0,0 +1,116 @@
67 +/*
68 + * Copyright (c) 2011 The Native Client Authors. All rights reserved.
69 + * Use of this source code is governed by a BSD-style license that can be
70 + * found in the LICENSE file.
71 + */
72 +#include "scummvm_pepper_instance.h"
73 +#include <assert.h>
74 +#include <vector>
75 +#include <unistd.h>
76 +#include <SDL.h>
77 +#include <SDL_nacl.h>
78 +#include <SDL_video.h>
79 +#include "nacl-mounts/base/UrlLoaderJob.h"
80 +#include "nacl-mounts/AppEngine/AppEngineMount.h"
81 +
82 +extern "C" int mount(const char *source, const char *target, const char *filesy stemtype, unsigned long mountflags, const void *data);
83 +extern "C" int scummvm_sdl_init(void);
84 +extern "C" int scummvm_sdl_main(int argc,const char * const argv[]);
85 +extern "C" int simple_tar_extract(const char *path);
86 +
87 +static void *scummvm_init(void *arg) {
88 + MainThreadRunner *runner = reinterpret_cast<MainThreadRunner*>(arg);
89 +
90 + UrlLoaderJob *job = new UrlLoaderJob;
91 + job->set_url("/static/runimage.tar");
92 + std::vector<char> data;
93 + job->set_dst(&data);
94 + runner->RunJob(job);
95 + int fh = open("/runimage.tar", O_CREAT | O_WRONLY);
96 + write(fh, &data[0], data.size());
97 + close(fh);
98 +
99 + simple_tar_extract("runimage.tar");
100 +
101 + UrlLoaderJob *job2 = new UrlLoaderJob;
102 + job2->set_url("/static/bass.tar");
103 + std::vector<char> data2;
104 + job2->set_dst(&data2);
105 + runner->RunJob(job2);
106 + int fh2 = open("/bass.tar", O_CREAT | O_WRONLY);
107 + write(fh2, &data2[0], data2.size());
108 + close(fh2);
109 +
110 + simple_tar_extract("bass.tar");
111 +
112 + UrlLoaderJob *job3 = new UrlLoaderJob;
113 + job3->set_url("/static/lure.tar");
114 + std::vector<char> data3;
115 + job3->set_dst(&data3);
116 + runner->RunJob(job3);
117 + int fh3 = open("/lure.tar", O_CREAT | O_WRONLY);
118 + write(fh3, &data3[0], data3.size());
119 + close(fh3);
120 +
121 + simple_tar_extract("lure.tar");
122 +
123 + int ret;
124 + mkdir("/usr", 0777);
125 + mkdir("/usr/local", 0777);
126 + mkdir("/usr/local/save", 0777);
127 + mkdir("/usr/local/save/AppEngine", 0777);
128 +
129 + AppEngineMount *aem = new AppEngineMount(runner, "/_file");
130 + ret = mount(0, "/usr/local/save/AppEngine", 0, 0, aem);
131 + assert(ret == 0);
132 +
133 + ret = chdir("/usr/local/save/AppEngine");
134 + assert(ret == 0);
135 +
136 + static char const * argv[] = {"scummvm", NULL};
137 + scummvm_sdl_init();
138 + scummvm_sdl_main(1, (const char**)argv);
139 +
140 + return 0;
141 +}
142 +
143 +ScummvmPepperInstance::ScummvmPepperInstance(PP_Instance instance)
144 + : pp::Instance(instance),
145 + quit_(false),
146 + width_(0),
147 + height_(0),
148 + runner_(NULL) {
149 + RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE);
150 + RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD);
151 +}
152 +
153 +bool ScummvmPepperInstance::Init(uint32_t argc, const char* argn[], const char* argv[]) {
154 + return true;
155 +}
156 +
157 +void ScummvmPepperInstance::DidChangeView(const pp::Rect& position, const pp::R ect& clip) {
158 + if (width_ && height_)
159 + return;
160 +
161 + if (position.size().width() == width_ &&
162 + position.size().height() == height_)
163 + return; // Size didn't change, no need to update anything.
164 +
165 + width_ = position.size().width();
166 + height_ = position.size().height();
167 +
168 + SDL_NACL_SetInstance(pp_instance(), width_, height_);
169 +
170 + int lval = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
171 +
172 + assert(lval >= 0);
173 +
174 + runner_ = new MainThreadRunner(this);
175 + pthread_create(&scummvm_thread_, NULL, scummvm_init, runner_);
176 +}
177 +
178 +bool ScummvmPepperInstance::HandleInputEvent(const pp::InputEvent& event) {
179 + SDL_NACL_PushEvent(event);
180 + return true;
181 +}
182 +
183 diff -Naur scummvm-1.2.1_orig/backends/platform/sdl/ppapi/scummvm_pepper_instanc e.h scummvm-1.2.1/backends/platform/sdl/ppapi/scummvm_pepper_instance.h
184 --- scummvm-1.2.1_orig/backends/platform/sdl/ppapi/scummvm_pepper_instance.h» 1969-12-31 16:00:00.000000000 -0800
185 +++ scummvm-1.2.1/backends/platform/sdl/ppapi/scummvm_pepper_instance.h»2011-09- 07 11:47:02.000000000 -0700
186 @@ -0,0 +1,39 @@
187 +/*
188 + * Copyright (c) 2011 The Native Client Authors. All rights reserved.
189 + * Use of this source code is governed by a BSD-style license that can be
190 + * found in the LICENSE file.
191 + */
192 +#ifndef EXAMPLES_SCUMMVM_PEPPER_H_
193 +#define EXAMPLES_SCUMMVM_PEPPER_H_
194 +
195 +#include <pthread.h>
196 +#include <ppapi/cpp/input_event.h>
197 +#include <ppapi/cpp/instance.h>
198 +#include <ppapi/cpp/rect.h>
199 +#include "nacl-mounts/base/MainThreadRunner.h"
200 +
201 +class ScummvmPepperInstance : public pp::Instance {
202 + public:
203 + explicit ScummvmPepperInstance(PP_Instance instance);
204 +
205 + virtual ~ScummvmPepperInstance() {
206 + if (runner_) delete runner_;
207 + }
208 +
209 + virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]);
210 +
211 + void DidChangeView(const pp::Rect& position, const pp::Rect& clip);
212 +
213 + bool HandleInputEvent(const pp::InputEvent& event);
214 +
215 + bool quit() const { return quit_; }
216 +
217 + private:
218 + pthread_t scummvm_thread_;
219 + MainThreadRunner *runner_;
220 + int width_;
221 + int height_;
222 + bool quit_;
223 +};
224 +
225 +#endif // EXAMPLES_SCUMMVM_PEPPER_H_
226 diff -Naur scummvm-1.2.1_orig/backends/platform/sdl/ppapi/scummvm_pepper_module. cpp scummvm-1.2.1/backends/platform/sdl/ppapi/scummvm_pepper_module.cpp
227 --- scummvm-1.2.1_orig/backends/platform/sdl/ppapi/scummvm_pepper_module.cpp» 1969-12-31 16:00:00.000000000 -0800
228 +++ scummvm-1.2.1/backends/platform/sdl/ppapi/scummvm_pepper_module.cpp»2011-09- 07 11:47:02.000000000 -0700
229 @@ -0,0 +1,33 @@
230 +// Copyright 2011 The Native Client SDK Authors. All rights reserved.
231 +// Use of this source code is governed by a BSD-style license that can
232 +// be found in the LICENSE file.
233 +
234 +#include <ppapi/cpp/module.h>
235 +#include <stdio.h>
236 +#include "scummvm_pepper_instance.h"
237 +
238 +namespace scummvm_pepper {
239 + // The Module class. The browser calls the CreateInstance() method to create
240 + // an instance of you NaCl module on the web page. The browser creates a new
241 + // instance for each <embed> tag with type="application/x-ppapi-nacl-srpc".
242 + class ScummvmPepperModule : public pp::Module {
243 + public:
244 + ScummvmPepperModule() : pp::Module() {}
245 + virtual ~ScummvmPepperModule() {}
246 +
247 + virtual pp::Instance* CreateInstance(PP_Instance instance) {
248 + return new ScummvmPepperInstance(instance);
249 + }
250 + };
251 +} // namespace scummvm_pepper
252 +
253 +// Factory function called by the browser when the module is first loaded.
254 +// The browser keeps a singleton of this module. It calls the
255 +// CreateInstance() method on the object you return to make instances. There
256 +// is one instance per <embed> tag on the page. This is the main binding
257 +// point for your NaCl module with the browser.
258 +namespace pp {
259 + Module* CreateModule() {
260 + return new scummvm_pepper::ScummvmPepperModule();
261 + }
262 +} // namespace pp
263 diff -Naur scummvm-1.2.1_orig/backends/platform/sdl/sdl.cpp scummvm-1.2.1/backen ds/platform/sdl/sdl.cpp
264 --- scummvm-1.2.1_orig/backends/platform/sdl/sdl.cpp» 2010-12-11 01:38:11.0000 00000 -0800
265 +++ scummvm-1.2.1/backends/platform/sdl/sdl.cpp»2011-09-07 11:47:02.000000000 -0 700
266 @@ -97,6 +97,8 @@
267
268 #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && defined(USE_SCALERS)
269 static AspectRatio getDesiredAspectRatio() {
270 + return AspectRatio(1, 1);
271 +#if !defined(NACL)
272 » const size_t AR_COUNT = 4;
273 » const char* desiredAspectRatioAsStrings[AR_COUNT] = { " auto", "4/3", "16/9", "16/10" };
274 » const AspectRatio desiredAspectRatios[AR_COUNT] = { AspectRatio( 0, 0), AspectRatio(4,3), AspectRatio(16,9), AspectRatio(16,10) };
275 @@ -113,6 +115,7 @@
276 } 123 }
277 » // TODO : Report a warning 124
278 » return AspectRatio(0, 0); 125 » return WIFEXITED(status) && WEXITSTATUS(status) == 0;
279 +#endif 126 +#endif
280 } 127 }
281 #endif 128
282 129
283 @@ -135,9 +138,11 @@ 130 diff --git a/configure b/configure
284 » if (joystick_num > -1) 131 index 5016a86..96571c1 100755
285 » » sdlFlags |= SDL_INIT_JOYSTICK; 132 --- a/configure
286 133 +++ b/configure
287 +#if !defined(NACL) 134 @@ -1338,6 +1338,16 @@ n64)
288 » if (SDL_Init(sdlFlags) == -1) { 135 » _host_cpu=mips
289 » » error("Could not initialize SDL: %s", SDL_GetError()); 136 » _host_alias=mips64
290 » }
291 +#endif
292
293 » _graphicsMutex = createMutex();
294
295 @@ -407,7 +412,8 @@
296 » // from the Springboard, is /. Which we don't want.
297 » const char *home = getenv("HOME");
298 » if (home != NULL && strlen(home) < MAXPATHLEN)
299 -» » snprintf(configFile, MAXPATHLEN, "%s/%s", home, DEFAULT_CONFIG_F ILE);
300 +» » //snprintf(configFile, MAXPATHLEN, "%s/%s", home, DEFAULT_CONFIG _FILE);
301 +» » sprintf(configFile, "%s/%s", home, DEFAULT_CONFIG_FILE);
302 » else
303 » » strcpy(configFile, DEFAULT_CONFIG_FILE);
304 #else
305 diff -Naur scummvm-1.2.1_orig/base/commandLine.cpp scummvm-1.2.1/base/commandLin e.cpp
306 --- scummvm-1.2.1_orig/base/commandLine.cpp» 2010-12-11 01:38:08.000000000 -0 800
307 +++ scummvm-1.2.1/base/commandLine.cpp» 2011-09-07 11:47:02.000000000 -0700
308 @@ -140,7 +140,8 @@
309 » va_list va;
310
311 » va_start(va, s);
312 -» vsnprintf(buf, STRINGBUFLEN, s, va);
313 +» //vsnprintf(buf, STRINGBUFLEN, s, va);
314 +» vsprintf(buf, s, va);
315 » va_end(va);
316
317 #if !(defined(__GP32__) || defined (__SYMBIAN32__) || defined(__DS__))
318 diff -Naur scummvm-1.2.1_orig/base/plugins.cpp scummvm-1.2.1/base/plugins.cpp
319 --- scummvm-1.2.1_orig/base/plugins.cpp»2010-12-11 01:38:08.000000000 -0800
320 +++ scummvm-1.2.1/base/plugins.cpp» 2011-09-07 11:47:02.000000000 -0700
321 @@ -212,7 +212,7 @@
322 » » LINK_PLUGIN(AMIGA)
323 » » LINK_PLUGIN(APPLEIIGS)
324 » » LINK_PLUGIN(TOWNS)
325 -» » #if defined (UNIX)
326 + #if defined (UNIX) && !defined(NACL)
327 » » LINK_PLUGIN(TIMIDITY)
328 » » #endif
329
330 diff -Naur scummvm-1.2.1_orig/config.log scummvm-1.2.1/config.log
331 --- scummvm-1.2.1_orig/config.log» 1969-12-31 16:00:00.000000000 -0800
332 +++ scummvm-1.2.1/config.log» 2011-09-07 11:47:02.000000000 -0700
333 @@ -0,0 +1 @@
334 +Configure run on Thu Aug 18 14:57:56 PDT 2011
335 diff -Naur scummvm-1.2.1_orig/configure scummvm-1.2.1/configure
336 --- scummvm-1.2.1_orig/configure» 2010-12-11 01:38:39.000000000 -0800
337 +++ scummvm-1.2.1/configure» 2011-09-07 11:47:02.000000000 -0700
338 @@ -1091,6 +1091,11 @@
339 » _host_cpu=arm
340 » _host_alias=arm-wince-mingw32ce
341 ;; 137 ;;
342 +nacl) 138 +nacl-x86)
343 + _host_os=nacl 139 + _host_os=nacl
344 + _host_cpu=x86 140 + _host_cpu=x86
345 + _host_alias=${NACL_CROSS_PREFIX} 141 + _host_alias=${NACL_CROSS_PREFIX}
346 + ;; 142 + ;;
347 *) 143 +nacl-arm)
348 » if test -n "$_host"; then 144 +» _host_os=nacl
349 » » guessed_host=`$_srcdir/config.sub $_host` 145 +» _host_cpu=arm
350 diff -Naur scummvm-1.2.1_orig/engines/scumm/detection.cpp scummvm-1.2.1/engines/ scumm/detection.cpp 146 +» _host_alias=${NACL_CROSS_PREFIX}
351 --- scummvm-1.2.1_orig/engines/scumm/detection.cpp» 2010-12-11 01:37:23.0000 00000 -0800 147 +» ;;
352 +++ scummvm-1.2.1/engines/scumm/detection.cpp» 2011-09-07 11:47:02.000000000 -0 700 148 neuros)
353 @@ -23,6 +23,11 @@ 149 » _host_os=linux
354 * 150 » _host_cpu=arm
355 */ 151 @@ -1347,6 +1357,11 @@ openpandora)
356 152 » _host_cpu=arm
357 + 153 » _host_alias=arm-angstrom-linux-gnueabi
358 +#define snprintf4(a,b,c,d) sprintf(a,c,d) 154 » ;;
359 +#define snprintf5(a,b,c,d,e) sprintf(a,c,d,e) 155 +pnacl)
360 +#define snprintf6(a,b,c,d,e,f) sprintf(a,c,d,e,f) 156 +» _host_os=pnacl
361 + 157 +» _host_cpu=le32
362 #include "base/plugins.h" 158 +» _host_alias=${NACL_CROSS_PREFIX}
363 159 +» ;;
364 #include "common/archive.h" 160 ppc-amigaos)
365 @@ -72,20 +77,20 @@ 161 » _host_os=amigaos
366 162 » _host_cpu=ppc
367 » if (_game.version == 4) { 163 @@ -1731,7 +1746,7 @@ if test "$have_gcc" = yes ; then
368 » » if (room == 0 || room >= 900) { 164 » » » case $_host_os in
369 -» » » snprintf(buf, sizeof(buf), "%03d.lfl", room); 165 » » » # newlib-based system include files suppress non-C89 fun ction
370 +» » » snprintf4(buf, sizeof(buf), "%03d.lfl", room); 166 » » » # declarations under __STRICT_ANSI__
371 » » } else { 167 -» » » amigaos* | android | bada | dreamcast | ds | gamecube | mingw* | n64 | psp | ps2 | ps3 | wii | wince )
372 -» » » snprintf(buf, sizeof(buf), "disk%02d.lec", diskNumber); 168 +» » » amigaos* | android | bada | dreamcast | ds | gamecube | mingw* | n64 | psp | ps2 | ps3 | wii | wince | *nacl* )
373 +» » » snprintf4(buf, sizeof(buf), "disk%02d.lec", diskNumber); 169 » » » » ;;
374 » » } 170 » » » *)
375 » } else { 171 » » » » CXXFLAGS="$CXXFLAGS -ansi"
376 » » char id = 0; 172 @@ -1808,6 +1823,8 @@ if strings $TMPO.o | grep BIGenDianSyS >/dev/null; then
377 173 » _endian=big
378 » » switch (_filenamePattern.genMethod) { 174 elif strings $TMPO.o | grep LiTTleEnDian >/dev/null; then
379 » » case kGenDiskNum: 175 » _endian=little
380 -» » » snprintf(buf, sizeof(buf), _filenamePattern.pattern, dis kNumber); 176 +elif [ "$_host_cpu" = "le32" ]; then
381 +» » » snprintf4(buf, sizeof(buf), _filenamePattern.pattern, di skNumber); 177 +» _endian=little
382 » » » break; 178 fi
383 179 echo $_endian;
384 » » case kGenRoomNum: 180 cc_check_clean tmp_endianness_check.cpp
385 -» » » snprintf(buf, sizeof(buf), _filenamePattern.pattern, roo m); 181 @@ -1991,6 +2008,9 @@ case $_host_cpu in
386 +» » » snprintf4(buf, sizeof(buf), _filenamePattern.pattern, ro om); 182 » amd64 | x86_64)
387 » » » break; 183 » » echo "x86_64"
388 184 » » ;;
389 » » case kGenHEMac: 185 +» le32)
390 @@ -107,15 +112,15 @@ 186 +» » echo "Generic le32"
391 » » » » » else if (_game.id == GID_TREASUREHUNT) 187 +» » ;;
392 » » » » » » strcpy(buf, "Blue'sTreasureHunt. (b)"); 188 » *)
393 » » » » » else 189 » » echo "unknown ($_host_cpu)"
394 -» » » » » » snprintf(buf, sizeof(buf), "%s.( b)", _filenamePattern.pattern); 190 » » ;;
395 +» » » » » » snprintf4(buf, sizeof(buf), "%s. (b)", _filenamePattern.pattern); 191 @@ -2915,7 +2935,7 @@ case $_host_os in
396 » » » » » break; 192 » amigaos* | cygwin* | dreamcast | ds | gamecube | mingw* | n64 | ps2 | ps 3 | psp | wii | wince)
397 » » » » case 1: 193 » » _posix=no
398 » » » » » id = 'a'; 194 » » ;;
399 -» » » » » snprintf(buf, sizeof(buf), "%s.(a)", _fi lenamePattern.pattern); 195 -» android | beos* | bsd* | darwin* | freebsd* | gph-linux | haiku* | hpux* | iphone | irix* | linux* | maemo | mint* | netbsd* | openbsd* | solaris* | sun os* | uclinux* | webos)
400 +» » » » » snprintf4(buf, sizeof(buf), "%s.(a)", _f ilenamePattern.pattern); 196 +» android | beos* | bsd* | darwin* | freebsd* | gph-linux | haiku* | hpux* | iphone | irix* | linux* | maemo | mint* | netbsd* | openbsd* | solaris* | sun os* | uclinux* | webos | *nacl)
401 » » » » » break; 197 » » _posix=yes
402 » » » » default: 198 » » ;;
403 » » » » » id = '0'; 199 » os2-emx*)
404 -» » » » » snprintf(buf, sizeof(buf), "%s.he0", _fi lenamePattern.pattern); 200 diff --git a/graphics/scaler/scale2x.cpp b/graphics/scaler/scale2x.cpp
405 +» » » » » snprintf4(buf, sizeof(buf), "%s.he0", _f ilenamePattern.pattern); 201 index ac2dbad..0fc0603 100644
406 » » » » } 202 --- a/graphics/scaler/scale2x.cpp
407 » » » } else if (_game.heversion >= 70) { 203 +++ b/graphics/scaler/scale2x.cpp
408 » » » » id = (room == 0) ? '0' : '1'; 204 @@ -201,9 +201,15 @@ static inline void scale2x_8_mmx_single(scale2x_uint8* dst, const scale2x_uint8*
409 @@ -126,16 +131,16 @@
410 » » » if (_filenamePattern.genMethod == kGenHEPC) {
411 » » » » // For HE >= 98, we already called snprintf abov e.
412 » » » » if (_game.heversion < 98 || room < 0)
413 -» » » » » snprintf(buf, sizeof(buf), "%s.he%c", _f ilenamePattern.pattern, id);
414 +» » » » » snprintf5(buf, sizeof(buf), "%s.he%c", _ filenamePattern.pattern, id);
415 » » » } else {
416 » » » » if (id == '3') { // special case for cursors
417 » » » » » // For mac they're stored in game binary
418 » » » » » strncpy(buf, _filenamePattern.pattern, s izeof(buf));
419 » » » » } else {
420 » » » » » if (_filenamePattern.genMethod == kGenHE Mac)
421 -» » » » » » snprintf(buf, sizeof(buf), "%s ( %c)", _filenamePattern.pattern, id);
422 +» » » » » » snprintf5(buf, sizeof(buf), "%s (%c)", _filenamePattern.pattern, id);
423 » » » » » else
424 -» » » » » » snprintf(buf, sizeof(buf), "%s % c", _filenamePattern.pattern, id);
425 +» » » » » » snprintf5(buf, sizeof(buf), "%s %c", _filenamePattern.pattern, id);
426 » » » » }
427 » » » }
428
429 @@ -159,19 +164,19 @@
430 » switch (genMethod) {
431 » case kGenDiskNum:
432 » case kGenRoomNum:
433 -» » snprintf(buf, sizeof(buf), pattern, 0);
434 +» » snprintf4(buf, sizeof(buf), pattern, 0);
435 » » break;
436
437 » case kGenHEPC:
438 -» » snprintf(buf, sizeof(buf), "%s.he0", pattern);
439 +» » snprintf4(buf, sizeof(buf), "%s.he0", pattern);
440 » » break;
441
442 » case kGenHEMac:
443 -» » snprintf(buf, sizeof(buf), "%s (0)", pattern);
444 +» » snprintf4(buf, sizeof(buf), "%s (0)", pattern);
445 » » break;
446
447 » case kGenHEMacNoParens:
448 -» » snprintf(buf, sizeof(buf), "%s 0", pattern);
449 +» » snprintf4(buf, sizeof(buf), "%s 0", pattern);
450 » » break;
451
452 » case kGenUnchanged:
453 diff -Naur scummvm-1.2.1_orig/engines/sky/control.cpp scummvm-1.2.1/engines/sky/ control.cpp
454 --- scummvm-1.2.1_orig/engines/sky/control.cpp» 2010-12-11 01:37:35.000000000 -0 800
455 +++ scummvm-1.2.1/engines/sky/control.cpp» 2011-09-07 11:47:02.000000000 -0 700
456 @@ -1031,7 +1031,7 @@
457 » savenames.resize(MAX_SAVE_GAMES);
458
459 » Common::InSaveFile *inf;
460 -» inf = _saveFileMan->openForLoading("SKY-VM.SAV");
461 +» inf = _saveFileMan->openForLoading(SKY_VM_SAVE_PATH);
462 » if (inf != NULL) {
463 » » char *tmpBuf = new char[MAX_SAVE_GAMES * MAX_TEXT_LEN];
464 » » char *tmpPtr = tmpBuf;
465 @@ -1075,7 +1075,7 @@
466 void Control::saveDescriptions(const Common::StringArray &list) {
467 » Common::OutSaveFile *outf;
468
469 -» outf = _saveFileMan->openForSaving("SKY-VM.SAV");
470 +» outf = _saveFileMan->openForSaving(SKY_VM_SAVE_PATH);
471 » bool ioFailed = true;
472 » if (outf) {
473 » » for (uint16 cnt = 0; cnt < MAX_SAVE_GAMES; cnt++) {
474 diff -Naur scummvm-1.2.1_orig/engines/sky/control.h scummvm-1.2.1/engines/sky/co ntrol.h
475 --- scummvm-1.2.1_orig/engines/sky/control.h» 2010-12-11 01:37:35.000000000 -0 800
476 +++ scummvm-1.2.1/engines/sky/control.h»2011-09-07 11:47:02.000000000 -0700
477 @@ -137,6 +137,8 @@
478 #define SAVE_FILE_REVISION 6
479 #define OLD_SAVEGAME_TYPE 5
480
481 +#define SKY_VM_SAVE_PATH "SKY-VM.SAV"
482 +
483 struct AllocedMem {
484 » uint16 *mem;
485 » AllocedMem *next;
486 diff -Naur scummvm-1.2.1_orig/engines/sky/detection.cpp scummvm-1.2.1/engines/sk y/detection.cpp
487 --- scummvm-1.2.1_orig/engines/sky/detection.cpp» 2010-12-11 01:37:35.0000 00000 -0800
488 +++ scummvm-1.2.1/engines/sky/detection.cpp» 2011-09-07 11:47:02.000000000 -0 700
489 @@ -37,6 +37,8 @@
490
491 #include "engines/metaengine.h"
492
493 +#include "control.h"
494 +
495 static const PlainGameDescriptor skySetting =
496 » {"sky", "Beneath a Steel Sky" };
497
498 @@ -182,7 +184,7 @@
499 » savenames.resize(MAX_SAVE_GAMES+1);
500
501 » Common::InSaveFile *inf;
502 -» inf = saveFileMan->openForLoading("SKY-VM.SAV");
503 +» inf = saveFileMan->openForLoading(SKY_VM_SAVE_PATH);
504 » if (inf != NULL) {
505 » » char *tmpBuf = new char[MAX_SAVE_GAMES * MAX_TEXT_LEN];
506 » » char *tmpPtr = tmpBuf;
507 @@ -238,7 +240,7 @@
508 » Common::StringArray savenames;
509 » savenames.resize(MAX_SAVE_GAMES+1);
510 » Common::InSaveFile *inf;
511 -» inf = saveFileMan->openForLoading("SKY-VM.SAV");
512 +» inf = saveFileMan->openForLoading(SKY_VM_SAVE_PATH);
513 » if (inf != NULL) {
514 » » char *tmpBuf = new char[MAX_SAVE_GAMES * MAX_TEXT_LEN];
515 » » char *tmpPtr = tmpBuf;
516 @@ -257,7 +259,7 @@
517 » // Save the updated descriptions
518 » Common::OutSaveFile *outf;
519
520 -» outf = saveFileMan->openForSaving("SKY-VM.SAV");
521 +» outf = saveFileMan->openForSaving(SKY_VM_SAVE_PATH);
522 » bool ioFailed = true;
523 » if (outf) {
524 » » for (uint16 cnt = 0; cnt < MAX_SAVE_GAMES; cnt++) {
525 diff -Naur scummvm-1.2.1_orig/graphics/scaler/scale2x.cpp scummvm-1.2.1/graphics /scaler/scale2x.cpp
526 --- scummvm-1.2.1_orig/graphics/scaler/scale2x.cpp» 2010-12-11 01:38:07.0000 00000 -0800
527 +++ scummvm-1.2.1/graphics/scaler/scale2x.cpp» 2011-09-07 12:14:13.000000000 -0 700
528 @@ -211,9 +211,15 @@
529 "0:\n" 205 "0:\n"
530 206
531 /* set the current, current_pre, current_next registers */ 207 /* set the current, current_pre, current_next registers */
532 +#if defined(__x86_64__) 208 +#if defined(__x86_64__)
533 + "movq %%nacl:-8(%%r15,%q1), %%mm0\n" 209 + "movq %%nacl:-8(%%r15,%q1), %%mm0\n"
534 + "movq %%nacl:(%%r15,%q1), %%mm7\n" 210 + "movq %%nacl:(%%r15,%q1), %%mm7\n"
535 + "movq %%nacl:8(%%r15,%q1), %%mm1\n" 211 + "movq %%nacl:8(%%r15,%q1), %%mm1\n"
536 +#else 212 +#else
537 "movq -8(%1), %%mm0\n" 213 "movq -8(%1), %%mm0\n"
538 "movq (%1), %%mm7\n" 214 "movq (%1), %%mm7\n"
539 "movq 8(%1), %%mm1\n" 215 "movq 8(%1), %%mm1\n"
540 +#endif 216 +#endif
541 "psrlq $56, %%mm0\n" 217 "psrlq $56, %%mm0\n"
542 "psllq $56, %%mm1\n" 218 "psllq $56, %%mm1\n"
543 "movq %%mm7, %%mm2\n" 219 "movq %%mm7, %%mm2\n"
544 @@ -224,7 +230,11 @@ 220 @@ -214,7 +220,11 @@ static inline void scale2x_8_mmx_single(scale2x_uint8* dst, const scale2x_uint8*
545 "por %%mm3, %%mm1\n" 221 "por %%mm3, %%mm1\n"
546 222
547 /* current_upper */ 223 /* current_upper */
548 +#if defined(__x86_64__) 224 +#if defined(__x86_64__)
549 + "movq %%nacl:(%%r15,%q0), %%mm6\n" 225 + "movq %%nacl:(%%r15,%q0), %%mm6\n"
550 +#else 226 +#else
551 "movq (%0), %%mm6\n" 227 "movq (%0), %%mm6\n"
552 +#endif 228 +#endif
553 229
554 /* compute the upper-left pixel for dst on %%mm2 */ 230 /* compute the upper-left pixel for dst on %%mm2 */
555 /* compute the upper-right pixel for dst on %%mm4 */ 231 /* compute the upper-right pixel for dst on %%mm4 */
556 @@ -234,8 +244,13 @@ 232 @@ -224,8 +234,13 @@ static inline void scale2x_8_mmx_single(scale2x_uint8* dst, const scale2x_uint8*
557 "movq %%mm1, %%mm5\n" 233 "movq %%mm1, %%mm5\n"
558 "pcmpeqb %%mm6, %%mm2\n" 234 "pcmpeqb %%mm6, %%mm2\n"
559 "pcmpeqb %%mm6, %%mm4\n" 235 "pcmpeqb %%mm6, %%mm4\n"
560 +#if defined(__x86_64__) 236 +#if defined(__x86_64__)
561 + "pcmpeqb %%nacl:(%%r15,%q2), %%mm3\n" 237 + "pcmpeqb %%nacl:(%%r15,%q2), %%mm3\n"
562 + "pcmpeqb %%nacl:(%%r15,%q2), %%mm5\n" 238 + "pcmpeqb %%nacl:(%%r15,%q2), %%mm5\n"
563 +#else 239 +#else
564 "pcmpeqb (%2), %%mm3\n" 240 "pcmpeqb (%2), %%mm3\n"
565 "pcmpeqb (%2), %%mm5\n" 241 "pcmpeqb (%2), %%mm5\n"
566 +#endif 242 +#endif
567 "pandn %%mm2, %%mm3\n" 243 "pandn %%mm2, %%mm3\n"
568 "pandn %%mm4, %%mm5\n" 244 "pandn %%mm4, %%mm5\n"
569 "movq %%mm0, %%mm2\n" 245 "movq %%mm0, %%mm2\n"
570 @@ -257,8 +272,13 @@ 246 @@ -247,8 +262,13 @@ static inline void scale2x_8_mmx_single(scale2x_uint8* dst, const scale2x_uint8*
571 "movq %%mm2, %%mm3\n" 247 "movq %%mm2, %%mm3\n"
572 "punpcklbw %%mm4, %%mm2\n" 248 "punpcklbw %%mm4, %%mm2\n"
573 "punpckhbw %%mm4, %%mm3\n" 249 "punpckhbw %%mm4, %%mm3\n"
574 +#if defined(__x86_64__) 250 +#if defined(__x86_64__)
575 + "movq %%mm2, %%nacl:(%%r15,%q3)\n" 251 + "movq %%mm2, %%nacl:(%%r15,%q3)\n"
576 + "movq %%mm3, %%nacl:8(%%r15,%q3)\n" 252 + "movq %%mm3, %%nacl:8(%%r15,%q3)\n"
577 +#else 253 +#else
578 "movq %%mm2, (%3)\n" 254 "movq %%mm2, (%3)\n"
579 "movq %%mm3, 8(%3)\n" 255 "movq %%mm3, 8(%3)\n"
580 +#endif 256 +#endif
581 257
582 /* next */ 258 /* next */
583 "add $8, %0\n" 259 "add $8, %0\n"
584 @@ -289,9 +309,15 @@ 260 @@ -278,9 +298,15 @@ static inline void scale2x_16_mmx_single(scale2x_uint16* ds t, const scale2x_uint
585 "0:\n" 261 "0:\n"
586 262
587 /* set the current, current_pre, current_next registers */ 263 /* set the current, current_pre, current_next registers */
588 +#if defined(__x86_64__) 264 +#if defined(__x86_64__)
589 + "movq %%nacl:-8(%%r15,%q1), %%mm0\n" 265 + "movq %%nacl:-8(%%r15,%q1), %%mm0\n"
590 + "movq %%nacl:(%%r15,%q1), %%mm7\n" 266 + "movq %%nacl:(%%r15,%q1), %%mm7\n"
591 + "movq %%nacl:8(%%r15,%q1), %%mm1\n" 267 + "movq %%nacl:8(%%r15,%q1), %%mm1\n"
592 +#else 268 +#else
593 "movq -8(%1), %%mm0\n" 269 "movq -8(%1), %%mm0\n"
594 "movq (%1), %%mm7\n" 270 "movq (%1), %%mm7\n"
595 "movq 8(%1), %%mm1\n" 271 "movq 8(%1), %%mm1\n"
596 +#endif 272 +#endif
597 "psrlq $48, %%mm0\n" 273 "psrlq $48, %%mm0\n"
598 "psllq $48, %%mm1\n" 274 "psllq $48, %%mm1\n"
599 "movq %%mm7, %%mm2\n" 275 "movq %%mm7, %%mm2\n"
600 @@ -302,7 +328,11 @@ 276 @@ -291,7 +317,11 @@ static inline void scale2x_16_mmx_single(scale2x_uint16* ds t, const scale2x_uint
601 "por %%mm3, %%mm1\n" 277 "por %%mm3, %%mm1\n"
602 278
603 /* current_upper */ 279 /* current_upper */
604 +#if defined(__x86_64__) 280 +#if defined(__x86_64__)
605 + "movq %%nacl:(%%r15,%q0), %%mm6\n" 281 + "movq %%nacl:(%%r15,%q0), %%mm6\n"
606 +#else 282 +#else
607 "movq (%0), %%mm6\n" 283 "movq (%0), %%mm6\n"
608 +#endif 284 +#endif
609 285
610 /* compute the upper-left pixel for dst on %%mm2 */ 286 /* compute the upper-left pixel for dst on %%mm2 */
611 /* compute the upper-right pixel for dst on %%mm4 */ 287 /* compute the upper-right pixel for dst on %%mm4 */
612 @@ -312,8 +342,13 @@ 288 @@ -301,8 +331,13 @@ static inline void scale2x_16_mmx_single(scale2x_uint16* ds t, const scale2x_uint
613 "movq %%mm1, %%mm5\n" 289 "movq %%mm1, %%mm5\n"
614 "pcmpeqw %%mm6, %%mm2\n" 290 "pcmpeqw %%mm6, %%mm2\n"
615 "pcmpeqw %%mm6, %%mm4\n" 291 "pcmpeqw %%mm6, %%mm4\n"
616 +#if defined(__x86_64__) 292 +#if defined(__x86_64__)
617 + "pcmpeqw %%nacl:(%%r15,%q2), %%mm3\n" 293 + "pcmpeqw %%nacl:(%%r15,%q2), %%mm3\n"
618 + "pcmpeqw %%nacl:(%%r15,%q2), %%mm5\n" 294 + "pcmpeqw %%nacl:(%%r15,%q2), %%mm5\n"
619 +#else 295 +#else
620 "pcmpeqw (%2), %%mm3\n" 296 "pcmpeqw (%2), %%mm3\n"
621 "pcmpeqw (%2), %%mm5\n" 297 "pcmpeqw (%2), %%mm5\n"
622 +#endif 298 +#endif
623 "pandn %%mm2, %%mm3\n" 299 "pandn %%mm2, %%mm3\n"
624 "pandn %%mm4, %%mm5\n" 300 "pandn %%mm4, %%mm5\n"
625 "movq %%mm0, %%mm2\n" 301 "movq %%mm0, %%mm2\n"
626 @@ -335,8 +370,13 @@ 302 @@ -324,8 +359,13 @@ static inline void scale2x_16_mmx_single(scale2x_uint16* ds t, const scale2x_uint
627 "movq %%mm2, %%mm3\n" 303 "movq %%mm2, %%mm3\n"
628 "punpcklwd %%mm4, %%mm2\n" 304 "punpcklwd %%mm4, %%mm2\n"
629 "punpckhwd %%mm4, %%mm3\n" 305 "punpckhwd %%mm4, %%mm3\n"
630 +#if defined(__x86_64__) 306 +#if defined(__x86_64__)
631 + "movq %%mm2, %%nacl:(%%r15,%q3)\n" 307 + "movq %%mm2, %%nacl:(%%r15,%q3)\n"
632 + "movq %%mm3, %%nacl:8(%%r15,%q3)\n" 308 + "movq %%mm3, %%nacl:8(%%r15,%q3)\n"
633 +#else 309 +#else
634 "movq %%mm2, (%3)\n" 310 "movq %%mm2, (%3)\n"
635 "movq %%mm3, 8(%3)\n" 311 "movq %%mm3, 8(%3)\n"
636 +#endif 312 +#endif
637 313
638 /* next */ 314 /* next */
639 "add $8, %0\n" 315 "add $8, %0\n"
640 @@ -367,9 +407,15 @@ 316 @@ -355,9 +395,15 @@ static inline void scale2x_32_mmx_single(scale2x_uint32* ds t, const scale2x_uint
641 "0:\n" 317 "0:\n"
642 318
643 /* set the current, current_pre, current_next registers */ 319 /* set the current, current_pre, current_next registers */
644 +#if defined(__x86_64__) 320 +#if defined(__x86_64__)
645 + "movq %%nacl:-8(%%r15,%q1), %%mm0\n" 321 + "movq %%nacl:-8(%%r15,%q1), %%mm0\n"
646 + "movq %%nacl:(%%r15,%q1), %%mm7\n" 322 + "movq %%nacl:(%%r15,%q1), %%mm7\n"
647 + "movq %%nacl:8(%%r15,%q1), %%mm1\n" 323 + "movq %%nacl:8(%%r15,%q1), %%mm1\n"
648 +#else 324 +#else
649 "movq -8(%1), %%mm0\n" 325 "movq -8(%1), %%mm0\n"
650 "movq (%1), %%mm7\n" 326 "movq (%1), %%mm7\n"
651 "movq 8(%1), %%mm1\n" 327 "movq 8(%1), %%mm1\n"
652 +#endif 328 +#endif
653 "psrlq $32, %%mm0\n" 329 "psrlq $32, %%mm0\n"
654 "psllq $32, %%mm1\n" 330 "psllq $32, %%mm1\n"
655 "movq %%mm7, %%mm2\n" 331 "movq %%mm7, %%mm2\n"
656 @@ -380,7 +426,11 @@ 332 @@ -368,7 +414,11 @@ static inline void scale2x_32_mmx_single(scale2x_uint32* ds t, const scale2x_uint
657 "por %%mm3, %%mm1\n" 333 "por %%mm3, %%mm1\n"
658 334
659 /* current_upper */ 335 /* current_upper */
660 +#if defined(__x86_64__) 336 +#if defined(__x86_64__)
661 + "movq %%nacl:(%%r15,%q0), %%mm6\n" 337 + "movq %%nacl:(%%r15,%q0), %%mm6\n"
662 +#else 338 +#else
663 "movq (%0), %%mm6\n" 339 "movq (%0), %%mm6\n"
664 +#endif 340 +#endif
665 341
666 /* compute the upper-left pixel for dst on %%mm2 */ 342 /* compute the upper-left pixel for dst on %%mm2 */
667 /* compute the upper-right pixel for dst on %%mm4 */ 343 /* compute the upper-right pixel for dst on %%mm4 */
668 @@ -390,8 +440,13 @@ 344 @@ -378,8 +428,13 @@ static inline void scale2x_32_mmx_single(scale2x_uint32* ds t, const scale2x_uint
669 "movq %%mm1, %%mm5\n" 345 "movq %%mm1, %%mm5\n"
670 "pcmpeqd %%mm6, %%mm2\n" 346 "pcmpeqd %%mm6, %%mm2\n"
671 "pcmpeqd %%mm6, %%mm4\n" 347 "pcmpeqd %%mm6, %%mm4\n"
672 +#if defined(__x86_64__) 348 +#if defined(__x86_64__)
673 + "pcmpeqd %%nacl:(%%r15,%q2), %%mm3\n" 349 + "pcmpeqd %%nacl:(%%r15,%q2), %%mm3\n"
674 + "pcmpeqd %%nacl:(%%r15,%q2), %%mm5\n" 350 + "pcmpeqd %%nacl:(%%r15,%q2), %%mm5\n"
675 +#else 351 +#else
676 "pcmpeqd (%2), %%mm3\n" 352 "pcmpeqd (%2), %%mm3\n"
677 "pcmpeqd (%2), %%mm5\n" 353 "pcmpeqd (%2), %%mm5\n"
678 +#endif 354 +#endif
679 "pandn %%mm2, %%mm3\n" 355 "pandn %%mm2, %%mm3\n"
680 "pandn %%mm4, %%mm5\n" 356 "pandn %%mm4, %%mm5\n"
681 "movq %%mm0, %%mm2\n" 357 "movq %%mm0, %%mm2\n"
682 @@ -413,8 +468,13 @@ 358 @@ -401,8 +456,13 @@ static inline void scale2x_32_mmx_single(scale2x_uint32* ds t, const scale2x_uint
683 "movq %%mm2, %%mm3\n" 359 "movq %%mm2, %%mm3\n"
684 "punpckldq %%mm4, %%mm2\n" 360 "punpckldq %%mm4, %%mm2\n"
685 "punpckhdq %%mm4, %%mm3\n" 361 "punpckhdq %%mm4, %%mm3\n"
686 +#if defined(__x86_64__) 362 +#if defined(__x86_64__)
687 + "movq %%mm2, %%nacl:(%%r15,%q3)\n" 363 + "movq %%mm2, %%nacl:(%%r15,%q3)\n"
688 + "movq %%mm3, %%nacl:8(%%r15,%q3)\n" 364 + "movq %%mm3, %%nacl:8(%%r15,%q3)\n"
689 +#else 365 +#else
690 "movq %%mm2, (%3)\n" 366 "movq %%mm2, (%3)\n"
691 "movq %%mm3, 8(%3)\n" 367 "movq %%mm3, 8(%3)\n"
692 +#endif 368 +#endif
693 369
694 /* next */ 370 /* next */
695 "add $8, %0\n" 371 "add $8, %0\n"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698