Subversion Repositories eduke32

Rev

Rev 4989 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4386 terminx 1
/*
2
 *
3
 * Designed by Emile Belanger
4
 *
5
 */
6
 
7
#include <stdlib.h>
8
#include <stdio.h>
9
#include <string.h>
10
#include <jni.h>
11
#include <android/log.h>
12
 
13
#include "SDL_scancode.h"
4434 terminx 14
#include "SDL_main.h"
4386 terminx 15
 
16
#include "TouchControlsContainer.h"
4434 terminx 17
#include "JNITouchControlsUtils.h"
18
 
4440 terminx 19
#ifdef GP_LIC
20
#include "s-setup/s-setup.h"
21
#endif
22
 
4989 terminx 23
extern "C" {
4529 terminx 24
#define DEFAULT_FADE_FRAMES 10
25
 
4989 terminx 26
extern void SDL_Android_Init(JNIEnv *env, jclass cls);
27
// This is a new function I put into SDL2, file SDL_androidgl.c
4386 terminx 28
extern void SDL_SetSwapBufferCallBack(void (*pt2Func)(void));
29
 
4989 terminx 30
extern char const *G_GetStringFromSavegame(const char *filename, int type);
31
extern int32_t G_GetScreenshotFromSavegame(const char *filename, char *pal, char *data);
32
 
4386 terminx 33
#include "in_android.h"
4433 terminx 34
#include "../function.h"
4386 terminx 35
 
36
#include "../GL/gl.h"
37
 
4989 terminx 38
// Copied from build.h, which didnt include here
39
enum rendmode_t
40
{
4440 terminx 41
    REND_CLASSIC,
42
    REND_POLYMOST = 3,
43
    REND_POLYMER
44
};
45
 
4989 terminx 46
enum dukeinv_t
47
{
48
    GET_STEROIDS,  // 0
49
    GET_SHIELD,
50
    GET_SCUBA,
51
    GET_HOLODUKE,
52
    GET_JETPACK,
53
    GET_DUMMY1,  // 5
54
    GET_ACCESS,
55
    GET_HEATS,
56
    GET_DUMMY2,
57
    GET_FIRSTAID,
58
    GET_BOOTS,  // 10
59
    GET_MAX
60
};
61
 
62
 
4386 terminx 63
#ifndef LOGI
4989 terminx 64
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "DUKE", __VA_ARGS__))
4386 terminx 65
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "DUKE", __VA_ARGS__))
4989 terminx 66
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "DUKE", __VA_ARGS__))
4386 terminx 67
#endif
68
 
4989 terminx 69
#define REND_SOFT 0
70
#define REND_GL 1
4386 terminx 71
 
4436 terminx 72
droidsysinfo_t droidinfo;
73
 
4386 terminx 74
static int curRenderer;
75
 
4693 terminx 76
static bool hideTouchControls = true;
77
static int weaponWheelVisible = false;
78
 
79
 
4386 terminx 80
static int controlsCreated = 0;
81
touchcontrols::TouchControlsContainer controlsContainer;
82
 
4989 terminx 83
touchcontrols::TouchControls *tcBlankTap = 0;
84
touchcontrols::TouchControls *tcYesNo = 0;
85
touchcontrols::TouchControls *tcMenuMain = 0;
86
touchcontrols::TouchControls *tcGameMain = 0;
87
touchcontrols::TouchControls *tcGameWeapons = 0;
88
// touchcontrols::TouchControls *tcInventory=0;
89
touchcontrols::TouchControls *tcAutomap = 0;
4386 terminx 90
 
91
 
92
touchcontrols::TouchJoy *touchJoyLeft;
93
touchcontrols::WheelSelect *weaponWheel;
94
 
4989 terminx 95
extern JNIEnv *env_;
96
JavaVM *jvm_;
4386 terminx 97
 
4989 terminx 98
touchcontrols::Button *inv_buttons[GET_MAX];
99
 
5000 terminx 100
std::string obbPath;
101
std::string gamePath;
102
 
4386 terminx 103
void openGLStart()
104
{
4434 terminx 105
    if (curRenderer == REND_GL)
106
    {
107
        glPushMatrix();
4386 terminx 108
 
4434 terminx 109
        glMatrixMode(GL_PROJECTION);
110
        glLoadIdentity();
4989 terminx 111
        glOrthof(0, droidinfo.screen_width, droidinfo.screen_height, 0, 0, 1);
4386 terminx 112
 
4989 terminx 113
        // glClearColor(1.0f, 1.0f, 0.0f, 1.0f);
114
        // glClear(GL_COLOR_BUFFER_BIT);
115
        // LOGI("openGLStart");
4434 terminx 116
        glDisable(GL_ALPHA_TEST);
117
        glDisable(GL_DEPTH_TEST);
118
        glDisable(GL_FOG);
119
        glEnable(GL_TEXTURE_2D);
4989 terminx 120
        glEnable(GL_BLEND);
4386 terminx 121
 
4989 terminx 122
        glColor4f(1, 1, 1, 1);
4386 terminx 123
 
4434 terminx 124
        glDisableClientState(GL_COLOR_ARRAY);
125
        glEnableClientState(GL_VERTEX_ARRAY);
4989 terminx 126
        glEnableClientState(GL_TEXTURE_COORD_ARRAY);
4386 terminx 127
 
4434 terminx 128
        glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
4386 terminx 129
 
4434 terminx 130
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
4386 terminx 131
 
4434 terminx 132
        glDisable(GL_CULL_FACE);
4386 terminx 133
 
4434 terminx 134
        glMatrixMode(GL_MODELVIEW);
4386 terminx 135
 
4989 terminx 136
        // nanoPushState();
4434 terminx 137
    }
4989 terminx 138
/*
139
    else  // software mode
4434 terminx 140
    {
141
        glDisable(GL_ALPHA_TEST);
142
        glDisableClientState(GL_COLOR_ARRAY);
143
        glEnableClientState(GL_VERTEX_ARRAY);
4989 terminx 144
        glEnableClientState(GL_TEXTURE_COORD_ARRAY);
4434 terminx 145
        glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
4989 terminx 146
        glEnable(GL_BLEND);
4434 terminx 147
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
148
        glEnable(GL_TEXTURE_2D);
149
        glDisable(GL_CULL_FACE);
150
        glMatrixMode(GL_MODELVIEW);
151
    }
4989 terminx 152
*/
4386 terminx 153
}
154
 
155
void openGLEnd()
156
{
4434 terminx 157
    if (curRenderer == REND_GL)
158
    {
4989 terminx 159
        // glPopMatrix();
160
        // nanoPopState();
4434 terminx 161
        glPopMatrix();
162
    }
4989 terminx 163
/*
164
    else  // Software mode
4434 terminx 165
    {
166
        glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
167
        glMatrixMode(GL_MODELVIEW);
168
    }
4989 terminx 169
*/
4386 terminx 170
}
171
 
172
void gameSettingsButton(int state)
173
{
4434 terminx 174
    if (state == 1)
175
    {
176
        showTouchSettings();
177
    }
4386 terminx 178
}
179
 
4989 terminx 180
// Because there is no Frame(), we need to check back to java each frame to see if the app hase paused
4386 terminx 181
 
4989 terminx 182
/*
4386 terminx 183
static jclass NativeLibClass = 0;
184
static jmethodID checkPauseMethod = 0;
4434 terminx 185
 
4386 terminx 186
void swapBuffers()
187
{
4434 terminx 188
    if (NativeLibClass == 0)
189
    {
4989 terminx 190
        NativeLibClass = env_->FindClass("com/voidpoint/duke3d/engine/NativeLib");
4434 terminx 191
        checkPauseMethod = env_->GetStaticMethodID(NativeLibClass, "swapBuffers", "()V");
192
    }
193
    env_->CallStaticVoidMethod(NativeLibClass, checkPauseMethod);
4386 terminx 194
}
4989 terminx 195
*/
4386 terminx 196
 
4989 terminx 197
// This is a bit of a hack, if the weapon wheel was selected, then an inv chosen instead, we need to cancel the weapon
198
// selection
199
// NOT needed actually, weapon wheel disabled before is get finger up anyway
200
// static bool invWasSelected = false;
4693 terminx 201
 
202
void showWeaponsInventory(bool show)
203
{
204
    if (show)
205
    {
4989 terminx 206
        for (int n = 0; n < 10; n++)
4693 terminx 207
        {
208
            weaponWheel->setSegmentEnabled(n, (PortableRead(READ_WEAPONS) >> n) & 0x1);
209
        }
210
 
4989 terminx 211
        // Show inventory buttons
4693 terminx 212
        tcGameWeapons->setAllButtonsEnable(true);
213
 
4989 terminx 214
        tcGameWeapons->fade(touchcontrols::FADE_IN, 5);  // fade in
4693 terminx 215
        weaponWheelVisible = true;
216
    }
4989 terminx 217
    else  // hide
4693 terminx 218
    {
219
        tcGameWeapons->setAllButtonsEnable(false);
220
        weaponWheel->setTapMode(false);
221
        weaponWheelVisible = false;
222
    }
223
}
224
 
4433 terminx 225
void gameButton(int state, int code)
4386 terminx 226
{
4433 terminx 227
    switch (code)
228
    {
4989 terminx 229
        case gamefunc_Fire:
230
            if (state && PortableRead(READ_SOMETHINGONPLAYER))
231
            {
232
                PortableAction(1, gamefunc_Quick_Kick);
233
                PortableAction(0, gamefunc_Quick_Kick);
234
            }
235
            else PortableAction(state, code);
236
            break;
4386 terminx 237
 
4989 terminx 238
        case KEY_SHOW_KBRD:
239
            if (state)
240
                toggleKeyboard();
4433 terminx 241
 
4989 terminx 242
            PortableKeyEvent(state, SDL_SCANCODE_GRAVE, 0);
243
            break;
4433 terminx 244
 
4989 terminx 245
        case KEY_QUICK_CMD:
246
            if (state == 1)
247
                showCustomCommands();
248
            break;
4433 terminx 249
 
4989 terminx 250
        case KEY_SHOW_INVEN:
251
            if (state)
4693 terminx 252
            {
4989 terminx 253
                if (!weaponWheelVisible)
254
                {
255
                    weaponWheel->setTapMode(true);
256
                    showWeaponsInventory(true);
257
                }
258
                else
259
                    showWeaponsInventory(false);
4693 terminx 260
            }
4989 terminx 261
            break;
4433 terminx 262
 
4989 terminx 263
        case KEY_QUICK_SAVE:
264
            LOGI("QUICK SAVE");
265
            PortableKeyEvent(state, SDL_SCANCODE_F6, 0);
266
            break;
4433 terminx 267
 
4989 terminx 268
        case KEY_QUICK_LOAD:
269
            LOGI("QUICK LOAD");
270
            PortableKeyEvent(state, SDL_SCANCODE_F9, 0);
271
            break;
4433 terminx 272
 
4989 terminx 273
        default: PortableAction(state, code); break;
4433 terminx 274
    }
4386 terminx 275
}
276
 
4989 terminx 277
void automapButton(int state, int code) { PortableAction(state, code); }
4386 terminx 278
 
4989 terminx 279
void inventoryButton(int state, int code)
4386 terminx 280
{
4989 terminx 281
    PortableAction(state, code);
4434 terminx 282
    if (state == 0)
283
    {
4989 terminx 284
        // Inventory chosen, hide them and wheel
4693 terminx 285
        showWeaponsInventory(false);
4434 terminx 286
    }
4386 terminx 287
}
288
 
4989 terminx 289
void menuButton(int state, int code) { PortableKeyEvent(state, code, code); }
290
 
291
void menuMouse(int action, float x, float y, float dx, float dy)
4386 terminx 292
{
4989 terminx 293
    // PortableMouse(dx,dy);
294
    PortableMouseMenu(x * droidinfo.screen_width, y * droidinfo.screen_height);
295
 
296
    if (action == MULTITOUCHMOUSE_DOWN || action == MULTITOUCHMOUSE_UP)
297
        PortableMouseMenuButton(action == MULTITOUCHMOUSE_DOWN, 0);
4386 terminx 298
}
299
 
4989 terminx 300
void blankTapButton(int state, int code)
4386 terminx 301
{
4989 terminx 302
    if (PortableRead(READ_IS_DEAD))  // if the player is dead we need to send a 'open' button
4433 terminx 303
    {
4693 terminx 304
        if (state)
4529 terminx 305
        {
4693 terminx 306
            PortableAction(1, gamefunc_Open);
307
            PortableAction(0, gamefunc_Open);
4529 terminx 308
        }
309
    }
4989 terminx 310
    else  // everything else send a return key
311
        PortableKeyEvent(state, SDL_SCANCODE_RETURN, 0);
4693 terminx 312
}
313
 
4989 terminx 314
void weaponWheelSelected(int enabled) { showWeaponsInventory(enabled ? true : false); }
4433 terminx 315
 
4386 terminx 316
void weaponWheelChosen(int segment)
317
{
4989 terminx 318
    // LOGI("weaponWheel %d",segment);
319
    if (segment == -1 && droidinput.quickSelectWeapon)
320
        segment = PortableRead(READ_LASTWEAPON);
4433 terminx 321
 
4989 terminx 322
    if (segment != -1)
4693 terminx 323
        PortableAction(2, gamefunc_Weapon_1 + segment);
4386 terminx 324
}
325
 
326
void left_double_tap(int state)
327
{
4989 terminx 328
    // LOGI("L double %d, droidinput.left_double_action = %d",state,droidinput.left_double_action);
4439 terminx 329
    if (droidinput.left_double_action != -1)
330
        PortableAction(state, droidinput.left_double_action);
4386 terminx 331
}
332
 
333
void right_double_tap(int state)
334
{
4989 terminx 335
    // LOGTOUCH("R double %d",state);
4439 terminx 336
    if (droidinput.right_double_action != -1)
337
        PortableAction(state, droidinput.right_double_action);
4386 terminx 338
}
339
 
4434 terminx 340
void mouseMove(int action, float x, float y, float dx, float dy)
4386 terminx 341
{
4989 terminx 342
    // LOGI(" mouse dx = %f, dy = %f",dx,dy);
4434 terminx 343
    if (weaponWheelVisible)
344
        return;
345
 
4989 terminx 346
    float const scale = .1f;
4434 terminx 347
 
4989 terminx 348
    PortableLook(dx * droidinput.yaw_sens * scale, -dy * droidinput.pitch_sens * scale * (droidinput.invertLook ? -1.f : 1.f));
4386 terminx 349
}
350
 
4989 terminx 351
void automap_multitouch_mouse_move(int action, float x, float y, float dx, float dy)
4693 terminx 352
{
353
    if (action == MULTITOUCHMOUSE_MOVE)
4989 terminx 354
        PortableAutomapControl(0, dx, dy);
4693 terminx 355
    else if (action == MULTITOUCHMOUSE_ZOOM)
4989 terminx 356
        PortableAutomapControl(x, 0, 0);
4693 terminx 357
}
358
 
4434 terminx 359
void left_stick(float joy_x, float joy_y, float mouse_x, float mouse_y)
4386 terminx 360
{
4989 terminx 361
    // LOGI("left_stick joy_x = %f, joy_y = %f",joy_x,joy_y);
362
    PortableMove(joy_y * droidinput.forward_sens, -joy_x * droidinput.strafe_sens);
4386 terminx 363
}
364
 
4989 terminx 365
/*
4434 terminx 366
void right_stick(float joy_x, float joy_y, float mouse_x, float mouse_y)
4386 terminx 367
{
4434 terminx 368
    mouseMove(0, joy_x, joy_y, mouse_x, mouse_y);
4386 terminx 369
}
4989 terminx 370
*/
4386 terminx 371
 
372
void setHideSticks(bool v)
373
{
4989 terminx 374
    if (touchJoyLeft)
375
        touchJoyLeft->setHideGraphics(v);
4386 terminx 376
}
377
 
378
void touchSettingsButton(int state)
379
{
4529 terminx 380
    /*
4433 terminx 381
    int32_t paused = PortableRead(READ_PAUSED);
382
 
4434 terminx 383
    //We wanna pause the game when doing settings
384
    if (state && !paused || !state && paused)
385
    {
4436 terminx 386
        PortableKeyEvent(2, SDL_SCANCODE_PAUSE, 0);
4434 terminx 387
    }
4529 terminx 388
     */
4386 terminx 389
}
390
 
5000 terminx 391
void initControls(int width, int height, const char *graphics_path)
4386 terminx 392
{
4434 terminx 393
    touchcontrols::GLScaleWidth = (float)width;
5000 terminx 394
    touchcontrols::GLScaleHeight = (float)-height;
4386 terminx 395
 
5000 terminx 396
    LOGI("initControls %d x %d,x path = %s", width, height, graphics_path);
4386 terminx 397
 
4434 terminx 398
    if (!controlsCreated)
399
    {
400
        LOGI("creating controls");
4386 terminx 401
 
4434 terminx 402
        touchcontrols::setGraphicsBasePath(graphics_path);
4386 terminx 403
 
4989 terminx 404
        controlsContainer.openGL_start.connect(sigc::ptr_fun(&openGLStart));
405
        controlsContainer.openGL_end.connect(sigc::ptr_fun(&openGLEnd));
406
        controlsContainer.signal_settings.connect(sigc::ptr_fun(&touchSettingsButton));
4386 terminx 407
 
4989 terminx 408
        tcBlankTap = new touchcontrols::TouchControls("blank_tap", false, false);
409
        tcYesNo = new touchcontrols::TouchControls("yes_no", false, false);
410
        tcMenuMain = new touchcontrols::TouchControls("menu", false, false);
411
        tcGameMain = new touchcontrols::TouchControls("game", false, true, 1, true);
412
        tcGameWeapons = new touchcontrols::TouchControls("weapons", false, true, 1, false);
413
        tcAutomap = new touchcontrols::TouchControls("automap", false, false);
4693 terminx 414
        // tcInventory   = new touchcontrols::TouchControls("inventory", false,true,1,false);
4386 terminx 415
 
4529 terminx 416
        ///////////////////////// BLANK TAP SCREEN //////////////////////
4386 terminx 417
 
4989 terminx 418
        // One button on whole screen with no graphic, send a return key
419
        tcBlankTap->addControl(new touchcontrols::Button("whole_screen", touchcontrols::RectF(0, 0, 26, 16),
420
                                                         "" /*std::string("test")*/, SDL_SCANCODE_RETURN));
421
        tcBlankTap->signal_button.connect(sigc::ptr_fun(&blankTapButton));  // Just reuse the menuButton function
4386 terminx 422
 
4529 terminx 423
 
424
        ///////////////////////// YES NO SCREEN /////////////////////
425
 
4989 terminx 426
        tcYesNo->addControl(
5000 terminx 427
        new touchcontrols::Button("enter", touchcontrols::RectF(16, 9, 18, 11), "yes", SDL_SCANCODE_RETURN));
4989 terminx 428
        tcYesNo->addControl(
5000 terminx 429
        new touchcontrols::Button("esc", touchcontrols::RectF(8, 9, 10, 11), "no", SDL_SCANCODE_ESCAPE));
4989 terminx 430
        tcYesNo->signal_button.connect(sigc::ptr_fun(&menuButton));  // Just reuse the menuButton function
4529 terminx 431
 
432
 
433
        ///////////////////////// MAIN MENU SCREEN /////////////////////
434
 
4989 terminx 435
        /*
436
        tcMenuMain->addControl(new touchcontrols::Button("down_arrow",  touchcontrols::RectF(22,14,24,16),
437
        "arrow_down",   SDL_SCANCODE_DOWN,  true)); //Repeating buttons
438
        tcMenuMain->addControl(new touchcontrols::Button("up_arrow",    touchcontrols::RectF(22,12,24,14),  "arrow_up",
439
        SDL_SCANCODE_UP,    true));
440
        tcMenuMain->addControl(new touchcontrols::Button("left_arrow",  touchcontrols::RectF(20,14,22,16),
441
        "arrow_left",   SDL_SCANCODE_LEFT,  true));
442
        tcMenuMain->addControl(new touchcontrols::Button("right_arrow", touchcontrols::RectF(24,14,26,16),
443
        "arrow_right",  SDL_SCANCODE_RIGHT, true));
444
        tcMenuMain->addControl(new touchcontrols::Button("enter",       touchcontrols::RectF(0,14,2,16),    "enter",
445
        SDL_SCANCODE_RETURN));
446
        tcMenuMain->setAlpha(1);
4693 terminx 447
         */
4386 terminx 448
 
5000 terminx 449
        tcMenuMain->addControl(new touchcontrols::Button("arrow_left", touchcontrols::RectF(0, 2, 2, 4), "arrow_left",
450
            SDL_SCANCODE_ESCAPE));
451
        tcMenuMain->signal_button.connect(sigc::ptr_fun(&menuButton));
452
 
4989 terminx 453
        touchcontrols::MultitouchMouse *mouseMenu =
454
        new touchcontrols::MultitouchMouse("mouse", touchcontrols::RectF(0, 0, 26, 16), "");
455
        mouseMenu->setHideGraphics(true);
456
        tcMenuMain->addControl(mouseMenu);
457
        mouseMenu->signal_action.connect(sigc::ptr_fun(&menuMouse));
4386 terminx 458
 
4989 terminx 459
        touchcontrols::Button *console_button = new touchcontrols::Button(
460
            "keyboard", "Development console", touchcontrols::RectF(8, 0, 10, 2), "keyboard", KEY_SHOW_KBRD, false, true);
4693 terminx 461
 
4989 terminx 462
        tcMenuMain->addControl(console_button);
4693 terminx 463
 
4529 terminx 464
        //////////////////////////// GAME SCREEN /////////////////////
4989 terminx 465
        tcGameMain->setAlpha(droidinput.gameControlsAlpha);
466
        controlsContainer.editButtonAlpha = droidinput.gameControlsAlpha;
5000 terminx 467
 
4989 terminx 468
        tcGameMain->addControl(
5000 terminx 469
        new touchcontrols::Button("game_menu", touchcontrols::RectF(0, 0, 2, 2), "settings_bars", MENU_BACK));
470
 
471
        tcGameMain->addControl(
4989 terminx 472
        new touchcontrols::Button("use", touchcontrols::RectF(20, 4, 23, 7), "use", gamefunc_Open));
473
        tcGameMain->addControl(
474
        new touchcontrols::Button("attack", touchcontrols::RectF(20, 7, 23, 10), "fire2", gamefunc_Fire));
475
        tcGameMain->addControl(
476
        new touchcontrols::Button("jump", touchcontrols::RectF(23, 6, 26, 9), "jump", gamefunc_Jump));
477
        tcGameMain->addControl(
478
        new touchcontrols::Button("crouch", touchcontrols::RectF(24, 12, 26, 14), "crouch", gamefunc_Crouch));
479
        tcGameMain->addControl(new touchcontrols::Button("kick", "Mighty Foot", touchcontrols::RectF(23, 3, 26, 6),
480
                                                         "boot", gamefunc_Quick_Kick, false, true));
4386 terminx 481
 
4989 terminx 482
        touchcontrols::Button *map_button = new touchcontrols::Button(
483
        "map", "Overhead map", touchcontrols::RectF(6, 0, 8, 2), "map", gamefunc_Map, false, true);
4693 terminx 484
        tcGameMain->addControl(map_button);
4989 terminx 485
        tcGameMain->addControl(new touchcontrols::Button("show_inventory", "Inventory",
486
                                                         touchcontrols::RectF(24, 0, 26, 2), "inv", KEY_SHOW_INVEN));
487
        tcGameMain->addControl(new touchcontrols::Button("next_weapon", "Next weapon", touchcontrols::RectF(0, 3, 3, 5),
488
                                                         "next_weap", gamefunc_Next_Weapon, false, true));
489
        tcGameMain->addControl(new touchcontrols::Button("prev_weapon", "Previous weapon",
490
                                                         touchcontrols::RectF(0, 5, 3, 7), "prev_weap",
491
                                                         gamefunc_Previous_Weapon, false, true));
492
        tcGameMain->addControl(new touchcontrols::Button("quick_save", "Save game", touchcontrols::RectF(22, 0, 24, 2),
493
                                                         "save", KEY_QUICK_SAVE, false, true));
494
        tcGameMain->addControl(new touchcontrols::Button("quick_load", "Load game", touchcontrols::RectF(20, 0, 22, 2),
495
                                                         "load", KEY_QUICK_LOAD, false, true));
4386 terminx 496
 
4989 terminx 497
        tcGameMain->addControl(console_button);
4434 terminx 498
        /*
4989 terminx 499
                //quick actions binds
500
                tcGameMain->addControl(new
501
           touchcontrols::Button("quick_key_1",touchcontrols::RectF(4,3,6,5),"quick_key_1",KEY_QUICK_KEY1,false,true));
502
                tcGameMain->addControl(new
503
           touchcontrols::Button("quick_key_2",touchcontrols::RectF(6,3,8,5),"quick_key_2",KEY_QUICK_KEY2,false,true));
504
                tcGameMain->addControl(new
505
           touchcontrols::Button("quick_key_3",touchcontrols::RectF(8,3,10,5),"quick_key_3",KEY_QUICK_KEY3,false,true));
506
                tcGameMain->addControl(new
507
           touchcontrols::Button("quick_key_4",touchcontrols::RectF(10,3,12,5),"quick_key_4",KEY_QUICK_KEY4,false,true));
4529 terminx 508
         */
4989 terminx 509
        // Left stick
510
        touchJoyLeft = new touchcontrols::TouchJoy("stick", touchcontrols::RectF(0, 7, 8, 16), "strafe_arrow");
4434 terminx 511
        tcGameMain->addControl(touchJoyLeft);
4989 terminx 512
        touchJoyLeft->signal_move.connect(sigc::ptr_fun(&left_stick));
513
        touchJoyLeft->signal_double_tap.connect(sigc::ptr_fun(&left_double_tap));
4386 terminx 514
 
4989 terminx 515
        // Right stick (not used)
516
        // touchJoyRight = new touchcontrols::TouchJoy("touch",touchcontrols::RectF(17,7,26,16),"look_arrow");
517
        // tcGameMain->addControl(touchJoyRight);
518
        // touchJoyRight->signal_move.connect(sigc::ptr_fun(&right_stick) );
519
        // touchJoyRight->signal_double_tap.connect(sigc::ptr_fun(&right_double_tap) );
520
        // touchJoyRight->setEnabled(false);
4386 terminx 521
 
522
 
4989 terminx 523
        // Mouse look for whole screen
524
        touchcontrols::Mouse *mouse = new touchcontrols::Mouse("mouse", touchcontrols::RectF(3, 0, 26, 16), "");
4434 terminx 525
        mouse->signal_action.connect(sigc::ptr_fun(&mouseMove));
4989 terminx 526
        mouse->signal_double_tap.connect(sigc::ptr_fun(&right_double_tap));
4386 terminx 527
 
4434 terminx 528
        mouse->setHideGraphics(true);
529
        tcGameMain->addControl(mouse);
4386 terminx 530
 
4989 terminx 531
        tcGameMain->signal_button.connect(sigc::ptr_fun(&gameButton));
532
        tcGameMain->signal_settingsButton.connect(sigc::ptr_fun(&gameSettingsButton));
4386 terminx 533
 
4693 terminx 534
        ///////////////////////// AUTO MAP SCREEN ///////////////////////
4386 terminx 535
 
4693 terminx 536
 
4989 terminx 537
        // Automap
538
        touchcontrols::MultitouchMouse *multimouse =
539
        new touchcontrols::MultitouchMouse("gamemouse", touchcontrols::RectF(0, 0, 26, 16), "");
4693 terminx 540
        multimouse->setHideGraphics(true);
541
        tcAutomap->addControl(multimouse);
4989 terminx 542
        multimouse->signal_action.connect(sigc::ptr_fun(&automap_multitouch_mouse_move));
4693 terminx 543
        tcAutomap->addControl(map_button);
4989 terminx 544
        tcAutomap->signal_button.connect(sigc::ptr_fun(&gameButton));
4693 terminx 545
        tcAutomap->setAlpha(0.5);
546
 
4989 terminx 547
        // Now inventory in the weapons control group!
4693 terminx 548
 
4989 terminx 549
        inv_buttons[GET_JETPACK] = new touchcontrols::Button("jetpack", touchcontrols::RectF(0, 3, 2, 5), "jetpack",
550
                                                             gamefunc_Jetpack, false, false, true);
551
        inv_buttons[GET_FIRSTAID] = new touchcontrols::Button("medkit", touchcontrols::RectF(0, 5, 2, 7), "medkit",
552
                                                              gamefunc_MedKit, false, false, true);
553
        inv_buttons[GET_HEATS] = new touchcontrols::Button("nightv", touchcontrols::RectF(0, 7, 2, 9), "nightvision",
554
                                                           gamefunc_NightVision, false, false, true);
555
        inv_buttons[GET_HOLODUKE] = new touchcontrols::Button("holoduke", touchcontrols::RectF(0, 9, 2, 11), "holoduke",
556
                                                              gamefunc_Holo_Duke, false, false, true);
557
        inv_buttons[GET_STEROIDS] = new touchcontrols::Button("steroids", touchcontrols::RectF(0, 11, 2, 13),
558
                                                              "steroids", gamefunc_Steroids, false, false, true);
4693 terminx 559
 
4989 terminx 560
        tcGameWeapons->addControl(inv_buttons[GET_JETPACK]);
561
        tcGameWeapons->addControl(inv_buttons[GET_FIRSTAID]);
562
        tcGameWeapons->addControl(inv_buttons[GET_HEATS]);
563
        tcGameWeapons->addControl(inv_buttons[GET_HOLODUKE]);
564
        tcGameWeapons->addControl(inv_buttons[GET_STEROIDS]);
565
        // Inventory are the only buttons so safe to do this
566
        tcGameWeapons->signal_button.connect(sigc::ptr_fun(&inventoryButton));
4693 terminx 567
 
4989 terminx 568
        // Weapons
569
        weaponWheel = new touchcontrols::WheelSelect("weapon_wheel", touchcontrols::RectF(7, 2, 19, 14),
570
                                                     "weapon_wheel_orange_blank", 10);
571
        weaponWheel->signal_selected.connect(sigc::ptr_fun(&weaponWheelChosen));
4434 terminx 572
        weaponWheel->signal_enabled.connect(sigc::ptr_fun(&weaponWheelSelected));
573
        tcGameWeapons->addControl(weaponWheel);
4529 terminx 574
        tcGameWeapons->setAlpha(0.9);
4386 terminx 575
 
4529 terminx 576
        /////////////////////////////////////////////////////////////
577
 
578
 
4434 terminx 579
        controlsContainer.addControlGroup(tcMenuMain);
580
        controlsContainer.addControlGroup(tcGameMain);
4693 terminx 581
        //        controlsContainer.addControlGroup(tcInventory);//Need to be above tcGameMain incase buttons over stick
4434 terminx 582
        controlsContainer.addControlGroup(tcGameWeapons);
4693 terminx 583
        controlsContainer.addControlGroup(tcAutomap);
4529 terminx 584
        controlsContainer.addControlGroup(tcYesNo);
585
        controlsContainer.addControlGroup(tcBlankTap);
4434 terminx 586
        controlsCreated = 1;
4386 terminx 587
 
4989 terminx 588
        tcGameMain->setAlpha(droidinput.gameControlsAlpha);
589
        controlsContainer.editButtonAlpha = droidinput.gameControlsAlpha;
590
        tcGameWeapons->setAlpha(droidinput.gameControlsAlpha);
591
        tcMenuMain->setAlpha(droidinput.gameControlsAlpha);
4529 terminx 592
 
5000 terminx 593
        tcGameMain->setXMLFile(gamePath + "/control_layout_main.xml");
594
        tcGameWeapons->setXMLFile(gamePath + "/control_layout_weapons.xml");
595
        tcAutomap->setXMLFile(gamePath + "/control_layout_automap.xml");
4693 terminx 596
        // tcInventory->setXMLFile((std::string)graphics_path +  "/inventory.xml");
4386 terminx 597
 
4693 terminx 598
        setControlsContainer(&controlsContainer);
4434 terminx 599
    }
600
    else
601
        LOGI("NOT creating controls");
4386 terminx 602
 
4989 terminx 603
    // controlsContainer.initGL();
4386 terminx 604
}
605
 
4529 terminx 606
void updateTouchScreenMode(touchscreemode_t mode)
607
{
4693 terminx 608
    // LOGI("updateTouchScreenModeA %d",mode);
4440 terminx 609
 
4989 terminx 610
    static touchscreemode_t lastMode = TOUCH_SCREEN_BLANK;
4529 terminx 611
 
4989 terminx 612
    if (mode != lastMode)
613
    {
614
        // first disable the last screen and fade out is necessary
615
        switch (lastMode)
616
        {
617
            case TOUCH_SCREEN_BLANK:  // Does not exist yet break;
618
            case TOUCH_SCREEN_BLANK_TAP:
619
                tcBlankTap->resetOutput();
620
                tcBlankTap->setEnabled(false);  // Dont fade out as no graphics
621
                break;
622
            case TOUCH_SCREEN_YES_NO:
623
                tcYesNo->resetOutput();
624
                tcYesNo->fade(touchcontrols::FADE_OUT, DEFAULT_FADE_FRAMES);
625
                break;
626
            case TOUCH_SCREEN_MENU:
627
                tcMenuMain->resetOutput();
628
                tcMenuMain->fade(touchcontrols::FADE_OUT, DEFAULT_FADE_FRAMES);
629
                break;
630
            case TOUCH_SCREEN_GAME:
631
                tcGameMain->resetOutput();
4529 terminx 632
 
4989 terminx 633
                tcGameMain->fade(touchcontrols::FADE_OUT, DEFAULT_FADE_FRAMES);
634
                tcGameWeapons->setEnabled(false);
635
                break;
636
            case TOUCH_SCREEN_AUTOMAP:
637
                tcAutomap->resetOutput();
638
                tcAutomap->fade(touchcontrols::FADE_OUT, DEFAULT_FADE_FRAMES);
639
                break;
640
            case TOUCH_SCREEN_CONSOLE: break;
4529 terminx 641
        }
642
 
4989 terminx 643
        // Enable the current new screen
644
        switch (mode)
645
        {
646
            case TOUCH_SCREEN_BLANK:  // Does not exist yet break;
647
            case TOUCH_SCREEN_BLANK_TAP: tcBlankTap->setEnabled(true); break;
648
            case TOUCH_SCREEN_YES_NO:
649
                tcYesNo->setEnabled(true);
650
                tcYesNo->fade(touchcontrols::FADE_IN, DEFAULT_FADE_FRAMES);
651
                break;
652
            case TOUCH_SCREEN_MENU:
653
                tcMenuMain->setEnabled(true);
654
                tcMenuMain->fade(touchcontrols::FADE_IN, DEFAULT_FADE_FRAMES);
4693 terminx 655
 
4989 terminx 656
                // This is a bit of a hack, we need to enable the inventory buttons so they can be edited, they will not
657
                // be seen anyway
658
                showWeaponsInventory(true);
659
                break;
660
            case TOUCH_SCREEN_GAME:
661
                tcGameMain->setEnabled(true);
662
                tcGameMain->fade(touchcontrols::FADE_IN, DEFAULT_FADE_FRAMES);
663
                tcGameWeapons->setEnabled(true);
664
                showWeaponsInventory(false);
665
                break;
666
            case TOUCH_SCREEN_AUTOMAP:
667
                tcAutomap->setEnabled(true);
668
                tcAutomap->fade(touchcontrols::FADE_IN, DEFAULT_FADE_FRAMES);
669
                break;
670
            case TOUCH_SCREEN_CONSOLE: break;
4529 terminx 671
        }
672
 
673
        lastMode = mode;
674
    }
675
 
4989 terminx 676
    int inv = PortableRead(READ_INVENTORY);
677
 
678
    for (int i = 0; i < GET_MAX; ++i)
679
        if (inv_buttons[i])
680
            inv_buttons[i]->setAlpha(tcGameWeapons->getFadedAlpha() * ((inv & (1 << i)) ? 1.f : 0.3f));
4529 terminx 681
}
682
 
683
 
4440 terminx 684
#ifdef GP_LIC
685
#define GP_LIC_INC 1
686
#include "s-setup/gp_lic_include.h"
687
#endif
688
 
4989 terminx 689
extern char videomodereset;
690
extern int mobile_halted;
691
 
4386 terminx 692
void frameControls()
693
{
4989 terminx 694
    if (mobile_halted) return;
695
 
4433 terminx 696
    static int loadedGLImages = 0;
697
 
4989 terminx 698
    if (videomodereset)
699
    {
700
        loadedGLImages = -1;
701
        return;
702
    }
4529 terminx 703
 
4989 terminx 704
    // We need to do this here now because duke loads a new gl context
4693 terminx 705
 
4989 terminx 706
    if (loadedGLImages <= 0)
4434 terminx 707
    {
4989 terminx 708
        controlsContainer.initGL(loadedGLImages == -1);
4434 terminx 709
        loadedGLImages = 1;
710
    }
4386 terminx 711
 
4989 terminx 712
    //  LOGI("frameControls");
713
 
4434 terminx 714
    curRenderer = (PortableRead(READ_RENDERER) != REND_CLASSIC);
4386 terminx 715
 
4529 terminx 716
    updateTouchScreenMode((touchscreemode_t)PortableRead(READ_SCREEN_MODE));
717
 
4989 terminx 718
    setHideSticks(droidinput.hideStick);
4386 terminx 719
 
4989 terminx 720
    if (tcGameMain)
721
    {
722
        tcGameMain->setAlpha(droidinput.gameControlsAlpha);
723
        controlsContainer.editButtonAlpha = droidinput.gameControlsAlpha;
724
        tcGameWeapons->setAlpha(droidinput.gameControlsAlpha);
725
        tcMenuMain->setAlpha(droidinput.gameControlsAlpha);
726
        // tcInventory->setAlpha(droidinput.gameControlsAlpha);
727
    }
728
 
4434 terminx 729
    controlsContainer.draw();
4440 terminx 730
 
731
#ifdef GP_LIC
4529 terminx 732
#undef GP_LIC_INC
4440 terminx 733
#define GP_LIC_INC 2
734
#include "s-setup/gp_lic_include.h"
735
#endif
4386 terminx 736
}
737
 
4989 terminx 738
void setTouchSettings(int other)
4386 terminx 739
{
4436 terminx 740
    // TODO: defined names for these values
741
    hideTouchControls = other & 0x80000000 ? true : false;
4529 terminx 742
 
4989 terminx 743
    // keep in sync with Duke3d/res/values/strings.xml
744
    int doubletap_options[5] = { -1, gamefunc_Quick_Kick, gamefunc_AutoRun, gamefunc_MedKit, gamefunc_Jetpack };
4386 terminx 745
 
4989 terminx 746
    droidinput.left_double_action = doubletap_options[((other >> 4) & 0xF)];
747
    droidinput.right_double_action = doubletap_options[((other >> 8) & 0xF)];
4386 terminx 748
 
4989 terminx 749
    LOGI("setTouchSettings left_double_action = %d", droidinput.left_double_action);
4386 terminx 750
}
751
 
4989 terminx 752
#define EXPORT_ME __NDK_FPABI__ __attribute__((visibility("default")))
4386 terminx 753
 
4989 terminx 754
JNIEnv *env_;
4386 terminx 755
 
4989 terminx 756
int argc = 1;
757
const char *argv[32];
4386 terminx 758
 
5000 terminx 759
static inline const char *getGamePath() { return gamePath.c_str(); }
4386 terminx 760
 
4989 terminx 761
jint EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_init(JNIEnv *env, jobject thiz, jstring graphics_dir,
762
                                                               jint audio_rate, jint audio_buffer_size,
763
                                                               jobjectArray argsArray, jint renderer,
764
                                                               jstring jduke3d_path)
4386 terminx 765
{
4434 terminx 766
    env_ = env;
4386 terminx 767
 
4440 terminx 768
#ifdef GP_LIC
4529 terminx 769
    getGlobalClasses(env_);
4440 terminx 770
#endif
771
 
4436 terminx 772
    droidinfo.audio_sample_rate = audio_rate;
773
    droidinfo.audio_buffer_size = audio_buffer_size;
4386 terminx 774
 
4989 terminx 775
    // curRenderer = renderer;
4434 terminx 776
    curRenderer = REND_GL;
4386 terminx 777
 
4434 terminx 778
    argv[0] = "eduke32";
4989 terminx 779
    int argCount = (env)->GetArrayLength(argsArray);
780
    LOGI("argCount = %d", argCount);
781
    for (int i = 0; i < argCount; i++)
782
    {
783
        jstring string = (jstring)(env)->GetObjectArrayElement(argsArray, i);
784
        argv[argc] = (char *)(env)->GetStringUTFChars(string, 0);
785
        LOGI("arg = %s", argv[argc]);
4434 terminx 786
        argc++;
787
    }
4386 terminx 788
 
5000 terminx 789
    gamePath = std::string(env->GetStringUTFChars(jduke3d_path, NULL));
4386 terminx 790
 
4989 terminx 791
    // Change working dir, save games etc
4434 terminx 792
    // FIXME: potentially conflicts with chdirs in -game_dir support
793
    chdir(getGamePath());
794
    char timidity_env[512];
4386 terminx 795
 
4989 terminx 796
    sprintf(timidity_env, "TIMIDITY_CFG=%s/../timidity.cfg", getGamePath());
4434 terminx 797
    putenv(timidity_env);
4386 terminx 798
 
4989 terminx 799
    LOGI("duke3d_path = %s", getGamePath());
4386 terminx 800
 
4989 terminx 801
    const char *p = env->GetStringUTFChars(graphics_dir, NULL);
5000 terminx 802
    obbPath = std::string(p);
4386 terminx 803
 
5000 terminx 804
    LOGI("obbPath = %s", obbPath.c_str());
4386 terminx 805
 
5000 terminx 806
    initControls(droidinfo.screen_width, droidinfo.screen_height, (obbPath + "/assets/").c_str());
807
 
4434 terminx 808
    PortableInit(argc, argv);
4529 terminx 809
 
4434 terminx 810
    return 0;
4386 terminx 811
}
812
 
813
 
4989 terminx 814
jint EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_frame(JNIEnv *env, jobject thiz)
4386 terminx 815
{
4989 terminx 816
    LOGI("Java_com_voidpoint_duke3d_engine_NativeLib_frame");
4386 terminx 817
 
4989 terminx 818
//    frameControls();
4434 terminx 819
    return 0;
4386 terminx 820
}
821
 
4989 terminx 822
__attribute__((visibility("default"))) jint JNI_OnLoad(JavaVM *vm, void *reserved)
4386 terminx 823
{
4434 terminx 824
    LOGI("JNI_OnLoad");
825
    setTCJNIEnv(vm);
826
    jvm_ = vm;
827
    return JNI_VERSION_1_4;
4386 terminx 828
}
829
 
830
 
831
void EXPORT_ME
4989 terminx 832
Java_com_voidpoint_duke3d_engine_NativeLib_keypress(JNIEnv *env, jobject obj, jint down, jint keycode, jint unicode)
4386 terminx 833
{
4989 terminx 834
    LOGI("keypress %d", keycode);
4434 terminx 835
    if (controlsContainer.isEditing())
836
    {
4989 terminx 837
        if (down && (keycode == SDL_SCANCODE_ESCAPE))
4434 terminx 838
            controlsContainer.finishEditing();
4436 terminx 839
        return;
4434 terminx 840
    }
4436 terminx 841
 
4989 terminx 842
    PortableKeyEvent(down, keycode, unicode);
4386 terminx 843
}
844
 
845
 
4989 terminx 846
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_touchEvent(JNIEnv *env, jobject obj, jint action, jint pid,
847
                                                                     jfloat x, jfloat y)
4386 terminx 848
{
4989 terminx 849
    // LOGI("TOUCHED");
850
    controlsContainer.processPointer(action, pid, x, y);
4386 terminx 851
}
852
 
853
 
4989 terminx 854
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_doAction(JNIEnv *env, jobject obj, jint state, jint action)
4386 terminx 855
{
4989 terminx 856
    LOGI("doAction %d %d", state, action);
4434 terminx 857
 
4989 terminx 858
    // gamepadButtonPressed();
4434 terminx 859
    if (hideTouchControls && tcGameMain)
860
    {
861
        if (tcGameMain->isEnabled())
862
            tcGameMain->animateOut(30);
863
 
864
        if (tcGameWeapons->isEnabled())
865
            tcGameWeapons->animateOut(30);
866
    }
867
 
4989 terminx 868
    PortableAction(state, action);
4386 terminx 869
}
870
 
4989 terminx 871
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_analogFwd(JNIEnv *env, jobject obj, jfloat v)
4386 terminx 872
{
4440 terminx 873
    PortableMove(v, NAN);
4386 terminx 874
}
875
 
4989 terminx 876
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_analogSide(JNIEnv *env, jobject obj, jfloat v)
4386 terminx 877
{
4440 terminx 878
    PortableMove(NAN, v);
4386 terminx 879
}
880
 
4989 terminx 881
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_analogPitch(JNIEnv *env, jobject obj, jint mode, jfloat v)
4386 terminx 882
{
4440 terminx 883
    PortableLookJoystick(NAN, v);
4386 terminx 884
}
885
 
4989 terminx 886
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_analogYaw(JNIEnv *env, jobject obj, jint mode, jfloat v)
4386 terminx 887
{
4440 terminx 888
    PortableLookJoystick(v, NAN);
4386 terminx 889
}
890
 
4989 terminx 891
void EXPORT_ME
892
Java_com_voidpoint_duke3d_engine_NativeLib_setTouchSettings(JNIEnv *env, jobject obj, int other)
4386 terminx 893
{
4989 terminx 894
    setTouchSettings(other);
4386 terminx 895
}
896
 
4989 terminx 897
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_resetTouchSettings(JNIEnv *env, jobject obj)
4386 terminx 898
{
4434 terminx 899
    controlsContainer.resetDefaults();
4386 terminx 900
}
901
 
902
std::string quickCommandString;
4989 terminx 903
 
904
jint EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_quickCommand(JNIEnv *env, jobject obj, jstring command)
4386 terminx 905
{
4989 terminx 906
    const char *p = env->GetStringUTFChars(command, NULL);
907
    quickCommandString = std::string(p) + "\n";
4434 terminx 908
    env->ReleaseStringUTFChars(command, p);
909
    PortableCommand(quickCommandString.c_str());
4386 terminx 910
}
911
 
912
void EXPORT_ME
4989 terminx 913
Java_com_voidpoint_duke3d_engine_NativeLib_setScreenSize(JNIEnv *env, jobject thiz, jint width, jint height)
4386 terminx 914
{
4436 terminx 915
    droidinfo.screen_width = width;
916
    droidinfo.screen_height = height;
4386 terminx 917
}
918
 
4989 terminx 919
void EXPORT_ME Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv *env, jclass cls)
4386 terminx 920
{
4434 terminx 921
    /* This interface could expand with ABI negotiation, calbacks, etc. */
922
    SDL_Android_Init(env, cls);
923
    SDL_SetMainReady();
924
    // SDL_EventState(SDL_TEXTINPUT,SDL_ENABLE);
4386 terminx 925
}
926
 
4989 terminx 927
jstring EXPORT_ME
928
Java_com_voidpoint_duke3d_engine_NativeLib_getSavetext(JNIEnv *env, jobject obj, jstring jfile, jint type)
929
{
930
    const char *p = env->GetStringUTFChars(jfile, NULL);
931
 
932
    jstring ret = env->NewStringUTF(G_GetStringFromSavegame(p, type));
933
    env->ReleaseStringUTFChars(jfile, p);
934
 
935
    return ret;
936
}
937
 
938
jint EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_getScreenshot(JNIEnv *env, jobject obj, jstring jfile,
939
                                                                        jobject jpal, jobject jdataOut)
940
{
941
    const char *p = env->GetStringUTFChars(jfile, NULL);
942
 
943
    jbyte *bb = (jbyte *)env->GetDirectBufferAddress(jdataOut);
944
    jbyte *pb = (jbyte *)env->GetDirectBufferAddress(jpal);
945
 
946
    int ret = G_GetScreenshotFromSavegame(p, (char *)pb, (char *)bb);
947
 
948
    env->ReleaseStringUTFChars(jfile, p);
949
    return ret;
950
}
951
 
4440 terminx 952
#ifdef GP_LIC
4529 terminx 953
#undef GP_LIC_INC
4440 terminx 954
#define GP_LIC_INC 3
955
#include "s-setup/gp_lic_include.h"
956
#endif
4386 terminx 957
}