Author Topic: _[ FinalBurn Alpha: Tips and Tricks ]_  (Read 55081 times)

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: FBA Tips and Tricks
« Reply #45 on: August 16, 2005, 12:18:08 AM »
ThanX FerchogtX!!! For all the explanation, i understand what you said about the bitman ^^
i will test the code and i think that will work i just dont have to much experience with bitmans
im starting with C++ ...but i hope i get better ^^

Really ThanX for the code and the Unload AddOn ^^....

SeeYaa Man!!! i was missing you already xDDD
:-D

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: FBA Tips and Tricks
« Reply #46 on: August 16, 2005, 01:07:14 AM »
Added some attribute coding to the Streching Function i have to ThanX FerchogtX for the
info, with that reference i understood and added this...

Code: [Select]
// This is for background image, performs the needed stretching
// for avoiding the use of more images for this :)
// Extra Stretch Code for any BMP Size by CaptainCPS-X
// Made posible ThanX to FerchogtX Info about BMP attributes
void StretchBitmap(HDC hDC, HWND hWnd, HBITMAP hBitmap)
{
HDC memDC; BITMAP bm; RECT re;
memDC = CreateCompatibleDC(hDC);
SelectObject(memDC, hBitmap);
GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);

//Basic bitman attributes
long width=bm.bmWidth;
long height=bm.bmHeight;

//Prepare the bitmap attributes
BITMAPINFO bmInfo;
memset(&bmInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER));
bmInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
bmInfo.bmiHeader.biWidth=width;
bmInfo.bmiHeader.biHeight=height;
bmInfo.bmiHeader.biPlanes=1;
bmInfo.bmiHeader.biBitCount=24;

GetClientRect(hWnd, &re);
if (bMenuEnabled) {
StretchBlt(hDC, 0, 25, re.right, re.bottom-25, memDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
} else {
StretchBlt(hDC, 0, 0, re.right, re.bottom, memDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
}
DeleteDC(memDC);
}

I hope you like it ^^ now every Bitman image size Works !!!! ThanX FerchogtX! ^^

SeeYaa!!!
:-D

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: FBA Tips and Tricks
« Reply #47 on: August 16, 2005, 12:58:48 PM »
I added the unload code and it gave me errors about a conversion of a CHAR to WCHAR cant be
done or something like that so i removed the blank and put ''szNoSkin''...

just check this code...

Add this in the top of scrn.cpp...

Code: [Select]
static TCHAR* szNoSkin = _T("");
and then this is the new code you posted but edited so it dont give convertion errors...

Code: [Select]
case MENU_SKIN_UNLOAD: // ThanX to FerchogtX for the code
_tcsncpy(szPlaceHolder, szNoSkin, sizeof(szPlaceHolder) / sizeof(TCHAR));
MessageBox(hScrnWnd, _T("Reseting Skin to default skin"), _T(APP_TITLE) _T(" Info"), MB_OK | MB_ICONINFORMATION);
POST_INITIALISE_MESSAGE;
break;

SeeYaa!!! ^^
:-D

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
Re: FBA Tips and Tricks
« Reply #48 on: August 16, 2005, 09:08:29 PM »
I added the unload code and it gave me errors about a conversion of a CHAR to WCHAR cant be
done or something like that so i removed the blank and put ''szNoSkin''...

just check this code...

Add this in the top of scrn.cpp...

Code: [Select]
static TCHAR* szNoSkin = _T("");
and then this is the new code you posted but edited so it dont give convertion errors...

Code: [Select]
case MENU_SKIN_UNLOAD: // ThanX to FerchogtX for the code
_tcsncpy(szPlaceHolder, szNoSkin, sizeof(szPlaceHolder) / sizeof(TCHAR));
MessageBox(hScrnWnd, _T("Reseting Skin to default skin"), _T(APP_TITLE) _T(" Info"), MB_OK | MB_ICONINFORMATION);
POST_INITIALISE_MESSAGE;
break;

SeeYaa!!! ^^
:-D
XD you don't have to do that, just change the "" with _T("")... here the fix:
Code: [Select]
case MENU_SKIN_UNLOAD: // ThanX to FerchogtX for the code
_tcsncpy(szPlaceHolder, _T(""), sizeof(szPlaceHolder) / sizeof(TCHAR));
MessageBox(hScrnWnd, _T("Reseting Skin to default skin"), _T(APP_TITLE) _T(" Info"), MB_OK | MB_ICONINFORMATION);
POST_INITIALISE_MESSAGE;
break;
BTW here a shortened version of your bitmap code:
Code: [Select]
// This is for background image, performs the needed stretching
// for avoiding the use of more images for this :)
// Extra Stretch Code for any BMP Size by CaptainCPS-X
// Made posible ThanX to FerchogtX Info about BMP attributes
void StretchBitmap(HDC hDC, HWND hWnd, HBITMAP hBitmap)
{
HDC memDC; BITMAP bm; RECT re;

memDC = CreateCompatibleDC(hDC);
SelectObject(memDC, hBitmap);
GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
GetClientRect(hWnd, &re);
if (bMenuEnabled) {
StretchBlt(hDC, 0, 25, re.right, re.bottom-25, memDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
// StretchBlt(hDC, 0, 25, re.right, re.bottom-25, memDC, 0, 0, 304, 224, SRCCOPY);
} else {
StretchBlt(hDC, 0, 0, re.right, re.bottom, memDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
// StretchBlt(hDC, 0, 0, re.right, re.bottom, memDC, 0, 0, 304, 224, SRCCOPY);
}
DeleteDC(memDC);
}
You maybe will ask, why you deleted the other atributes? because you don't need them at all, CreateCompatibleDC converts your resource into a handler that can be used to do what you need here, when you declare the BITMAP structure, also the atributes are declared (in an implicit way) so the only thing you need is to change the sixes into bm.bmWidth and bm.bmHeight, in WinAPI this is very usefull sometimes because saves a lot of code, instead of re-writting all ther structure again.
See ya!!!!!! :biggrin:

Good and evil co-exist because of the balance, lies are not part of it...

FB Alpha Plus! site infos updated, see the latest info clicking on my profile link...

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: FBA Tips and Tricks
« Reply #49 on: August 17, 2005, 01:21:05 AM »
ThanX FerchogtX! :-D ^^u... man im fighting with a code for loading other type of images but
i give up for now wheeuuu im tired of thinking and searching references on the net X___X

btw, im using the Turbo mode you have on your build of FBA Plus!, and i was having Guru Meditation
when i toggle to fullscreen mode with turbo on...

i did this to the MENU_FULL code so it will turn off the Turbo when going fullscreen and it not give
the guru meditation error anymore...

its simple...im not talking about something so special but this will fix the guru thing...

Code: [Select]
case MENU_FULL:
if (bDrvOkay || nVidFullscreen) {
nVidFullscreen = !nVidFullscreen;
bAppDoFast = 0;
POST_INITIALISE_MESSAGE;
}
return;

as you see i added... ''bAppDoFast = 0;'' so it turn off the turbo when goin fullscreen :-)

What do you think, is good or its better to fix the guru error in other way??

SeeYaa!!!
:-D


Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
Re: FBA Tips and Tricks
« Reply #50 on: August 18, 2005, 12:30:02 PM »
Let me check my src's and see if this can be fixed iun another way...
See ya!!!!

Good and evil co-exist because of the balance, lies are not part of it...

FB Alpha Plus! site infos updated, see the latest info clicking on my profile link...

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: FBA Tips and Tricks
« Reply #51 on: August 20, 2005, 04:13:12 PM »
Im back with something usefull ^^...Sound Volume Disabling while playing a Game...this doent
have to do with the Samplerate at all...this work with volume controls...

Well here i go... :-D

IN BURNER/WIN32/RESOURCE_STRING.H

FIND:

Code: [Select]
#define IDS_SOUND_VOLUMESET (IDS_STRING + 131)
AFTER THAT ADD:

Code: [Select]
#define IDS_SOUND_MUTE (IDS_STRING + 132)
#define IDS_SOUND_MUTE_OFF (IDS_STRING + 133)

IN BURNER/WIN32/RUN.CPP

FIND:

Code: [Select]
case VK_OEM_PLUS: {
TCHAR buffer[15];

nAudVolume += 100;

BEFORE THAT ADD:

Code: [Select]
// 'Silence' & 'Sound Restored' Code (added by CaptainCPS-X)
case 'S': {
TCHAR buffer[15];

nAudVolume -= 10000;
if (GetAsyncKeyState(VK_CONTROL) & 0x80000000) {
nAudVolume -= 10000;
}

if (nAudVolume < 0) {
nAudVolume = 0;
}
if (AudSoundSetVolume() == 0) {
VidSNewShortMsg(FBALoadStringEx(hAppInst, IDS_SOUND_NOVOLUME, true));
} else {
_stprintf(buffer, FBALoadStringEx(hAppInst, IDS_SOUND_MUTE, true), nAudVolume / 100);
VidSNewShortMsg(buffer);
}
break;
}

case 'R': {

nAudVolume += 10000;
if (GetAsyncKeyState(VK_CONTROL) & 0x80000000) {
nAudVolume += 10000;
}

if (nAudVolume > 10000) {
nAudVolume = 10000;
}
if (AudSoundSetVolume() == 0) {
VidSNewShortMsg(FBALoadStringEx(hAppInst, IDS_SOUND_NOVOLUME, true));
} else {
VidSNewShortMsg(FBALoadStringEx(hAppInst, IDS_SOUND_MUTE_OFF, true));
}
break;
}

IN BURNER/WIN32/STRING.RC

FIND:

Code: [Select]
IDS_SOUND_VOLUMESET "volume %03i %%"
AFTER THAT ADD:

Code: [Select]
IDS_SOUND_MUTE "Silence"
IDS_SOUND_MUTE_OFF "Sound Restored"

I hope you like that ^^ (here are some images)





If somebody can make the code work in only one key this would be Great...

Actually the keys are...

Alt + S (Silence)
Alt + R (Sound Restored)

I just want this only in Alt + S, like the Turbo Option in F1 key...i hope you understand what i mean
^^

SeeYaa All!!
:-D
« Last Edit: August 20, 2005, 04:17:04 PM by CaptainCPS-X »

Offline Badablek

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +0/-0
  • Member
Re: FBA Tips and Tricks
« Reply #52 on: August 20, 2005, 06:26:14 PM »
Quote
If somebody can make the code work in only one key this would be Great...


IN BURNER/WIN32/RUN.CPP

FIND:
Code: [Select]
static bool bShowFPS = false;
AFTER THAT ADD:
Code: [Select]
static bool bMute = false;
FIND:
Code: [Select]
case VK_OEM_PLUS: {
TCHAR buffer[15];

nAudVolume += 100;

ADD THIS BEFORE:
Code: [Select]
case 'S': {
TCHAR buffer[15];
bMute = !bMute;
if (bMute) {
nAudVolume -= 10000;
nAudVolume = 0; //force volume to 0%
_stprintf(buffer, FBALoadStringEx(hAppInst, IDS_SOUND_MUTE, true), nAudVolume / 100);
} else {
nAudVolume += 10000;
nAudVolume = 10000; //force volume to 100%
_stprintf(buffer, FBALoadStringEx(hAppInst, IDS_SOUND_MUTE_OFF, true), nAudVolume / 100);
}
VidSNewShortMsg(buffer);
AudSoundSetVolume();
break;
}

enjoy ^^

this is my first "real code", maybe it can be done in another way....but it works great for me ^^

ps : nice idea this "Mute function" CaptainCPS-X :biggrin:

[EDIT]

Seems to work, but if I mute the sound then try to increase the sound with ALT + PAGEUP, then the Mute/UnMute function do not work anymore :(

[EDIT2]

Just need to force the volume to 0% or 100% before muting/Unmuting and this bug is gone......
« Last Edit: August 20, 2005, 07:34:11 PM by Badablek »

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: FBA Tips and Tricks
« Reply #53 on: August 20, 2005, 09:10:09 PM »
ThanX Badablek :-D.. I will test out the modified code you posted ^^, i think the
vol % problem can be fixed...

I will check it and tell you if i fix it ^^...

SeeYaa!!
:-D

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: FBA Tips and Tricks
« Reply #54 on: August 20, 2005, 09:25:13 PM »
Badablek the code is fine....its going good i did what you say about the Bug but i dont have
the problem you talk....i tried different ways and It work just fine ^^...

Ah other thing i saw in you post... youre saying when you press ALT + PAGEUP but thats not
the key to Up the volume... its ALT + (+) and to lower is ALT + (-) ....plus and negative signs
but i tried ALT + PAGEUP and ALT + PAGEDOWN and they dont do anything...maybe youre
confuced ^^

but hey!..ThanX again for making it work on one Key only! :-D

SeeYaa!!!
:-D
« Last Edit: August 20, 2005, 09:26:55 PM by CaptainCPS-X »

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: FBA Tips and Tricks
« Reply #55 on: August 20, 2005, 09:38:47 PM »
This one is for FerchogtX ^^... hey man i did a fix in the 'Save Preview AddOn' you have
on FB Alpha plus! and now it advance one frame After Saving the Preview,
this means that when you Pause the Game and you press SHIFT + F12 you will see the text
''Preview Saved''...and Not see the Screen just there without telling you about that. :-D...

Before doing this Run a Game in your actual build of FBAP and Pause the game, and then
Press 'SHIFT + F12' then you will see what i mean , there is No Text telling you Saved Something ^^...

Here is the modified code so just replace the old:

Code: [Select]
case MENU_SAVEPREV: {
if(bDrvOkay) {
int status = MakePreview();
if (!status) {
VidSNewShortMsg(FBALoadStringEx(hAppInst, IDS_PREV_SAVED, true), 0x00FF00);
// Advance a frame after Saving the Preview
VidFrame();
VidPaint(0);
if (bRunPause) {
memset(nAudNextSound, 0, nAudSegLen << 2); // Write silence into the buffer
}
} else {
VidSNewShortMsg(FBALoadStringEx(hAppInst, IDS_PREV_ERROR, true), 0xFF3F3F);
}
}
return;
}

SeeYaa!!
:-D

Offline iq_132

  • Administrator
  • *****
  • Posts: 3725
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: FBA Tips and Tricks
« Reply #56 on: August 20, 2005, 10:11:25 PM »
Nice stuff you guys are working on. :) I wonder what you'll come up with next.


Offline Leaf

  • Jr. Member
  • **
  • Posts: 50
  • Karma: +9/-4
Re: FBA Tips and Tricks
« Reply #57 on: August 20, 2005, 10:48:04 PM »
Thanks, CaptainCPS-X. Your posts are very useful and I added them all. ^_^
I use Visual Style under WinXP, I found the menu height was not 25, so I changed StretchBitmap function to this, now the bitmap fills full the screen.

Code: [Select]
// This is for background image, performs the needed stretching
// for avoiding the use of more images for this :)
// Extra Stretch Code for any BMP Size by CaptainCPS-X
// Made posible ThanX to FerchogtX Info about BMP attributes
void StretchBitmap(HDC hDC, HWND hWnd, HBITMAP hBitmap)
{
HDC memDC; BITMAP bm; RECT re; RECT reMenu;
memDC = CreateCompatibleDC(hDC);
HGDIOBJ hOldObj = SelectObject(memDC, hBitmap);
GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);

// get menu height
HMENU hMenu = FBALoadMenu(hAppInst, MAKEINTRESOURCE(IDR_MENU));
GetMenuItemRect(hWnd, hMenu, 0, &reMenu);
long mH = reMenu.bottom - reMenu.top;

GetClientRect(hWnd, &re);
if (bMenuEnabled) {
StretchBlt(hDC, 0, mH, re.right, re.bottom-mH, memDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
} else {
StretchBlt(hDC, 0, 0, re.right, re.bottom, memDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
}
SelectObject(memDC, hOldObj);
DeleteDC(memDC);
}

Offline Badablek

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +0/-0
  • Member
Re: FBA Tips and Tricks
« Reply #58 on: August 21, 2005, 04:08:56 AM »
Quote
Ah other thing i saw in you post... youre saying when you press ALT + PAGEUP but thats not
the key to Up the volume... its ALT + (+) and to lower is ALT + (-) ....plus and negative signs
but i tried ALT + PAGEUP and ALT + PAGEDOWN and they dont do anything...maybe youre
confuced ^^

I changed the keys for Volume Up and down, as the original keys do not work for me (maybe because I'm using a french keyboard  :confused:)


The bug appears if I do not set the sound volume to 0 or 100% before using the mute function.....If I mute the sound, then I increase the volume to 100% (with ALT + (+) or ALT + PAGEUP for me  :wink:), then if I press again S, it doesn't do anything......this is why in my code, I set the volume to 0 or 100%

Try to put // in front of nAudVolume = 0; and nAudVolume = 100; then the bug will appear....

Offline Leaf

  • Jr. Member
  • **
  • Posts: 50
  • Karma: +9/-4
Re: FBA Tips and Tricks
« Reply #59 on: August 21, 2005, 07:49:25 AM »
I added a variable "nOldAudVolume" to save current sound volume before mute.
When the sound muted, push Alt+ or Alt- will be no effect.
Code: [Select]
// 'Silence' & 'Sound Restored' Code (added by CaptainCPS-X)
case 'S': {
TCHAR buffer[15];
bMute = !bMute;

if (bMute) {
nAudVolume = 0;// mute sound
_stprintf(buffer, FBALoadStringEx(hAppInst, IDS_SOUND_MUTE, true), nAudVolume / 100);
} else {
nAudVolume = nOldAudVolume;// restore volume
_stprintf(buffer, FBALoadStringEx(hAppInst, IDS_SOUND_MUTE_OFF, true), nAudVolume / 100);
}
if (AudSoundSetVolume() == 0) {
VidSNewShortMsg(FBALoadStringEx(hAppInst, IDS_SOUND_NOVOLUME, true));
} else {
VidSNewShortMsg(buffer);
}
break;
}

case VK_OEM_PLUS: {
if (bMute) break; // if mute, not do this

......
nOldAudVolume = nAudVolume;
......
}
case VK_OEM_MINUS: {
if (bMute) break; // if mute, not do this

                                                                                                                                ......
nOldAudVolume = nAudVolume;
......
}
« Last Edit: August 21, 2005, 07:55:20 AM by Leaf »