Search found 2336 matches

by VilleK
Mon Oct 14, 2024 7:21 am
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

I think the Fpc devs are developing on Linux and Mac so they rarely test compiler building on Windows. Maybe the "fixes_3_2" branch works better to build? https://github.com/fpc/FPCSource/tree/fixes_3_2 The CheckSynchronize call is only needed if we use the Synchronize method but ZGE does ...
by VilleK
Sat Oct 12, 2024 1:04 pm
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

That version is from 2021 but I see that is the latest released version.

It would be good to test with latest trunk version. If you feel up for it, please check how to build Freepascal from source.
by VilleK
Fri Oct 11, 2024 2:08 pm
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

The log look normal to me.

It seems to boil down to that there is some general problem with Freepascal and threads on Android 64-bit.

Please remind me how you install the Freepascal compiler. Do you build it from source (if so from what branch) or do you use a prebuilt version?
by VilleK
Thu Oct 10, 2024 4:19 pm
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

The "2" parameter is the number of local Java handles needed. You can try raising it to 20. The nil in pop seems to be ok, it just indicates that we do not need a result. I'm not sure why simply calling BeginThread will causing things to fail. Do you still have cthreads as first unit in Zz...
by VilleK
Thu Oct 10, 2024 1:34 pm
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

Maybe we should try disabling more specific stuff. What happens if you comment out this line:

env^.CallNonvirtualIntMethodA(env, track, cAudioTrack, mWrite ..
by VilleK
Thu Oct 10, 2024 11:56 am
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

Indeed, it seems you should always use the "A" version over the "V" version for 64-bit, I forgot that in the code I posted. While the game is running, the code will stay in the "while not AudioTerminated do" loop. So the "mRelease" part is for cleanup when the...
by VilleK
Thu Oct 10, 2024 8:18 am
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

Try this change:

Code: Select all

      
      MixAndCopyData(PBuffer, Min(OnePassSize, bufferSizeInBytes));
      env^.ReleasePrimitiveArrayCritical(env, buffer, pBuffer, 0);
      env^.CallNonvirtualIntMethodV(env, track, cAudioTrack, mWrite, C([buffer, 0, Min(OnePassSize, bufferSizeInBytes)]));
by VilleK
Wed Oct 09, 2024 4:48 pm
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

Try adding this line as first line in C function:

Fillchar(Params, SizeOf(Params), 0);
by VilleK
Wed Oct 09, 2024 9:29 am
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

Aha, sorry it should be "VPointer" and "PJValue".

I'm impressed with the solutions that ChatGPT suggest for you, they are better than expected.
by VilleK
Wed Oct 09, 2024 9:03 am
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

Try this change:

Code: Select all

  Params : array[0..10] of JValue;

  function C(const args : array of const) : JValue;
  var
    I : integer;
  begin
     for I := 0 to High(args) do
       Params[I] := args[I].vtPointer;
     Result := @Params;
  end;
by VilleK
Wed Oct 09, 2024 8:15 am
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

Try changing to NewObjectA.
by VilleK
Wed Oct 09, 2024 6:57 am
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

Ok, let's keep trying and focus on jni.

1. Undo the changes to the two files that I suggested.
2. Then change the CallStaticIntMethodV to CallStaticIntMethodA like this:

Code: Select all

  bufferSizeInBytes := Env^.CallStaticIntMethodA(env, cAudioTrack, mGetMinBufferSize, C([AudioPlayer.AudioRate, 3, 2]));
by VilleK
Tue Oct 08, 2024 11:40 am
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

Seems it is the "C" function that converts arguments that does not work on 64-bits.

Please try the attached changes to jni.pas and ZPlatform_Android.inc.
by VilleK
Tue Oct 08, 2024 10:07 am
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

Also I just noticed the constant to choose stereo is 12 and not 2: https://developer.android.com/reference/android/media/AudioFormat#CHANNEL_OUT_STEREO So you could try changing 2 to 12 like this: bufferSizeInBytes := Env^.CallStaticIntMethodV(env, cAudioTrack, mGetMinBufferSize, C([AudioPlayer.Audi...
by VilleK
Tue Oct 08, 2024 9:51 am
Forum: General discussion
Topic: Google Play New problem : 64bits
Replies: 180
Views: 40799

Re: Google Play New problem : 64bits

Try printing the bufferSizeInBytes value after it is assigned in ZPlatform_Android.

Platform_error('audio buffer size: ' + inttostr(bufferSizeInBytes));