Subversion Repositories eduke32

Rev

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