+ bool invert = (cursor == startFile + i ? true : false);
+ char buf[41];
+ // Guarantee that we clip our strings to fit in the screen...
+ memcpy(buf, &names[(startFile + i) * 2048], 38);
+ buf[38] = 0;
+ DrawText(backbuffer, 0, i*8, invert, " %s ", buf);
+ }
+
+
+ if (SDL_MUSTLOCK(surface))
+ while (SDL_LockSurface(surface) < 0)
+ SDL_Delay(10);
+
+// memcpy(surface->pixels, backbuffer, tom_width * tom_height * 2);
+ memcpy(surface->pixels, backbuffer, tom_getVideoModeWidth() * tom_getVideoModeHeight() * 2);
+
+ if (SDL_MUSTLOCK(surface))
+ SDL_UnlockSurface(surface);
+
+ SDL_Rect srcrect, dstrect;
+ srcrect.x = srcrect.y = 0, srcrect.w = surface->w, srcrect.h = surface->h;
+ dstrect.x = dstrect.y = 0, dstrect.w = surface->w, dstrect.h = surface->h;
+ SDL_BlitSurface(surface, &srcrect, mainSurface, &dstrect);
+ SDL_Flip(mainSurface);
+
+
+ if (event.type == SDL_KEYDOWN)
+ {
+ switch (event.key.keysym.sym)
+ {
+ case SDLK_UP:
+ if (cursor != 0)
+ cursor--;
+ break;
+ case SDLK_DOWN:
+ if (cursor != numFiles - 1)
+ cursor++;
+ break;
+ case SDLK_RETURN:
+ done = true;
+ break;
+ }