Skip to main content
Topic: 0.6 to 0.7 questions (Read 7580 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

0.6 to 0.7 questions

Finally rebuilding my component for 0.7.  I haven't been able to keep up with the .7 development so I'm just going to ask some questions that may have already been covered.

1.  Are there API calls for every enum that used to be supported by play_control::command() ? 

for example I see the obvious ones ->>> play_control::get()->get_volume() for play_control::VOLUME_GET

are all of the rest covered somewhere?

2.  How do I use the utf8api.dll?  When I compile I get

Linking...
  Creating library Debug/foo_WSGUI_d.lib and object Debug/foo_WSGUI_d.exp
foobar2000_SDK.lib(metadb_handle.obj) : error LNK2001: unresolved external symbol __imp__uSortStringCreate
foobar2000_SDK.lib(metadb_handle.obj) : error LNK2001: unresolved external symbol __imp__uSortStringCompare
foobar2000_SDK.lib(metadb_handle.obj) : error LNK2001: unresolved external symbol __imp__uSortStringFree
../foobar2000/foo_WSGUI_d.dll : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.

foo_WSGUI_d.dll - 4 error(s), 0 warning(s)

I didn't see a uti8api.lib in the SDK and I couldn't get that project to compile so I'm wondering about the proper way to link.

3.  The .7 way to do keyboard shortcuts?

Thanks in advance for answers (unless you tell me to look in the header files or the sample projects  )

0.6 to 0.7 questions

Reply #1
To get utf8api to compile, it depends on PFC.  If you use the "dependencies" thing in VC++, it's pretty simple to get it all working together.

0.6 to 0.7 questions

Reply #2
Quote
2.  How do I use the utf8api.dll?

Make SDK depend on utf8api and utf8api depend on pfc.

0.6 to 0.7 questions

Reply #3
You mean include the .dsp for utf8api.dll in my project (project->insert project into workspace) is the same manner as I've done for PFC and SDK?

0.6 to 0.7 questions

Reply #4
The way I made use of shortcuts in 0.7x was to extend "menu_item_main_single". You can then associate it with a menu item heading (such as Playlist/"your feature").
Users will then see this in the shortcuts list in their prefs and can then link a keyboard shortcut to it. This works fine for me, but does mean that it will end up somewhere within the menu structure.

0.6 to 0.7 questions

Reply #5
Quote
You mean include the .dsp for utf8api.dll in my project (project->insert project into workspace) is the same manner as I've done for PFC and SDK?

Yep.  Then set the dependencies as Case said.

0.6 to 0.7 questions

Reply #6
Quote
This works fine for me, but does mean that it will end up somewhere within the menu structure.

Not necessarily.
Override this:
virtual enabled_state get_enabled_state(int idx) {return MENU_DEFAULT_ON;}
MENU_DEFAULT_OFF will hide it by default, and MENU_FORCE_OFF will keep it hidden.

0.6 to 0.7 questions

Reply #7
Cool, thanks for the info.

0.6 to 0.7 questions

Reply #8
Quote
Quote
You mean include the .dsp for utf8api.dll in my project (project->insert project into workspace) is the same manner as I've done for PFC and SDK?

Yep.  Then set the dependencies as Case said.

OK, link errors are resolved - thanks.

Now I have a compiled dll and found a new problem - it doesn't run even though I haven't changed anything from my 0.6 version except for using .7 vs. .6 API calls.

Are there changes to the init/quit etc. that I'm not aware of?

Very strange...

0.6 to 0.7 questions

Reply #9
Define "doesn't run".

0.6 to 0.7 questions

Reply #10
Quote
Define "doesn't run".

Yeah, sorry.

It gets into some kind of error loop and I just discovered it is spitting our error files.

failure.txt
___________


Illegal operation:
Code: C0000005h, flags: 00000000h, address: 1021916Fh
Access violation, operation: read, address: 6F636573h
Module: "MSVCRTD", loaded at 10200000h - 1026C000h
Symbol: "wcslen" (+0000000Fh)
Additional info: main message loop
This is the first crash logged by this instance.
Code bytes:
1021914Fh:  0C 85 D2 74 02 EB D4 8B 45 08 8B E5 5D C3 CC CC
1021915Fh:  CC 55 8B EC 51 8B 45 08 89 45 FC 8B 4D FC 33 D2
1021916Fh:  66 8B 11 8B 45 FC 83 C0 02 89 45 FC 85 D2 74 02
1021917Fh:  EB E9 8B 45 FC 2B 45 08 D1 F8 83 E8 01 8B E5 5D
Version info:
foobar2000 v0.7 RC8
UNICODE

_______________

This is in the code that loads the look file which has not changed at all from the .6 version.

Any suggestions?

0.6 to 0.7 questions

Reply #11
Looks like you have written code that crashes. Are you expecting detailed instructions how to use debugger or someone to come and fix your code ?

0.6 to 0.7 questions

Reply #12
Quote
Looks like you have written code that crashes. Are you expecting detailed instructions how to use debugger or someone to come and fix your code ?

No, I'm saying all I changed in my .6 code was to use the new play_control API, removed the deprectated APIs (keyboard_shortcuts, etc.) and now code that wasn't modified at all seems to crash - I don't even call wsclen directly in my code so I don't know what's going on since the crash doesn't appear to be in my source code.

I thought that was strange is all.

If you want to fly out and have a look let me know but otherwise I was just seeking any insight into why this might have happened.

0.6 to 0.7 questions

Reply #13
Well, I thought it would take less mental effort for some people to run problematic code under debugger and see what happens, rather than write more pointless posts.
From quick search, it looks like you have been passing invalid parameters to string conversion routines, which were possibly tolered before but they no longer are.

0.6 to 0.7 questions

Reply #14
Quote
Well, I thought it would take less mental effort for some people to run problematic code under debugger and see what happens, rather than write more pointless posts.
From quick search, it looks like you have been passing invalid parameters to string conversion routines, which were possibly tolered before but they no longer are.

Things go bad as soon as I call

Code: [Select]
  SetWindowPos(
     NULL,0,0,
     m_SkinSize.Width + extraWidth,
     m_SkinSize.Height + extraHeight,SWP_NOMOVE | SWP_NOZORDER);
 }


That function never returns and I can't debug it.

I don't immediately see how this calls wsclen.  Could I have some strange mix of unicode vs non-unicode?

0.6 to 0.7 questions

Reply #15
Erm, if you are sure that it's inside SetWindowPos(), then check message handlers for the window you are calling it on.

0.6 to 0.7 questions

Reply #16
Quote
Erm, if you are sure that it's inside SetWindowPos(), then check message handlers for the window you are calling it on.

I not sure what you mean - I don't have any message handlers specific to calling SetWindowPos.  I noticed if I skip over the SetWindowPos, the program goes a little farther but then I get the same error later on but I haven't found exactly where.  I'm guessing some other Win32 API call.  I don't get any call stack when this occurs since the program seems to be looping in the main thread (calling the dump_failure_txt method).

Truly, I'm not sure what is going on and not trying to waste any mental power.

0.6 to 0.7 questions

Reply #17
Are you running debug version of windows core so win32 api functions call msvcrtd.dll wcslen() ? I don't think you are.

0.6 to 0.7 questions

Reply #18
Quote
Are you running debug version of windows core so win32 api functions call msvcrtd.dll wcslen() ? I don't think you are.

No, standard VC++ 6.0 setup on Windows XP.  I noticed that utf8app debug project settings don't define UNICODE preprocessor macro and use _MBCS - is that correct (changing it didn't seem to help my problem - just wondering).

0.6 to 0.7 questions

Reply #19
Then it does not crash inside SetWindowPos, some code you compiled calls wcslen. Sorry, I'm getting bored with this thread.

0.6 to 0.7 questions

Reply #20
Quote
Quote
Erm, if you are sure that it's inside SetWindowPos(), then check message handlers for the window you are calling it on.

I not sure what you mean - I don't have any message handlers specific to calling SetWindowPos.  I noticed if I skip over the SetWindowPos, the program goes a little farther but then I get the same error later on but I haven't found exactly where.  I'm guessing some other Win32 API call.  I don't get any call stack when this occurs since the program seems to be looping in the main thread (calling the dump_failure_txt method).

Truly, I'm not sure what is going on and not trying to waste any mental power.

danZ: If you can get on IRC, you might try the fb2k irc channel: #foobar2000 on irc.freenode.net
I've never gotten on it, but it would probably be a lot easier for someone to try to help you debug this on IRC then through the forums.

0.6 to 0.7 questions

Reply #21
Quote
Then it does not crash inside SetWindowPos, some code you compiled calls wcslen. Sorry, I'm getting bored with this thread.

Sorry to bore you - doesn't seem to be that hard to do

I fixed the problem and thought someone might at least be curious.

First I'm never calling wsclen directly - the call was being made by std::string which is used in one of my libraries.

Second, since the call was being made in response to various windows messages it was very hard to track down because the error would not be caught in the debugger.  Instead the program would just start looping and spitting out the failure.txt files.  If I would break in the debugger during this I didn't get any useful stack information.

So, the final cause of the problem - a single missing _T() wrapper around one string constant in my code.  Like Z^7 said, apparently tolerated in .6.

Anyway, problem solved, .7 upgrade back on track.

Now back to my other questions.

1.  Will I find API equivalents for all the former play_control::command() calls?
PLAYBACK_NEXT, PLAYBACK_PREV,PLAYBACK_REPEAT,PLAYBACK_SHUFFLE - don't immediately see how to do those in .7.

2.  In another component I'm working on I was creating my own console service

Code: [Select]
static service_factory_single_t<console,mTVUIConsole> mTVUIConsole_instance;


This results in an error now at run time regarding duplicated core service.

0.6 to 0.7 questions

Reply #22
To answer (1), have a look at play_control.h. The API is quite different, so you will have to make some changes in your code, but you can achieve the same things. For example, to go to the next track you need something like

play_control::get()->play_start(play_control::TRACK_COMMAND_NEXT);

'hope this helps...

0.6 to 0.7 questions

Reply #23
Quote
To answer (1), have a look at play_control.h. The API is quite different, so you will have to make some changes in your code, but you can achieve the same things. For example, to go to the next track you need something like

play_control::get()->play_start(play_control::TRACK_COMMAND_NEXT);

'hope this helps...

Yeah, thanks.

0.6 to 0.7 questions

Reply #24
0. Debug / Exceptions, set all to "stop always" 
1. play_control has most of those, playback order control explained here: http://www.hydrogenaudio.org/show.php/showtopic/11110
2. If you want to add a new console service, you need to replace/remove existing one; otherwise the one getting console messages will depend on dll loading order.

 
SimplePortal 1.0.0 RC1 © 2008-2019