Author Topic: FB Alpha 0.2.96.91 Release  (Read 40745 times)

Offline 0746

  • Expert
  • *****
  • Posts: 108
  • Karma: +2/-0
Re: FB Alpha 0.2.96.91 Release
« Reply #30 on: August 08, 2008, 01:09:43 PM »
Kev: Sorry the name seems to be a little bit misleading there ^_^. okai_p2pchat is IRC an extension for the p2p client.

But still, we are talking about thousands of files here. With the distributed p2p approach, the gravest issue will be users having to be present online ready to upload. I can't imagine many being happy about it. When a few people who are willing to keep sharing loose interest, which happens more often than not, people will be unable to retrieve files.


My concern though is 50000 people downloading 2000 flyers, 2000 titles, 2000 previews, etc. You get the idea. :) Even if they only download once it's still a fair bit of bandwidth.

The only other thing I can think of is if we put up multiple repositories in different places instead of a central one so that the load can be spread across repositories. I think this is the most common solution to this problem. For example steam content servers...linux repositories...sourceforge.net files etc. But this also brings up the issue of everyone having to keep their content up to date.

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: FB Alpha 0.2.96.91 Release
« Reply #31 on: August 08, 2008, 02:29:23 PM »
My concern though is 50000 people downloading 2000 flyers, 2000 titles, 2000 previews, etc. You get the idea. :) Even if they only download once it's still a fair bit of bandwidth.

Well I can at least offer my server for this ^^, I was checking my control panel and it say this "The amount of bandwidth used by a client:   0 B of unlimited traffic used" xDD lol

I will put it to the test to see if its really unlimited hehe  :p, the thing i still need to check is if I can upload everything there, I will check how much space does images/cabinets/flyers/etc require and if my available space is able to handle it, I hope it does xD

Oh!, and ThanX for the responses and comments everyone!

SeeYaa!
:biggrin:

Offline 0746

  • Expert
  • *****
  • Posts: 108
  • Karma: +2/-0
Re: FB Alpha 0.2.96.91 Release
« Reply #32 on: August 08, 2008, 02:46:17 PM »
I can also host a repository if you guys decide to have multiple ones. I still have more than 5 gigs of free space and get about 70ish gb unused quota every month. The only limitation I have is no of files. Still can manage around 10000 thou.

Offline Barry Harris

  • dontbeabarry
  • *
  • Posts: 1785
  • Karma: +0/-65535
  • I'm Barry Harris and I like to f*** people over
Re: FB Alpha 0.2.96.91 Release
« Reply #33 on: August 08, 2008, 04:00:43 PM »
I have a full collection of full-size previews - that is 18.2MB.
Account of Barry Harris; the traitor.
Send me an e-mail at barry@fbalpha.com letting me know how big of a piece of sh** I am.

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: FB Alpha 0.2.96.91 Release
« Reply #34 on: August 08, 2008, 05:08:27 PM »
I have a full collection of full-size previews - that is 18.2MB.

That is compressed or uncompressed ? sounds good if it's uncompressed ^^

btw, I have news about the feature!, I managed to do a very simplified function to download a file to a specified location using WinInet API, this library is very good and compatible with different compilers, at first I was trying a shorter path using 'urlmon.lib and  urlmon.h' but those are exclusively in Microsoft SDK and not portable to MinGW.

So here is a preview of what i have right now, note that the url and save path will be replaced with variables in the final version

Quote

// Very simple function to download a file using WinInet API
void FileDownload()
{
  HINTERNET url, open;
 
  TCHAR URL_LOCATION[512]      = _T("http://fightercore.plesk3.freepgs.com/files/neosource/fba/splash.bmp");
  TCHAR final_file_name[512]   = _T("C:\\sample.bmp");
 
  if(URL_LOCATION == NULL) {
      // Error managing code goes here
  }

  open = InternetOpen(_T("ExampleDL"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
  url = InternetOpenUrl(open, URL_LOCATION, NULL, 0, 0, 0);

  FILE *saved;
  DWORD buffer;
  TCHAR name[128];
  saved = _tfopen(final_file_name, _T("wb"));

  while(InternetReadFile(url, name, sizeof(name), &buffer) && buffer != 0) {
    fwrite(name, 1, buffer, saved);
   name[buffer] = _T('\0');
  }
 
  fclose(saved);

}

SeeYaa!
 :biggrin:

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: FB Alpha 0.2.96.91 Release
« Reply #35 on: August 08, 2008, 07:11:07 PM »
Hey Barry! I have done a more elaborated module to download the image files and its looking good so far ^^, it doesn't take too long to load a image, what I have to do now is a modification to the module so it knows the type of image is looking for, like for example: title / flyer / cabinet / etc, but that should not be a big issue

If you can upload the preview package you have to rapidshare or other kind of file hosting I will appreciate it a lot ^^, for now Im gonna use some previews i have here to keep testing in my server  :smilie:

ThanX in advance!

I attached the module as it is by now, so you can check it out while I keep working on it, suggestions are welcome =)

SeeYaa!
 :biggrin: 

Offline LittleKaneda

  • Jr. Member
  • **
  • Posts: 55
  • Karma: +1/-0
Re: FB Alpha 0.2.96.91 Release
« Reply #36 on: August 08, 2008, 09:45:20 PM »
 :eek: In which version was the "slider, speed, center" code added for games with configurations of Left/Right, Up/Down & Throttle?

I either must've missed this or it's always been there, but I never knew how to configure a racing wheel/flight stick game until I saw this code as default in a game's input today. Thanks for that because these type of configurations always puzzled me!

Offline 0746

  • Expert
  • *****
  • Posts: 108
  • Karma: +2/-0
Re: FB Alpha 0.2.96.91 Release
« Reply #37 on: August 09, 2008, 12:04:49 AM »
That looks nice Captain =) Give us a buzz if that WinINet stuff doesn't work out. I'll write you a winsock version in 20 minutes =)

18mb compressed doesn't sound that much =) It'll be 40-50ish mb max when uncompressed.

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: FB Alpha 0.2.96.91 Release
« Reply #38 on: August 09, 2008, 04:39:41 AM »
Here it is my latest update to what I have by now of the Image download feature im working, later after I get some rest I will keep updating it to work more accurate, check 'TODO' comments to see some of the stuff I have to work on  :smilie:

If anyone wanna take a look of the code, get the main module cpp from the attachment  ;p, I commented the code for better understanding of what each part does, and if anyone is learning programming it may help ^^.

EDIT: If somebody is wondering why I wrote the file checking, its because Apache servers (at least the one hosting my things) display a default HTML document if a file is not found for any reason, most of the servers have this feature on and that doesn't work like a normal redirection, so WinInit API will not know if the data received from that URL is the right one or if its a error document.  Btw, if the connection is not successful to a server then nothing is transferred and there is no problem, the only problem I was having was the mentioned before.

EDIT2: Here you have some examples of data that is transfered in place of a file that is not found on the server...

http://neosource.1emu.net/lala

Quote
<HTML>
<HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD>
<BODY>
<H1>Not Found</H1>
The requested document was not found on this server.
<P>
<HR>
<ADDRESS>
Web Server at 1emulation.com
</ADDRESS>
</BODY>
</HTML>

<!--
   - Unfortunately, Microsoft has added a clever new
   - "feature" to Internet Explorer. If the text of
   - an error's message is "too small", specifically
   - less than 512 bytes, Internet Explorer returns
   - its own error message. You can turn that off,
   - but it's pretty tricky to find switch called
   - "smart error messages". That means, of course,
   - that short error messages are censored by default.
   - IIS always returns error messages that are long
   - enough to make Internet Explorer happy. The
   - workaround is pretty simple: pad the error
   - message with a big comment like this to push it
   - over the five hundred and twelve bytes minimum.
   - Of course, that's exactly what you're reading
   - right now.
   -->


http://fightercore.plesk3.freepgs.com/lala

Quote


<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /lala was not found on this server.</p>

<address>Apache/2.2.8 (Fedora) Server at fightercore.plesk3.freepgs.com Port 80</address>
</body></html>

[/size]

And there exist other kinds of default data that is transferred when a file is not found, but for now I think my point is clear ^^U.

SeeYaa!
 :biggrin:

Offline 0746

  • Expert
  • *****
  • Posts: 108
  • Karma: +2/-0
Re: FB Alpha 0.2.96.91 Release
« Reply #39 on: August 09, 2008, 05:30:50 AM »
Looks nice. if the file is not found, checking for "<!DOCTYPE" or other HTML tags is not the right thing to do to detect that. It's not invalid if the response code for file not found accompanies an empty document or something that doesn't contain any html markups. It wont be illegal if it returned a picture too..png or otherwise as long as the response code is 404. Isn't there anything in WinINet to get the response code of the last request? Like 202 = success? Cant exactly remember... its been a while since I last worked on http server code.
« Last Edit: August 09, 2008, 05:48:37 AM by 0746 »

Offline Barry Harris

  • dontbeabarry
  • *
  • Posts: 1785
  • Karma: +0/-65535
  • I'm Barry Harris and I like to f*** people over
Re: FB Alpha 0.2.96.91 Release
« Reply #40 on: August 09, 2008, 09:39:36 AM »
That is compressed or uncompressed ? sounds good if it's uncompressed ^^

That is uncompressed - just straight-forward PNGs. Titles would probably be the same size roughly.
Account of Barry Harris; the traitor.
Send me an e-mail at barry@fbalpha.com letting me know how big of a piece of sh** I am.

Offline Barry Harris

  • dontbeabarry
  • *
  • Posts: 1785
  • Karma: +0/-65535
  • I'm Barry Harris and I like to f*** people over
Re: FB Alpha 0.2.96.91 Release
« Reply #41 on: August 09, 2008, 09:52:59 AM »
This is all looking cool.

We could extend it to all resources - localisation templates, game list localisation files, previews, flyers, pcbs, cheats, history, etc.
Account of Barry Harris; the traitor.
Send me an e-mail at barry@fbalpha.com letting me know how big of a piece of sh** I am.

kev

  • Guest
Re: FB Alpha 0.2.96.91 Release
« Reply #42 on: August 09, 2008, 11:15:30 AM »
Code: [Select]
// Very simple module to download a file using WinInet API (CaptainCPS-X)
#include "burner.h"
#include <wininet.h>

// TODO:
// - Verification of PNG headers instead of checking for regular errors on transfered files
// - Checking of more specific directory to download images form, Ex. flyers/ titles/ cabinets/ etc.
//   right now the directory is specified in the server URL.


int FileDownload(TCHAR* szLocalFilePath, TCHAR* szFile)
{
HINTERNET url, open;
int errorCode = 0;
DWORD buffer = 0;
char *content;

FILE* dlPointer = NULL;
TCHAR szFILESERVER1[512] = _T("http://fightercore.plesk3.freepgs.com/files/neosource/fba/support/previews/");
TCHAR szFinalURL[512] = _T("");

// Prepare final URL for current download
_stprintf(szFinalURL, _T("%s%s"), szFILESERVER1, szFile);

// Start initialization for this connection
open = InternetOpen(_T("FBA_Download"), INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);

// Connect to the final URL to start transfer later
url = InternetOpenUrl(open, szFinalURL, NULL, 0, INTERNET_FLAG_NO_AUTO_REDIRECT, 0);
TCHAR szStatusCode[32];                                             
DWORD dwStatusCodeSize = 32;                                           

if (!HttpQueryInfo(url,HTTP_QUERY_STATUS_CODE,szStatusCode, &dwStatusCodeSize, NULL))
{
// server not available so error here
}
else
{
long nStatusCode = _ttol(szStatusCode);
if (nStatusCode == HTTP_STATUS_OK)
{

// Create a new empty file for writing binary data
dlPointer = _tfopen(szLocalFilePath, _T("wb"));


TCHAR szContentSize[32];                                             
DWORD dwContentSizeSize = 32;   
if (HttpQueryInfo(url,HTTP_QUERY_CONTENT_LENGTH,szContentSize, &dwContentSizeSize, NULL))
{
long nContentSize = _ttol(szContentSize);
content = (char*)malloc(nContentSize);
// Transfer the file contents and write them to the created file
while(InternetReadFile(url, content, sizeof(content), &buffer) && buffer != 0) {
fwrite(content, 1, buffer, dlPointer);
content[buffer] = '\0';
}

// Done with file writing so close the file pointer
fclose(dlPointer);
errorCode=1;
}


}
else
{
// not code 200 so error here
errorCode= nStatusCode;
}

}

if (content!=NULL)
{
free(content);
}
buffer = 0;
InternetCloseHandle(url);
InternetCloseHandle(open);

return errorCode; // All good!
}

Basic http code checking. Probably not full thought through everything here but it seems to work ok-ish.

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: FB Alpha 0.2.96.91 Release
« Reply #43 on: August 09, 2008, 12:23:31 PM »
Cool! ThanX KEV! ^^ Looks good!, I'm gonna check the code asap

SeeYaa!
 :biggrin:

Offline CaptainCPS

  • FBNeo Dev
  • ******
  • Posts: 1513
  • Karma: +127/-0
  • FB Alpha Team
    • CaptainCPS's Home
Re: FB Alpha 0.2.96.91 Release
« Reply #44 on: August 09, 2008, 01:17:31 PM »
Here is the other code I have in sel.cpp for the Download feature (still not finished)

FIND THIS >>>>

Code: [Select]
// Try to load a .PNG preview image
_tcscpy(szBaseName, szPreviewDir);
_tcscat(szBaseName, BurnDrvGetText(DRV_NAME));
if (nIndex == 1) {
_stprintf(szFileName, _T("%s.png"), szBaseName);
fp = _tfopen(szFileName, _T("rb"));
if (fp) break;
}
if (!fp) {
_stprintf(szFileName, _T("%s-p%02i.png"), szBaseName, nIndex);
fp = _tfopen(szFileName, _T("rb"));
if (fp) break;
}

if (!fp && BurnDrvGetText(DRV_PARENT)) { // Try the parent
_tcscpy(szBaseName, szPreviewDir);
_tcscat(szBaseName, BurnDrvGetText(DRV_PARENT));
if (nIndex == 1) {
_stprintf(szFileName, _T("%s.png"), szBaseName);
fp = _tfopen(szFileName, _T("rb"));
if (fp) break;
}
if (!fp) {
_stprintf(szFileName, _T("%s-p%02i.png"), szBaseName, nIndex);
fp = _tfopen(szFileName, _T("rb"));
if (fp) break;
}
}

ADD THIS AFTER >>>>>


Code: [Select]
// Download image code (preliminary) ------------------------------------------------------
if(!fp){

TCHAR szImageFile[256] = _T("");
_tcscpy(szBaseName, szPreviewDir);
_tcscat(szBaseName, BurnDrvGetText(DRV_NAME));

// Main Image
if (nIndex == 1) {

_stprintf(szFileName, _T("%s.png"), szBaseName);

_stprintf(szImageFile, _T("%s.png"), BurnDrvGetText(DRV_NAME));
if(FileDownload(szFileName, szImageFile))
{
fp = _tfopen(szFileName, _T("rb"));
}
if (fp) break;
}

// Alternate Images
if (!fp) {
_stprintf(szFileName, _T("%s-p%02i.png"), szBaseName, nIndex);

_stprintf(szImageFile, _T("%s-p%02i.png"), BurnDrvGetText(DRV_NAME), nIndex);
if(FileDownload(szFileName, szImageFile))
{
fp = _tfopen(szFileName, _T("rb"));
}
if (fp) break;
}

// Try parent
if (!fp && BurnDrvGetText(DRV_PARENT))
{
_tcscpy(szBaseName, szPreviewDir);
_tcscat(szBaseName, BurnDrvGetText(DRV_PARENT));
if (nIndex == 1) {

_stprintf(szFileName, _T("%s.png"), szBaseName);

_stprintf(szImageFile, _T("%s.png"), BurnDrvGetText(DRV_PARENT));
if(FileDownload(szFileName, szImageFile))
{
fp = _tfopen(szFileName, _T("rb"));
}
if (fp) break;
}
// Alternate Parent Images
if (!fp) {
_stprintf(szFileName, _T("%s-p%02i.png"), szBaseName, nIndex);

_stprintf(szImageFile, _T("%s-p%02i.png"), BurnDrvGetText(DRV_PARENT), nIndex);
if(FileDownload(szFileName, szImageFile))
{
fp = _tfopen(szFileName, _T("rb"));
}
if (fp) break;
}
}
}
// ----------------------------------------------------------------------------------------

As far as i have tested, the last filedl.cpp KEV posted is working good with this updated code, If anyone have issues with it please let me know ^^

SeeYaa!
 :biggrin: