MKKJ Posted August 13, 2017 Share Posted August 13, 2017 (edited) I'm trying to use functions from bass.dll that returns a value.However the proc always return -1 and with error code 5, which means the handle is invalid.So does handle i got from CLEO is different from handle used in bass.dll?Or is there's anything else i miss? 0AAC: [email protected] = load_audiostream "cleo\track.mp3"0AAD: set_mp3 [email protected] perform_action 10AC0: audiostream [email protected] loop 1......:Loopwait 0if 0AA2: [email protected] = load_library "bass.dll" // IF and SETthen if 0AA4: [email protected] = get_proc_address "BASS_ChannelGetLength" library [email protected] // IF and SET then 0AA7: call_function [email protected] num_params 2 pop 0 [email protected] 0 [email protected] if and 0039: [email protected] == -1 0AA4: [email protected] = get_proc_address "BASS_ErrorGetCode" library [email protected] // IF and SET then 0AA7: call_function [email protected] num_params 0 pop 0 [email protected] // (always 5) end endendjump @Loop EDIT: It's solved. But i have more question to ask. Now i'm not actually a knowledgeable coder, so i have lot of things i don't understand when it comes to actual coding outside of scm.One of functions, BASS_Bytes2Seconds requires a qword and returns a double. double BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos); Qword param can be solved by passing two variables at once because it's just like double variables0AA4: xProc = get_proc_address "BASS_ChannelBytes2Seconds" library xBass0AA7: call_function xProc num_params 3 pop 0 iPos2 iPos1 hBass dTimeBut it can't return the double float value. It's just return 1 in byte. So how can i retrieve this value in cleo? I'm also trying to use BASS_FXSetParameters. (BASS_FXSetParameters)(DWORD fxHandle, void *params)But they require parametric constructor (i just picked up the term) That by what i just catch, it's like an object that contains several parameters as one. It's supposed to be used like thisBASS_DX8_ECHO echo = new BASS_DX8_ECHO(value,value,value,value,value);Bass.BASS_FXSetParameters(fxHandle, echo);Is it possible to re-interpret this in cleo? Or is it just isn't worth it? Edited August 15, 2017 by MKKJ Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2017 Share Posted August 13, 2017 (edited) Yes. The CLEO sound system is a interface to BASS. The handle returned by opcodes 0x0AAC and 0x0AC1 can not be directly used by BASS API because it's a address pointing to a CAudioStream or C3dAudioStream object (concept of CLEO). Edited August 13, 2017 by Guest Link to comment Share on other sites More sharing options...
MKKJ Posted August 13, 2017 Author Share Posted August 13, 2017 (edited) Is there a way to retrieve the bass.dll handle? I've been trying to figure out what is stored in CLEO handle, but only got some address at +0x0 and audio state (play/stop) at +0x8 Edited August 13, 2017 by MKKJ Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2017 Share Posted August 13, 2017 (edited) The CAudioStream class is composed of... +0x00 hBassStream ; This is a HSTREAM type. It's provided by BASS API. +0x04 uState +0x08 bOk I am not sure if a BASS function works fine when a CAudioStream->hBassStream is pushed to itself as parameter. Perhaps, you can load a stream by call BASS_StreamCreateFile function. Edited August 13, 2017 by Guest Link to comment Share on other sites More sharing options...
MKKJ Posted August 13, 2017 Author Share Posted August 13, 2017 (edited) Apparently pushing CAudioStream->hBassStream as parameter doesn't work, or any other values around. Also AudioStream play/pause state is in +0x8 (unless that is what you meant), i don't know what value is in +0x4 but it seems important as it's always pushed before cleo call bass functions. Considering my lack of knowledge around audiostream and bass.dll, I'll take my time to either figure to the handle from cleo's stream or streaming audio from BASS_StreamCreateFile (although its kinda redundant to do it in cleo). EDIT: CAudioStream + 0x4 does contain actual handle. Another thing i missed is that i supposed to reverse order of params to pass at 0AA7. I can use command process (Play, Pause) with 0AA5, but not returned functions (0AA7). It always returns error code 37 (Requested data is not available) Edited August 13, 2017 by MKKJ Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2017 Share Posted August 13, 2017 (edited) Perhaps have another value at 0x00 offset, so 0x04 potentially would be a HSTREAM. I have seen the CAudioStream class from CLEO 4(1/2) SDK, it had only hBassStream, uState e bOk; the remaining items are functions. I will try to find the CLEO SDK. It's hard to find anything in my HDD. I had tried to use symbols of BASS, but the game crashed several times. Then i have preferred to use Miles Sound System. Edited August 15, 2017 by Guest Link to comment Share on other sites More sharing options...
MKKJ Posted August 13, 2017 Author Share Posted August 13, 2017 (edited) Thanks, but i've gotten around it just now. The only problem might be some function just crashes the game for some reason. Like BASS_Bytes2Seconds. Maybe because one of required param is a qword. if0AA2: [email protected] = load_library "bass.dll" // IF and SETthen if and 0AA4: [email protected] = get_proc_address "BASS_ChannelGetLength" library [email protected] // IF and SET 0AA4: [email protected] = get_proc_address "BASS_ChannelPlay" library [email protected] // IF and SET 0AA4: [email protected] = get_proc_address "BASS_ChannelPause" library [email protected] // IF and SET 0AA4: [email protected] = get_proc_address "BASS_ChannelGetPosition" library [email protected] // IF and SET 0AA4: [email protected] = get_proc_address "BASS_ChannelBytes2Seconds" library [email protected] // IF and SET 0AA4: [email protected] = get_proc_address "BASS_ErrorGetCode" library [email protected] // IF and SET then 0A8E: [email protected] = [email protected] + 0x4 // int 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 //0AA7: call_function [email protected] num_params 2 pop 0 0 [email protected] [email protected] //0AA5: call [email protected] num_params 2 pop 0 1 [email protected] //0AA5: call [email protected] num_params 1 pop 0 [email protected] 0AA7: call_function [email protected] num_params 2 pop 0 0 [email protected] [email protected] 0AA7: call_function [email protected] num_params 2 pop 0 [email protected] [email protected] [email protected] // crash 0ACE: show_formatted_text_box "Proc Loaded~n~%d~n~%d~n~%d" [email protected] [email protected] [email protected] 0AA7: call_function [email protected] num_params 0 pop 0 [email protected] 0AD1: show_formatted_text_highpriority "Proc BASS_ErrorCode...~n~%d~n~0x%X~n~0x%X" time 6000 [email protected] [email protected] [email protected] endend Edited August 13, 2017 by MKKJ Link to comment Share on other sites More sharing options...
Guest Posted August 13, 2017 Share Posted August 13, 2017 (edited) I had forgotten of this. It also has been one of reasons to do me try another solution. The file position is treated as QWORD and the fractional time as double. double BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos); Edited August 13, 2017 by Guest Link to comment Share on other sites More sharing options...
MKKJ Posted August 14, 2017 Author Share Posted August 14, 2017 (edited) So yeah, apparently CAudioStream struct that was posted earlier is correct, except it's should moved forward by 4 bytes +0x0 ??? ; Idk what this is. +0x4 hBassStream ; the actual handle as stated. +0x8 uState ; the audio state (1 = playing | 2 = stop/pause) +0x8 bOk ; idk what this is too. I'm trying to manipulate Audiostream's time position with BASS functions. I managed to get/set the byte position but can't convert it to time position unless by workaround. (BASS_Bytes2Seconds can't return double value. I just don't know how to solve it) Still, i got what i wanted so i marked this as answered. Edited August 14, 2017 by MKKJ Link to comment Share on other sites More sharing options...
MKKJ Posted August 15, 2017 Author Share Posted August 15, 2017 I decided to continue this post for my new question, since it's still relevant. Now i'm not actually a knowledgeable coder, so i have lot of things i don't understand when it comes to actual coding outside of scm.One of functions, BASS_Bytes2Seconds requires a qword and returns a double. double BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos); Qword param can be solved by passing two variables at once because it's just like double variables 0AA4: xProc = get_proc_address "BASS_ChannelBytes2Seconds" library xBass0AA7: call_function xProc num_params 3 pop 0 iPos2 iPos1 hBass dTime But it can't return the double float value. It's just return 1 in byte. So how can i retrieve this value in cleo? I'm also trying to use BASS_FXSetParameters. (BASS_FXSetParameters)(DWORD fxHandle, void *params) But they require parametric constructor (i just picked up the term) That by what i just catch, it's like an object that contains several parameters as one. It's supposed to be used like this BASS_DX8_ECHO echo = new BASS_DX8_ECHO(value,value,value,value,value);Bass.BASS_FXSetParameters(fxHandle, echo); Is it possible to re-interpret this in cleo? Or is it just isn't worth it? Link to comment Share on other sites More sharing options...
madleg Posted August 15, 2017 Share Posted August 15, 2017 (edited) well, idk if function calling opcodes support returning floating point values, but you can write some sort of wrapper which will return double like int (float in eax). Not sure about using doubles in cleo, so theres also to float conversion. int __declspec(dllexport, noinline)wrapper(double(__cdecl *func)(unsigned int, unsigned __int64), unsigned int a0, unsigned __int64 a1){ float a = func(a0, a1); return reinterpret_cast<int&>(a);}compiled result55 // push ebp8B EC // mov ebp,esp83 E4 F8 // and esp,-0883 EC 08 // sub esp,08FF 75 14 // push [ebp+14]FF 75 10 // push [ebp+10]FF 75 0C // push [ebp+0C]FF 55 08 // call dword ptr [ebp+08]D9 5C 24 10 // fstp dword ptr [esp+10]8B 44 24 10 // mov eax,[esp+10]83 C4 0C // add esp,0C8B E5 // mov esp,ebp5D // pop ebpC3 // ret insert these bytes in your script under some label and call it something like this 0AA7: call_function <get label address> num_params 4 pop 4 int int (qword), int, <get bass function address>, result to @ typedef struct { float fWetDryMix; float fFeedback; float fLeftDelay; float fRightDelay; BOOL lPanDelay;} BASS_DX8_ECHO; if theres no export function in this library to construct this structure, then just set it by yourself. This is just an array of 4 floats and 1 bool, so... Idk about how function, which recieves this structure, is handling it (maybe stores pointer, maybe just copies params), so you can try something like: [email protected] = float, ... [email protected] = float, [email protected] = bool and pass var [email protected] addres in function, or just allocate memory and fill it in same way. Edited August 15, 2017 by madleg MKKJ 1 Link to comment Share on other sites More sharing options...
MKKJ Posted August 15, 2017 Author Share Posted August 15, 2017 (edited) Thanks for your help. The pointer to array of params perfectly solves it. But the function you posted just crashes the game. Maybe i just did it wrong. 0AA4: [email protected] = get_proc_address "BASS_ChannelGetPosition" library [email protected] // IF and SET0AA4: [email protected] = get_proc_address "BASS_ChannelBytes2Seconds" library [email protected] // IF and SET 0AC6: [email protected] = label @Test offset0AA7: call_function [email protected] num_params 2 pop 0 0 hBASS [email protected] 0AA7: call_function [email protected] num_params 4 pop 4 qword [email protected] [email protected] handle hBASS bass_func [email protected] result [email protected] On a less relevant note, what did exactly Bass boost and Bike's EQ do to the radio output? I just assume Bike crappy radio just raises pitch while i Bass boost outputs sound in stereo (which was normally in mono). Edited August 15, 2017 by MKKJ Link to comment Share on other sites More sharing options...
madleg Posted August 16, 2017 Share Posted August 16, 2017 (edited) it was actually only for bass_channelbytes2seconds. is it working with it? Edited August 16, 2017 by madleg Link to comment Share on other sites More sharing options...
MKKJ Posted August 16, 2017 Author Share Posted August 16, 2017 (edited) Yes it crashes with BASS_ChannelBytes2Seconds. Did i insert the value correctly? Where does result variable belong, input param or output param? 0AA7: call_function [email protected] num_params 4 pop 4 qword [email protected] [email protected] handle hBASS bass_func [email protected] result [email protected] Edited August 16, 2017 by MKKJ Link to comment Share on other sites More sharing options...
Junior_Djjr Posted March 12, 2019 Share Posted March 12, 2019 You still need help with this? I created MDPMv5, which uses a lot of bass.dll functions. I can send you the source code. I had not seen your thread before and I found it searching for bass.dll on Google. On 8/15/2017 at 12:51 PM, MKKJ said: I just assume Bike crappy radio just raises pitch while i Bass boost outputs sound in stereo (which was normally in mono). It's totally wrong. If you raises the pitch of a music, literally all notes will be raised and all song will be with wrong melody. And stereo vs mono there is nothing to do with bass. Mono, the song plays in just 1 channel (so left and right is the same sound) and stereo is 2 (different sounds in each side, make it possible to create something immersive, separate the focus sound from ambient sound etc), nothing else. It works making a equalization, i.e. removing (or increasing) the low frequencies. This is created by the game audio system, bass.dll is just a CLEO choice for audio stuff. Link to comment Share on other sites More sharing options...
MKKJ Posted March 17, 2019 Author Share Posted March 17, 2019 On 3/12/2019 at 6:14 PM, Junior_Djjr said: You still need help with this? I created MDPMv5, which uses a lot of bass.dll functions. I can send you the source code. I had not seen your thread before and I found it searching for bass.dll on Google. Nah i'm good. I did what i tried to do - including corrected the stupid idea of how equalizer works. I ended up imitating both bike EQ and bass boost by approximate tuning. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now