Files to modify:
UploadQueue.cpp
Preferences.cpp
Preferences.h
UploadListCtrl.cpp
MenuCmds.h
PPgxx.cpp
PPgxx.h
String Table
UploadQueue.cpp
bool CUploadQueue::AcceptNewClient(uint32 curUploadSlots){
// check if we can allow a new client to start downloading from us
//slots control
if(uploadinglist.GetCount() >= thePrefs.GetNbUploadSlots()&&thePrefs.GetControlSlot() == true)
return false;
//slots control
Preferences.cpp
[code]
CPreferences thePrefs;
//slots control
bool CPreferences::ControlSlot;
uint16 CPreferences::NbUploadSlots;
//slots control
......
ini.WriteBool(_T("SparsePartFiles"),m_bSparsePartFiles);
ini.WriteString(_T("YourHostname"),m_strYourHostname);
//Slot Control
ini.WriteBool(_T("Activer la gestion des slot en
UDP Reask FNF-Fix
DownloadClient.cpp
search :
#include "Log.h"
add under:
#include "UploadQueue.h"
serach:
AddDebugLogLine(DLP_LOW, false, _T("UDP FNF-Answer: %s - %s"),DbgGetClientInfo(), DbgGetFileInfo(reqfile ? reqfile->GetFileHash() : NULL));
add under:
if(reqfile && GetUploadState()!=US_NONE)
{
CKnownFile* upfile = theApp.sharedfiles->GetFileByID(GetUploadFileID());
if(upfile && upfile == reqfile) //we speak about the same file
{
AddLogLine(false,_T("Dropped src: (%s) does not seem to have own reqfile!"), DbgGetClientInfo());
theApp.uploadqueue->RemoveFromUploadQueue(this, _T("Src says he does not have the file he's dl'ing"));
theApp.uploadqueue->RemoveFromWaitingQueue(this);
}
}
search :
#include "Log.h"
add under:
#include "UploadQueue.h"
serach:
AddDebugLogLine(DLP_LOW, false, _T("UDP FNF-Answer: %s - %s"),DbgGetClientInfo(), DbgGetFileInfo(reqfile ? reqfile->GetFileHash() : NULL));
add under:
if(reqfile && GetUploadState()!=US_NONE)
{
CKnownFile* upfile = theApp.sharedfiles->GetFileByID(GetUploadFileID());
if(upfile && upfile == reqfile) //we speak about the same file
{
AddLogLine(false,_T("Dropped src: (%s) does not seem to have own reqfile!"), DbgGetClientInfo());
theApp.uploadqueue->RemoveFromUploadQueue(this, _T("Src says he does not have the file he's dl'ing"));
theApp.uploadqueue->RemoveFromWaitingQueue(this);
}
}
Adding own tabs
Show additional client-based info in an own tab. In this example a new tab showing the modversion
is added to QueueListCtrl.cpp. You can use it for any other ListCtrl aswell, you just have to adapt
the column number defined at the end of the file.
Open QueueListCtrl.cpp:
Right after the #include "" block at the beginning add the following line:
[php]#define COL_MODVER (10) // pp show ModString[/php]
In QueueListCTRL there are already 9 existing columns. If you edit another ListCtrl you have to change the
counter to the first free number. You can check this in the following code part - add the last line at the end:
[php]
void CQueueListCtrl::Init()
{
[...]
InsertColumn(6,GetResString(IDS_LASTSEEN),LVCFMT_LEFT,110,6);
InsertColumn(7,GetResString(IDS_ENTERQUEUE),LVCFMT_LEFT,110,7);
InsertColumn(8,GetResString(IDS_BANNED),LVCFMT_LEFT,60,8);
InsertColumn(9,GetResString(IDS_UPSTATUS),LVCFMT_LEFT,100,9);
// pp
InsertColumn(COL_MODVER, GetResString(IDS_CD_CSOFT), LVCFMT_LEFT, 100, COL_MODVER); // pp show modstring
[/php]
Now we localize the tab name to your language:
[php]
void CQueueListCtrl::Localize()
{
CHeaderCtrl* pHeaderCtrl = GetHeaderCtrl();
HDITEM hdi;
hdi.mask = HDI_TEXT;
if(pHeaderCtrl->GetItemCount() != 0) {
CString strRes;
[...]
strRes = GetResString(IDS_UPSTATUS);
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(9, &hdi);
strRes.ReleaseBuffer();
// pp show modstring
strRes = GetResString(IDS_CD_CSOFT);
strRes.Remove(_T(':'));
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(COL_MODVER, &hdi);
strRes.ReleaseBuffer();
// pp end
}
}
[/php]
Now for what will be shown in the column. You can show nearly anything here. The content of sBuffer
will your output, if you want to shown something else you have to edit it, just remember to return it
formatted as string:
[php]
void CQueueListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
[...]
case 9:
if( client->GetUpPartCount()){
cur_rec.bottom--;
cur_rec.top++;
client->DrawUpStatusBar(dc,&cur_rec,false,thePrefs.UseFlatBar());
cur_rec.bottom++;
cur_rec.top--;
}
break;
// pp show modstring
case COL_MODVER:
Sbuffer = client->DbgGetFullClientSoftVer();
if (Sbuffer.IsEmpty())
Sbuffer = GetResString(IDS_UNKNOWN);
break;
// pp end
[...]
[/php]
Finally the sorting. Emule does not support sorting of stringsm so we have to add an additional later:
[php]
int CQueueListCtrl::SortProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
[...]
case 9:
iResult=item1->GetUpPartCount() - item2->GetUpPartCount();
break;
case 109:
iResult=item2->GetUpPartCount() - item1->GetUpPartCount();
break;
// pp show modstring
case COL_MODVER:
iResult=Mod_Version_Sort_by_String(item1,item2);
break;
case COL_MODVER+100:
iResult=Mod_Version_Sort_by_String(item2,item1);
break;
// pp end
[...]
[/php]
Now for the string sorting. This has to be added to OtherFunctions.cpp/.p
At the end of OtherFunctions.cpp add this function (from Pawcio mod):
[php]
// pp show modstring
int Mod_Version_Sort_by_String(const CUpDownClient* client1, const CUpDownClient* client2){
if(client1->GetClientSoft() == client2->GetClientSoft()){
if(client2->GetVersion() == client1->GetVersion() &&
client1->GetClientSoft() == SO_EMULE)
return _tcscmp(client2->GetClientModVer(), client1->GetClientModVer());
else
return client2->GetVersion() - client1->GetVersion();
}
else
return client1->GetClientSoft() - client2->GetClientSoft();
}
[/php]
Finally, define the function at the end of OtherFunctions.h:
[php]
// pp show modstring
int Mod_Version_Sort_by_String(const CUpDownClient* client1, const CUpDownClient* client2);
[/php]
is added to QueueListCtrl.cpp. You can use it for any other ListCtrl aswell, you just have to adapt
the column number defined at the end of the file.
Open QueueListCtrl.cpp:
Right after the #include "" block at the beginning add the following line:
[php]#define COL_MODVER (10) // pp show ModString[/php]
In QueueListCTRL there are already 9 existing columns. If you edit another ListCtrl you have to change the
counter to the first free number. You can check this in the following code part - add the last line at the end:
[php]
void CQueueListCtrl::Init()
{
[...]
InsertColumn(6,GetResString(IDS_LASTSEEN),LVCFMT_LEFT,110,6);
InsertColumn(7,GetResString(IDS_ENTERQUEUE),LVCFMT_LEFT,110,7);
InsertColumn(8,GetResString(IDS_BANNED),LVCFMT_LEFT,60,8);
InsertColumn(9,GetResString(IDS_UPSTATUS),LVCFMT_LEFT,100,9);
// pp
InsertColumn(COL_MODVER, GetResString(IDS_CD_CSOFT), LVCFMT_LEFT, 100, COL_MODVER); // pp show modstring
[/php]
Now we localize the tab name to your language:
[php]
void CQueueListCtrl::Localize()
{
CHeaderCtrl* pHeaderCtrl = GetHeaderCtrl();
HDITEM hdi;
hdi.mask = HDI_TEXT;
if(pHeaderCtrl->GetItemCount() != 0) {
CString strRes;
[...]
strRes = GetResString(IDS_UPSTATUS);
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(9, &hdi);
strRes.ReleaseBuffer();
// pp show modstring
strRes = GetResString(IDS_CD_CSOFT);
strRes.Remove(_T(':'));
hdi.pszText = strRes.GetBuffer();
pHeaderCtrl->SetItem(COL_MODVER, &hdi);
strRes.ReleaseBuffer();
// pp end
}
}
[/php]
Now for what will be shown in the column. You can show nearly anything here. The content of sBuffer
will your output, if you want to shown something else you have to edit it, just remember to return it
formatted as string:
[php]
void CQueueListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
[...]
case 9:
if( client->GetUpPartCount()){
cur_rec.bottom--;
cur_rec.top++;
client->DrawUpStatusBar(dc,&cur_rec,false,thePrefs.UseFlatBar());
cur_rec.bottom++;
cur_rec.top--;
}
break;
// pp show modstring
case COL_MODVER:
Sbuffer = client->DbgGetFullClientSoftVer();
if (Sbuffer.IsEmpty())
Sbuffer = GetResString(IDS_UNKNOWN);
break;
// pp end
[...]
[/php]
Finally the sorting. Emule does not support sorting of stringsm so we have to add an additional later:
[php]
int CQueueListCtrl::SortProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
[...]
case 9:
iResult=item1->GetUpPartCount() - item2->GetUpPartCount();
break;
case 109:
iResult=item2->GetUpPartCount() - item1->GetUpPartCount();
break;
// pp show modstring
case COL_MODVER:
iResult=Mod_Version_Sort_by_String(item1,item2);
break;
case COL_MODVER+100:
iResult=Mod_Version_Sort_by_String(item2,item1);
break;
// pp end
[...]
[/php]
Now for the string sorting. This has to be added to OtherFunctions.cpp/.p
At the end of OtherFunctions.cpp add this function (from Pawcio mod):
[php]
// pp show modstring
int Mod_Version_Sort_by_String(const CUpDownClient* client1, const CUpDownClient* client2){
if(client1->GetClientSoft() == client2->GetClientSoft()){
if(client2->GetVersion() == client1->GetVersion() &&
client1->GetClientSoft() == SO_EMULE)
return _tcscmp(client2->GetClientModVer(), client1->GetClientModVer());
else
return client2->GetVersion() - client1->GetVersion();
}
else
return client1->GetClientSoft() - client2->GetClientSoft();
}
[/php]
Finally, define the function at the end of OtherFunctions.h:
[php]
// pp show modstring
int Mod_Version_Sort_by_String(const CUpDownClient* client1, const CUpDownClient* client2);
[/php]
Create a random Modstring
It's placed in Preferences.cpp/.h so it can be called from nearly everwhere when needed.
Preferences.cpp
CString CPreferences::m_strSessionModstring;
CString CPreferences::GetSessionModString()
{
if (!m_strSessionModstring.IsEmpty())
return m_strSessionModstring;
//
// Create the Modname
int i, maxchar;
m_strSessionModstring.Empty();
maxchar = 4+(rand()%9); // min length == 4 chars, max length (4+9-1) == 12 chars
i = 0;
while (i < maxchar) { int iRand = rand()%3; switch(iRand){ case 0: m_strSessionModstring.AppendFormat(_T("%c"), _T('A')+rand()%26); // Capitals case 1: m_strSessionModstring.AppendFormat(_T("%c"), _T('0')+rand()%10); // Numbers case 2: default: m_strSessionModstring.AppendFormat(_T("%c"), _T('a')+rand()%26); // lower case } i++; if (m_strSessionModstring.GetLength() >= maxchar)
break;
}
//
// Add a prefix to the version number
i = rand()%5;
switch (i){
case 0: m_strSessionModstring.Append(_T(" V")); break;
case 1: m_strSessionModstring.Append(_T(" v")); break;
case 2: m_strSessionModstring.Append(_T(" r")); break;
case 3: m_strSessionModstring.Append(_T(" R")); break;
default:
case 4: m_strSessionModstring.Append(_T(" ")); break;
}
//
// Add the version number
m_strSessionModstring.AppendFormat(_T("%c.%c%c"), _T('0')+rand()%10, _T('0')+rand()%10, (rand()%2 ? _T('0')+rand()%10 : _T('a')+rand()%7));
//
// This will return a ModID consisting of ModVersion + 1.00 or 1.0a
return m_strSessionModstring;
}
Preferences.h
static CString m_strSessionModstring;
static CString GetSessionModString();
Preferences.cpp
CString CPreferences::m_strSessionModstring;
CString CPreferences::GetSessionModString()
{
if (!m_strSessionModstring.IsEmpty())
return m_strSessionModstring;
//
// Create the Modname
int i, maxchar;
m_strSessionModstring.Empty();
maxchar = 4+(rand()%9); // min length == 4 chars, max length (4+9-1) == 12 chars
i = 0;
while (i < maxchar) { int iRand = rand()%3; switch(iRand){ case 0: m_strSessionModstring.AppendFormat(_T("%c"), _T('A')+rand()%26); // Capitals case 1: m_strSessionModstring.AppendFormat(_T("%c"), _T('0')+rand()%10); // Numbers case 2: default: m_strSessionModstring.AppendFormat(_T("%c"), _T('a')+rand()%26); // lower case } i++; if (m_strSessionModstring.GetLength() >= maxchar)
break;
}
//
// Add a prefix to the version number
i = rand()%5;
switch (i){
case 0: m_strSessionModstring.Append(_T(" V")); break;
case 1: m_strSessionModstring.Append(_T(" v")); break;
case 2: m_strSessionModstring.Append(_T(" r")); break;
case 3: m_strSessionModstring.Append(_T(" R")); break;
default:
case 4: m_strSessionModstring.Append(_T(" ")); break;
}
//
// Add the version number
m_strSessionModstring.AppendFormat(_T("%c.%c%c"), _T('0')+rand()%10, _T('0')+rand()%10, (rand()%2 ? _T('0')+rand()%10 : _T('a')+rand()%7));
//
// This will return a ModID consisting of ModVersion + 1.00 or 1.0a
return m_strSessionModstring;
}
Preferences.h
static CString m_strSessionModstring;
static CString GetSessionModString();
Nickthief
void CUpDownClient::SendHelloTypePacket(CSafeMemFile* data)
{
data->WriteHash16(thePrefs.GetUserHash());
uint32 clientid;
clientid = theApp.GetID();
data->WriteUInt32(clientid);
data->WriteUInt16(thePrefs.GetPort());
uint32 tagcount = 6;
if( theApp.clientlist->GetBuddy() && theApp.IsFirewalled() )
tagcount += 2;
data->WriteUInt32(tagcount);
// eD2K Name
// TODO implement multi language website which informs users of the effects of bad mods
CTag tagName(CT_NAME, (m_pszUsername) ? m_pszUsername : thePrefs.GetUserNick()); // NickThief
//CTag tagName(CT_NAME, (!m_bGPLEvildoer) ? thePrefs.GetUserNick() : _T("Please use a GPL-conform version of eMule") );
tagName.WriteTagToFile(data, utf8strRaw);
// eD2K Version
CTag tagVersion(CT_VERSION,EDONKEYVERSION);
tagVersion.WriteTagToFile(data);
[...]
{
data->WriteHash16(thePrefs.GetUserHash());
uint32 clientid;
clientid = theApp.GetID();
data->WriteUInt32(clientid);
data->WriteUInt16(thePrefs.GetPort());
uint32 tagcount = 6;
if( theApp.clientlist->GetBuddy() && theApp.IsFirewalled() )
tagcount += 2;
data->WriteUInt32(tagcount);
// eD2K Name
// TODO implement multi language website which informs users of the effects of bad mods
CTag tagName(CT_NAME, (m_pszUsername) ? m_pszUsername : thePrefs.GetUserNick()); // NickThief
//CTag tagName(CT_NAME, (!m_bGPLEvildoer) ? thePrefs.GetUserNick() : _T("Please use a GPL-conform version of eMule") );
tagName.WriteTagToFile(data, utf8strRaw);
// eD2K Version
CTag tagVersion(CT_VERSION,EDONKEYVERSION);
tagVersion.WriteTagToFile(data);
[...]
Manual Chunk Selection
Here's the code for the Manual Chunk Selection.
//BG Manual Chunk Selection
//BG Specify a string of chunks... every number must be followed by a comma
//BG Examples: 1, or 3,4,5, etc...
CString strManualChunks = thePrefs.GetCommunityName();
strManualChunks = strManualChunks.MakeReverse(); // 1,2,3, = ,3,2,1
int pos;
while (strManualChunks != _T("")) {
pos = strManualChunks.Find(_T(","));
CString strChunk = strManualChunks.Mid(pos+1,1);
uint32 iChunk = _wtoi(strChunk)-1;
if (sender->IsPartAvailable(iChunk) && GetNextEmptyBlockInPart(iChunk, 0))
chunk_list.AddHead(iChunk);
strManualChunks = strManualChunks.Right(strManualChunks.GetLength()-2);
}
//BG End
Put near the end of bool CPartFile::GetNextRequestedBlock(CUpDownClient* sender, Requested_Block_Struct** newblocks, uint16* count)
Here's the Left to Right code:
/*
Get Chunks Left to Right.
If the file is an AVI/ASF/WMV, get the last chunk after the first chunk.
Version 2 of this will try and just get the last 180KB for AVI files instead of the whole chunk for previewing
Need to rip apart the GetNextEmptyBlockInPart function.
*/
//BG
bool CPartFile::GetNextRequestedBlock_BGVideoPreview(CUpDownClient* sender, Requested_Block_Struct** newblocks, uint16* count) {
uint16 LastPartAsked;
const uint16 partCount = GetPartCount();
//Find File Extension
CString ext = GetFileName();
ext.MakeLower();
int pos = ext.ReverseFind(_T('.'));
if (pos > -1)
ext = ext.Mid(pos);
//Get First Chunk
if (sender->IsPartAvailable(0) && GetNextEmptyBlockInPart(0, NULL) ) {
LastPartAsked = 0;
}
//If AVI/ASF/WMV Get Last Chunk
else if ((ext == _T(".avi") || ext == _T(".asf") || ext == _T(".wmv")) &&
sender->IsPartAvailable(partCount - 1) && GetNextEmptyBlockInPart(partCount - 1, NULL) ) {
LastPartAsked = partCount - 1;
}
//Get All other chunks Left to Right
else {
for (uint16 i = 1; i < partCount; i++) if (sender->IsPartAvailable(i) && GetNextEmptyBlockInPart(i, NULL) ) {
LastPartAsked = i;
break;
}
}
//Build Requested Block List
uint16 requestedCount = *count;
uint16 newblockcount = 0;
do{
Requested_Block_Struct* block = new Requested_Block_Struct;
if (GetNextEmptyBlockInPart(LastPartAsked,block)) {
requestedblocks_list.AddTail(block);
newblocks[newblockcount] = block;
AddDebugLogLine( false, _T("BG-VideoPreview: Block: -%u- Start: -%u- End: -%u- Trans: -%u-"),(uint16)newblockcount,block->StartOffset,block->EndOffset,block->transferred);
newblockcount++;
}
else {
delete block;
break;
}
} while (newblockcount != requestedCount);
*count = newblockcount;
sender->m_lastPartAsked = LastPartAsked;
return true;
} //BG End GetNextRequestedBlock_BGVideoPreview
//BG Manual Chunk Selection
//BG Specify a string of chunks... every number must be followed by a comma
//BG Examples: 1, or 3,4,5, etc...
CString strManualChunks = thePrefs.GetCommunityName();
strManualChunks = strManualChunks.MakeReverse(); // 1,2,3, = ,3,2,1
int pos;
while (strManualChunks != _T("")) {
pos = strManualChunks.Find(_T(","));
CString strChunk = strManualChunks.Mid(pos+1,1);
uint32 iChunk = _wtoi(strChunk)-1;
if (sender->IsPartAvailable(iChunk) && GetNextEmptyBlockInPart(iChunk, 0))
chunk_list.AddHead(iChunk);
strManualChunks = strManualChunks.Right(strManualChunks.GetLength()-2);
}
//BG End
Put near the end of bool CPartFile::GetNextRequestedBlock(CUpDownClient* sender, Requested_Block_Struct** newblocks, uint16* count)
Here's the Left to Right code:
/*
Get Chunks Left to Right.
If the file is an AVI/ASF/WMV, get the last chunk after the first chunk.
Version 2 of this will try and just get the last 180KB for AVI files instead of the whole chunk for previewing
Need to rip apart the GetNextEmptyBlockInPart function.
*/
//BG
bool CPartFile::GetNextRequestedBlock_BGVideoPreview(CUpDownClient* sender, Requested_Block_Struct** newblocks, uint16* count) {
uint16 LastPartAsked;
const uint16 partCount = GetPartCount();
//Find File Extension
CString ext = GetFileName();
ext.MakeLower();
int pos = ext.ReverseFind(_T('.'));
if (pos > -1)
ext = ext.Mid(pos);
//Get First Chunk
if (sender->IsPartAvailable(0) && GetNextEmptyBlockInPart(0, NULL) ) {
LastPartAsked = 0;
}
//If AVI/ASF/WMV Get Last Chunk
else if ((ext == _T(".avi") || ext == _T(".asf") || ext == _T(".wmv")) &&
sender->IsPartAvailable(partCount - 1) && GetNextEmptyBlockInPart(partCount - 1, NULL) ) {
LastPartAsked = partCount - 1;
}
//Get All other chunks Left to Right
else {
for (uint16 i = 1; i < partCount; i++) if (sender->IsPartAvailable(i) && GetNextEmptyBlockInPart(i, NULL) ) {
LastPartAsked = i;
break;
}
}
//Build Requested Block List
uint16 requestedCount = *count;
uint16 newblockcount = 0;
do{
Requested_Block_Struct* block = new Requested_Block_Struct;
if (GetNextEmptyBlockInPart(LastPartAsked,block)) {
requestedblocks_list.AddTail(block);
newblocks[newblockcount] = block;
AddDebugLogLine( false, _T("BG-VideoPreview: Block: -%u- Start: -%u- End: -%u- Trans: -%u-"),(uint16)newblockcount,block->StartOffset,block->EndOffset,block->transferred);
newblockcount++;
}
else {
delete block;
break;
}
} while (newblockcount != requestedCount);
*count = newblockcount;
sender->m_lastPartAsked = LastPartAsked;
return true;
} //BG End GetNextRequestedBlock_BGVideoPreview
Adding an own Prefs Page
Effect:
Get your own space in the Prefs to place controls etc
Difficulty:
fairly easy
Files to modify:
PreferencesDlg.cpp
PreferencesDlg.h
OwnPrefs.cpp
OwnPrefs.h
Notes:
Look for the posted codeblock and add the new lines at the end. The changes are all tagged.
I gonna post 2 lines of official code before the changes.
[hr]
We start with PreferencesDlg.cpp:
[php]
CPreferencesDlg::CPreferencesDlg()
{
[...]
m_wndScheduler.m_psp.dwFlags &= ~PSH_HASHELP;
m_wndProxy.m_psp.dwFlags &= ~PSH_HASHELP;
// Own Prefs
m_wndOwnPrefs.m_psp.dwFlags &= ~PSH_HASHELP;
[...]
CTreePropSheet::SetPageIcon(&m_wndTweaks, _T("TWEAK"));
#if defined(_DEBUG) || defined(USE_DEBUG_DEVICE)
CTreePropSheet::SetPageIcon(&m_wndDebug, _T("Preferences"));
#endif
// Own Prefs
CTreePropSheet::SetPageIcon(&m_wndOwnPrefs, _T("TWEAK"));
[...]
AddPage(&m_wndWebServer);
AddPage(&m_wndTweaks);
// Own Prefs
AddPage(&m_wndOwnPrefs);
[/php]
Next function:
[php]
void CPreferencesDlg::Localize()
{
[...]
m_wndScheduler.Localize();
m_wndProxy.Localize();
// pp
m_wndOwnPrefs.Localize();
[...]
CTreeCtrl* pTree = GetPageTreeControl();
if (pTree)
{
[...]
pTree->SetItemText(GetPageTreeItem(12), RemoveAmbersand(GetResString(IDS_PW_WS)));
pTree->SetItemText(GetPageTreeItem(13), RemoveAmbersand(GetResString(IDS_PW_TWEAK)));
// Own Prefs
pTree->SetItemText(GetPageTreeItem(14), RemoveAmbersand(_T("Own Prefs")));
// change 14 -> 15 here
#if defined(_DEBUG) || defined(USE_DEBUG_DEVICE)
pTree->SetItemText(GetPageTreeItem(15), _T("Debug"));
#endif
}
[...]
[/php]
[hr]
Now for PreferencesDlg.h:
[php]
[...]
#include "otherfunctions.h"
#include "TreePropSheet.h"
// Own Prefs
#include "ppgOwnPrefs.h"
[...]
public:
CPreferencesDlg();
virtual ~CPreferencesDlg();
// Own Prefs
CPPgOwnPrefs m_wndOwnPrefs;
[...]
[/php]
That's it.
[hr]
The next steps are to be done in the IDE. First download this archive [60 kB] and extract the files into your srchybrid folder. It also contains all other files named above with all changes done. If you prefer you can simply merge the changes file to file. The files & tut have been tested and they compile w/o errors under VS.2k3.
Prefs are interface files, so the have to be added to the sections "interface source" (.cpp) and "interface header" (.h):
1. In your "Project Explorer" right-click on "Interface Source"
2. click "add" -> "Existing Element"
3. select "PPgOwnPrefs.cpp" & OK
4. Same for the .h file in "Interface Header"
Both files should appear at the end of the sections now.
Now create the empty dialog. Change to Rescource view and:
1. select "emule.rc" -> "Dialogs".
2. Right-click on "Dialog" and choose "Add" -> "Add Rescource" -> "New".
3. A new & empty dialog opens up. Delete the two buttons.
4. Size the dialog to 227x246 pixel (size is shown in the status bar).
5. Give it the ID "IDD_PPG_OWNPREFS" (Properties) and save.
Get your own space in the Prefs to place controls etc
Difficulty:
fairly easy
Files to modify:
PreferencesDlg.cpp
PreferencesDlg.h
OwnPrefs.cpp
OwnPrefs.h
Notes:
Look for the posted codeblock and add the new lines at the end. The changes are all tagged.
I gonna post 2 lines of official code before the changes.
[hr]
We start with PreferencesDlg.cpp:
[php]
CPreferencesDlg::CPreferencesDlg()
{
[...]
m_wndScheduler.m_psp.dwFlags &= ~PSH_HASHELP;
m_wndProxy.m_psp.dwFlags &= ~PSH_HASHELP;
// Own Prefs
m_wndOwnPrefs.m_psp.dwFlags &= ~PSH_HASHELP;
[...]
CTreePropSheet::SetPageIcon(&m_wndTweaks, _T("TWEAK"));
#if defined(_DEBUG) || defined(USE_DEBUG_DEVICE)
CTreePropSheet::SetPageIcon(&m_wndDebug, _T("Preferences"));
#endif
// Own Prefs
CTreePropSheet::SetPageIcon(&m_wndOwnPrefs, _T("TWEAK"));
[...]
AddPage(&m_wndWebServer);
AddPage(&m_wndTweaks);
// Own Prefs
AddPage(&m_wndOwnPrefs);
[/php]
Next function:
[php]
void CPreferencesDlg::Localize()
{
[...]
m_wndScheduler.Localize();
m_wndProxy.Localize();
// pp
m_wndOwnPrefs.Localize();
[...]
CTreeCtrl* pTree = GetPageTreeControl();
if (pTree)
{
[...]
pTree->SetItemText(GetPageTreeItem(12), RemoveAmbersand(GetResString(IDS_PW_WS)));
pTree->SetItemText(GetPageTreeItem(13), RemoveAmbersand(GetResString(IDS_PW_TWEAK)));
// Own Prefs
pTree->SetItemText(GetPageTreeItem(14), RemoveAmbersand(_T("Own Prefs")));
// change 14 -> 15 here
#if defined(_DEBUG) || defined(USE_DEBUG_DEVICE)
pTree->SetItemText(GetPageTreeItem(15), _T("Debug"));
#endif
}
[...]
[/php]
[hr]
Now for PreferencesDlg.h:
[php]
[...]
#include "otherfunctions.h"
#include "TreePropSheet.h"
// Own Prefs
#include "ppgOwnPrefs.h"
[...]
public:
CPreferencesDlg();
virtual ~CPreferencesDlg();
// Own Prefs
CPPgOwnPrefs m_wndOwnPrefs;
[...]
[/php]
That's it.
[hr]
The next steps are to be done in the IDE. First download this archive [60 kB] and extract the files into your srchybrid folder. It also contains all other files named above with all changes done. If you prefer you can simply merge the changes file to file. The files & tut have been tested and they compile w/o errors under VS.2k3.
Prefs are interface files, so the have to be added to the sections "interface source" (.cpp) and "interface header" (.h):
1. In your "Project Explorer" right-click on "Interface Source"
2. click "add" -> "Existing Element"
3. select "PPgOwnPrefs.cpp" & OK
4. Same for the .h file in "Interface Header"
Both files should appear at the end of the sections now.
Now create the empty dialog. Change to Rescource view and:
1. select "emule.rc" -> "Dialogs".
2. Right-click on "Dialog" and choose "Add" -> "Add Rescource" -> "New".
3. A new & empty dialog opens up. Delete the two buttons.
4. Size the dialog to 227x246 pixel (size is shown in the status bar).
5. Give it the ID "IDD_PPG_OWNPREFS" (Properties) and save.
Better Speed Display
Search in otherfunctions.cpp for:
if( isPerSec )
{
if (count < 1024.0)
buffer.Format(_T("%.0f %s"), count, GetResString(IDS_BYTESPERSEC));
else if (count < 1024000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1024.0, GetResString(IDS_KBYTESPERSEC));
else if (count < 1048576000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1048576.0, GetResString(IDS_MBYTESPERSEC));
else if (count < 1073741824000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1073741824.0, GetResString(IDS_GBYTESPERSEC));
else
buffer.Format(_T("%.*f %s"), decimal, count/1099511627776.0, GetResString(IDS_TBYTESPERSEC));
}
else
{
if (count < 1024.0)
buffer.Format(_T("%.0f %s"), count, GetResString(IDS_BYTES));
else if (count < 1024000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1024.0, GetResString(IDS_KBYTES));
else if (count < 1048576000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1048576.0, GetResString(IDS_MBYTES));
else if (count < 1073741824000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1073741824.0, GetResString(IDS_GBYTES));
else
buffer.Format(_T("%.*f %s"), decimal, count/1099511627776.0, GetResString(IDS_TBYTES));
}
and replace it with this:
if( isPerSec )
{
if(decimal==2/*99*/)
{
if (count < 1024000.0)
buffer.Format(_T("%.1f %s"), count/1024.0, GetResString(IDS_KBYTESPERSEC));
else if (count < 1048576000.0)
buffer.Format(_T("%.2f %s"), count/1048576.0, GetResString(IDS_MBYTESPERSEC));
else
buffer.Format(_T("%.3f %s"), count/1073741824.0, GetResString(IDS_GBYTESPERSEC));
}
else
{
if (count < 1024.0)
buffer.Format(_T("%.0f %s"), count, GetResString(IDS_BYTESPERSEC));
else if (count < 1024000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1024.0, GetResString(IDS_KBYTESPERSEC));
else if (count < 1048576000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1048576.0, GetResString(IDS_MBYTESPERSEC));
else if (count < 1073741824000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1073741824.0, GetResString(IDS_GBYTESPERSEC));
else
buffer.Format(_T("%.*f %s"), decimal, count/1099511627776.0, GetResString(IDS_TBYTESPERSEC));
}
}
else
{
if(decimal==99)
{
if (count < 1024)
buffer.Format(_T("%.0f %s"),count, GetResString(IDS_BYTES));
else if (count < 1048576)
buffer.Format(_T("%.0f %s"),count/1024.0f, GetResString(IDS_KBYTES));
else if (count < 1073741824)
buffer.Format(_T("%.2f %s"),count/1048576.0f, GetResString(IDS_MBYTES));
else if (count < 1099511627776)
buffer.Format(_T("%.2f %s"),count/1073741824.0f, GetResString(IDS_GBYTES));
else
buffer.Format(_T("%.3f %s"),count/1099511627776.0f, GetResString(IDS_TBYTES));
}
else
{
if (count < 1024.0)
buffer.Format(_T("%.0f %s"), count, GetResString(IDS_BYTES));
else if (count < 1024000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1024.0, GetResString(IDS_KBYTES));
else if (count < 1048576000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1048576.0, GetResString(IDS_MBYTES));
else if (count < 1073741824000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1073741824.0, GetResString(IDS_GBYTES));
else
buffer.Format(_T("%.*f %s"), decimal, count/1099511627776.0, GetResString(IDS_TBYTES));
}
}
if( isPerSec )
{
if (count < 1024.0)
buffer.Format(_T("%.0f %s"), count, GetResString(IDS_BYTESPERSEC));
else if (count < 1024000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1024.0, GetResString(IDS_KBYTESPERSEC));
else if (count < 1048576000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1048576.0, GetResString(IDS_MBYTESPERSEC));
else if (count < 1073741824000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1073741824.0, GetResString(IDS_GBYTESPERSEC));
else
buffer.Format(_T("%.*f %s"), decimal, count/1099511627776.0, GetResString(IDS_TBYTESPERSEC));
}
else
{
if (count < 1024.0)
buffer.Format(_T("%.0f %s"), count, GetResString(IDS_BYTES));
else if (count < 1024000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1024.0, GetResString(IDS_KBYTES));
else if (count < 1048576000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1048576.0, GetResString(IDS_MBYTES));
else if (count < 1073741824000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1073741824.0, GetResString(IDS_GBYTES));
else
buffer.Format(_T("%.*f %s"), decimal, count/1099511627776.0, GetResString(IDS_TBYTES));
}
and replace it with this:
if( isPerSec )
{
if(decimal==2/*99*/)
{
if (count < 1024000.0)
buffer.Format(_T("%.1f %s"), count/1024.0, GetResString(IDS_KBYTESPERSEC));
else if (count < 1048576000.0)
buffer.Format(_T("%.2f %s"), count/1048576.0, GetResString(IDS_MBYTESPERSEC));
else
buffer.Format(_T("%.3f %s"), count/1073741824.0, GetResString(IDS_GBYTESPERSEC));
}
else
{
if (count < 1024.0)
buffer.Format(_T("%.0f %s"), count, GetResString(IDS_BYTESPERSEC));
else if (count < 1024000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1024.0, GetResString(IDS_KBYTESPERSEC));
else if (count < 1048576000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1048576.0, GetResString(IDS_MBYTESPERSEC));
else if (count < 1073741824000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1073741824.0, GetResString(IDS_GBYTESPERSEC));
else
buffer.Format(_T("%.*f %s"), decimal, count/1099511627776.0, GetResString(IDS_TBYTESPERSEC));
}
}
else
{
if(decimal==99)
{
if (count < 1024)
buffer.Format(_T("%.0f %s"),count, GetResString(IDS_BYTES));
else if (count < 1048576)
buffer.Format(_T("%.0f %s"),count/1024.0f, GetResString(IDS_KBYTES));
else if (count < 1073741824)
buffer.Format(_T("%.2f %s"),count/1048576.0f, GetResString(IDS_MBYTES));
else if (count < 1099511627776)
buffer.Format(_T("%.2f %s"),count/1073741824.0f, GetResString(IDS_GBYTES));
else
buffer.Format(_T("%.3f %s"),count/1099511627776.0f, GetResString(IDS_TBYTES));
}
else
{
if (count < 1024.0)
buffer.Format(_T("%.0f %s"), count, GetResString(IDS_BYTES));
else if (count < 1024000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1024.0, GetResString(IDS_KBYTES));
else if (count < 1048576000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1048576.0, GetResString(IDS_MBYTES));
else if (count < 1073741824000.0)
buffer.Format(_T("%.*f %s"), decimal, count/1073741824.0, GetResString(IDS_GBYTES));
else
buffer.Format(_T("%.*f %s"), decimal, count/1099511627776.0, GetResString(IDS_TBYTES));
}
}
Queuesize Changing (100-10000)
PPgTweeks.cpp
serch after:
BOOL CPPgTweaks::OnInitDialog()
look after this code:
m_ctlQueueSize.SetRange(20, 100, TRUE);
change it:
m_ctlQueueSize.SetRange(1, 100, TRUE);
serch after:
BOOL CPPgTweaks::OnInitDialog()
look after this code:
m_ctlQueueSize.SetRange(20, 100, TRUE);
change it:
m_ctlQueueSize.SetRange(1, 100, TRUE);
Unlimited search results
SearchResultsWnd.cpp
Search after "LocalEd2kSearchEnd" and edit that part.
void CSearchResultsWnd::LocalEd2kSearchEnd(UINT /*count*/, bool bMoreResultsAvailable)
{
// local server has answered, kill the timeout timer
if (m_uTimerLocalServer) {
VERIFY( KillTimer(m_uTimerLocalServer) );
m_uTimerLocalServer = 0;
}
/*if (!canceld && count > MAX_RESULTS)
CancelEd2kSearch();*/
if (!canceld) {
if (!globsearch)
SearchCanceled(m_nEd2kSearchID);
else
VERIFY( (global_search_timer = SetTimer(TimerGlobalSearch, 750, 0)) != NULL );
}
m_pwndParams->m_ctlMore.EnableWindow(bMoreResultsAvailable && m_iSentMoreReq < MAX_MORE_SEARCH_REQ);
}
Search after "AddGlobalEd2kSearchResults" and edit it.
void CSearchResultsWnd::AddGlobalEd2kSearchResults(UINT /*count*/)
{
/*if (!canceld && count > MAX_RESULTS)
CancelEd2kSearch();*/
}
Search after "LocalEd2kSearchEnd" and edit that part.
void CSearchResultsWnd::LocalEd2kSearchEnd(UINT /*count*/, bool bMoreResultsAvailable)
{
// local server has answered, kill the timeout timer
if (m_uTimerLocalServer) {
VERIFY( KillTimer(m_uTimerLocalServer) );
m_uTimerLocalServer = 0;
}
/*if (!canceld && count > MAX_RESULTS)
CancelEd2kSearch();*/
if (!canceld) {
if (!globsearch)
SearchCanceled(m_nEd2kSearchID);
else
VERIFY( (global_search_timer = SetTimer(TimerGlobalSearch, 750, 0)) != NULL );
}
m_pwndParams->m_ctlMore.EnableWindow(bMoreResultsAvailable && m_iSentMoreReq < MAX_MORE_SEARCH_REQ);
}
Search after "AddGlobalEd2kSearchResults" and edit it.
void CSearchResultsWnd::AddGlobalEd2kSearchResults(UINT /*count*/)
{
/*if (!canceld && count > MAX_RESULTS)
CancelEd2kSearch();*/
}
No Ratio
references.cpp
search after:
uint64 CPreferences::GetMaxDownloadInBytesPerSec(bool dynamic)
look after this part:
if%u28 maxup < 4*1024 %u29
return %u28%u28%u28maxup < 10*1024%u29 && %u28%u28uint64%u29maxup*3 < maxdownload*1024%u29%u29 ? %u28uint64%u29maxup*3 %u3a maxdownload*1024%u29;
return %u28%u28%u28maxup < 10*1024%u29 && %u28%u28uint64%u29maxup*4 < maxdownload*1024%u29%u29 ? %u28uint64%u29maxup*4 %u3a maxdownload*1024%u29;
change it:
return %u28maxdownload*1024%u29;
PPgConnection.cpp
search after:
void CPPgConnection: nHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
look after this part and remove it:
if %u28pScrollBar->GetSafeHwnd%u28%u29 == m_ctlMaxUp.m_hWnd%u29
%u7b
uint32 maxup = m_ctlMaxUp.GetPos%u28%u29;
uint32 maxdown = m_ctlMaxDown.GetPos%u28%u29;
if%u28 maxup < 4 && maxup*3 < maxdown%u29
%u7b
m_ctlMaxDown.SetPos%u28maxup*3%u29;
%u7d
if%u28 maxup < 10 && maxup*4 < maxdown%u29
%u7b
m_ctlMaxDown.SetPos%u28maxup*4%u29;
%u7d
%u7d
else if %u28pScrollBar->GetSafeHwnd%u28%u29 == m_ctlMaxDown.m_hWnd%u29
%u7b
uint32 maxup = m_ctlMaxUp.GetPos%u28%u29;
uint32 maxdown = m_ctlMaxDown.GetPos%u28%u29;
if%u28 maxdown < 13 && maxup*3 < maxdown%u29
%u7b
m_ctlMaxUp.SetPos%u28%u28int%u29ceil%u28%u28double%u29maxdown/3%u29%u29;
%u7d
if%u28 maxdown < 41 && maxup*4 < maxdown%u29
%u7b
m_ctlMaxUp.SetPos%u28%u28int%u29ceil%u28%u28double%u29maxdown/4%u29%u29;
%u7d
%u7d
Wizard.cpp
search for:
thePrefs.maxGraphDownloadRate = download;
thePrefs.maxGraphUploadRate = upload;
if (upload > 0 && download > 0)
{
thePrefs.maxupload = (uint16)((upload * 4L) / 5);
if (upload < 4 && download > upload*3) {
thePrefs.maxdownload = thePrefs.maxupload * 3;
download = upload * 3;
}
if (upload < 10 && download > upload*4) {
thePrefs.maxdownload = thePrefs.maxupload * 4;
download = upload * 4;
}
else
thePrefs.maxdownload = (uint16)((download * 9L) / 10);
change it to:
thePrefs.maxGraphDownloadRate = download;
thePrefs.maxGraphUploadRate = upload;
if (upload > 0 && download > 0)
{
//umek::No Ratio
/*
thePrefs.maxupload = (uint16)((upload * 4L) / 5);
if (upload < 4 && download > upload*3) {
thePrefs.maxdownload = thePrefs.maxupload * 3;
download = upload * 3;
}
if (upload < 10 && download > upload*4) {
thePrefs.maxdownload = thePrefs.maxupload * 4;
download = upload * 4;
}
else
*/
//umek::No Ratio end
thePrefs.maxdownload = (uint16)((download * 9L) / 10);
search after:
uint64 CPreferences::GetMaxDownloadInBytesPerSec(bool dynamic)
look after this part:
if%u28 maxup < 4*1024 %u29
return %u28%u28%u28maxup < 10*1024%u29 && %u28%u28uint64%u29maxup*3 < maxdownload*1024%u29%u29 ? %u28uint64%u29maxup*3 %u3a maxdownload*1024%u29;
return %u28%u28%u28maxup < 10*1024%u29 && %u28%u28uint64%u29maxup*4 < maxdownload*1024%u29%u29 ? %u28uint64%u29maxup*4 %u3a maxdownload*1024%u29;
change it:
return %u28maxdownload*1024%u29;
PPgConnection.cpp
search after:
void CPPgConnection: nHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
look after this part and remove it:
if %u28pScrollBar->GetSafeHwnd%u28%u29 == m_ctlMaxUp.m_hWnd%u29
%u7b
uint32 maxup = m_ctlMaxUp.GetPos%u28%u29;
uint32 maxdown = m_ctlMaxDown.GetPos%u28%u29;
if%u28 maxup < 4 && maxup*3 < maxdown%u29
%u7b
m_ctlMaxDown.SetPos%u28maxup*3%u29;
%u7d
if%u28 maxup < 10 && maxup*4 < maxdown%u29
%u7b
m_ctlMaxDown.SetPos%u28maxup*4%u29;
%u7d
%u7d
else if %u28pScrollBar->GetSafeHwnd%u28%u29 == m_ctlMaxDown.m_hWnd%u29
%u7b
uint32 maxup = m_ctlMaxUp.GetPos%u28%u29;
uint32 maxdown = m_ctlMaxDown.GetPos%u28%u29;
if%u28 maxdown < 13 && maxup*3 < maxdown%u29
%u7b
m_ctlMaxUp.SetPos%u28%u28int%u29ceil%u28%u28double%u29maxdown/3%u29%u29;
%u7d
if%u28 maxdown < 41 && maxup*4 < maxdown%u29
%u7b
m_ctlMaxUp.SetPos%u28%u28int%u29ceil%u28%u28double%u29maxdown/4%u29%u29;
%u7d
%u7d
Wizard.cpp
search for:
thePrefs.maxGraphDownloadRate = download;
thePrefs.maxGraphUploadRate = upload;
if (upload > 0 && download > 0)
{
thePrefs.maxupload = (uint16)((upload * 4L) / 5);
if (upload < 4 && download > upload*3) {
thePrefs.maxdownload = thePrefs.maxupload * 3;
download = upload * 3;
}
if (upload < 10 && download > upload*4) {
thePrefs.maxdownload = thePrefs.maxupload * 4;
download = upload * 4;
}
else
thePrefs.maxdownload = (uint16)((download * 9L) / 10);
change it to:
thePrefs.maxGraphDownloadRate = download;
thePrefs.maxGraphUploadRate = upload;
if (upload > 0 && download > 0)
{
//umek::No Ratio
/*
thePrefs.maxupload = (uint16)((upload * 4L) / 5);
if (upload < 4 && download > upload*3) {
thePrefs.maxdownload = thePrefs.maxupload * 3;
download = upload * 3;
}
if (upload < 10 && download > upload*4) {
thePrefs.maxdownload = thePrefs.maxupload * 4;
download = upload * 4;
}
else
*/
//umek::No Ratio end
thePrefs.maxdownload = (uint16)((download * 9L) / 10);
Kick and Ban
Öffne UploadListCtrl.cpp und suche:
Füge drunter:
suche weiter:
füge drunter:
Speicher die Datei und öffne MenuCmds.h füge ganz unten einfach:
ClientMenu.AppendMenu(MF_STRING | (GetItemCount() > 0 ? MF_ENABLED : MF_GRAYED), MP_FIND, GetResString(IDS_FIND), _T("Search"));
Füge drunter:
ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient()) ? MF_ENABLED : MF_GRAYED), MP_KICKUSER, _T("Kick User"), _T("LISTREMOVE"));
ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient()) ? MF_ENABLED : MF_GRAYED), MP_BANUSER, _T("Ban User"), _T("CLEARCOMPLETE"));
suche weiter:
case MP_BOOT:
if (client->GetKadPort())
Kademlia::CKademlia::Bootstrap(ntohl(client->GetIP()), client->GetKadPort());
break;
füge drunter:
case MP_KICKUSER:
theApp.uploadqueue->RemoveFromUploadQueue(client);
break;
case MP_BANUSER:
theApp.uploadqueue->RemoveFromWaitingQueue(client);
client->Ban();
//theApp.uploadqueue->RemoveFromUploadQueue(client, _T("You were kicked."), true);
break;
Speicher die Datei und öffne MenuCmds.h füge ganz unten einfach:
#define MP_BANUSER 12650
#define MP_KICKUSER 12750
Clear Banlist Button
UploadListCtrl.cpp
add this code:
search after:
look after this code:
add under it:
search after:
look after this code:
add under it:
MenuCmds.h
add at the end of the defines:
ClientList.cpp
add this code at end of file:
ClientList.h
Search after:
add under it:
add this code:
#include "Clientlist.h"
search after:
void CUploadListCtrl::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
look after this code:
ClientMenu.AppendMenu(MF_STRING | (GetItemCount() > 0 ? MF_ENABLED : MF_GRAYED), MP_FIND, GetResString(IDS_FIND), _T("Search"));
add under it:
ClientMenu.AppendMenu(MF_STRING | (client ? MF_ENABLED : MF_GRAYED), MP_CLEARBANS, _T("Clear Banlist"),_T("STOP"));
search after:
BOOL CUploadListCtrl::OnCommand(WPARAM wParam, LPARAM /*lParam*/)
look after this code:
case MP_BOOT:
if (client->GetKadPort())
Kademlia::CKademlia::Bootstrap(ntohl(client->GetIP()), client->GetKadPort());
break;
add under it:
case MP_CLEARBANS:
theApp.clientlist->ClearBanList(); theApp.emuledlg->transferwnd->ShowQueueCount(theApp.uploadqueue->GetWaitingUserCount());
break;
MenuCmds.h
add at the end of the defines:
#define MP_CLEARBANS 15000
ClientList.cpp
add this code at end of file:
void CClientList::ClearBanList()
{
int i=0;
POSITION pos = m_bannedList.GetStartPosition();
uint32 nKey;
uint32 dwBantime;
while (pos != NULL)
{
m_bannedList.GetNextAssoc( pos, nKey, dwBantime );
RemoveBannedClient(nKey);
i++;
}
}
ClientList.h
Search after:
void DeleteAll();
add under it:
void ClearBanList();
Kick all LowID from Queue
UploadQueue.cpp
UploadQueue.h
QueueListCtrl.cpp
c
MenuCmds.h
CUpDownClient* CUploadQueue::KickAllLowID(){
POSITION pos = waitinglist.GetHeadPosition();
while(pos != NULL){
CUpDownClient* cur_client = waitinglist.GetNext(pos);
if(cur_client->HasLowID())
{
theApp.uploadqueue->RemoveFromWaitingQueue(cur_client);
}
}
return NULL;
}
UploadQueue.h
public:
CUpDownClient* CUploadQueue::KickAllLowID();
QueueListCtrl.cpp
c
ase MP_KICKLOWID:
{
AddModLogLine(LOG_ORANGE,_T("[Kick all] All LowID Clients from Queue removed..."));
theApp.uploadqueue->KickAllLowID();
theApp.emuledlg->transferwnd->ShowQueueCount(theApp.uploadqueue->GetWaitingUserCount());
break;
}
MenuCmds.h
#define MP_KICKLOWID 15031
Show progress of hashing files
in knownfile.cpp add to the includes
and search for
and add under it
search
and add under it
#include "MuleStatusBarCtrl.h"
and search for
if (theApp.emuledlg==NULL || !theApp.emuledlg->IsRunning()){ // in case of shutdown while still hashing
fclose(file);
delete[] newhash;
return false;
}
and add under it
if(theApp.emuledlg->statusbar->m_hWnd && GetPartCount() > 0){ //just to be sure
CString strPercent;
strPercent.Format(_T("Hashing :%d%% - %s"), (hashcount+1)*100/GetPartCount(), in_filename);
theApp.emuledlg->statusbar->SetText(strPercent, 0, 0);
}
search
// Add filetags
UpdateMetaDataTags();
and add under it
AddLogLine(true,_T("Hashing done: %s"), GetFilePath());
Dont's Share incoming (on-off)
emule.rc
search :
CONTROL "Use UPnP to setup portforwardings",IDC_PREF_UPNPONSTART,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,116,208,10
add under:
CONTROL "Don´t Share incoming",IDC_NEVERINC,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,141,85,78,10
Preferences.cpp-----------------------------------------------------------------
search :
bool CPreferences::m_bStoreSearches;
add under :
//b4
bool CPreferences::m_neverinc;
//b4
search :
ini.WriteInt(L"PCPort", m_nPeerCachePort);
add under :
ini.WriteBool(_T("neverinc"), m_neverinc);
search:
m_bPeerCacheShow = ini.GetBool(L"Show", false);
add under:
m_neverinc=ini.GetBool(_T("neverinc"),true);
Preferences.h------------------------------------------------------------
search:
static bool m_bStoreSearches;
add under:
//b4
static bool m_neverinc;
//b4
PPgConnection.cpp-------------------------------------------------------
search :
ON_BN_CLICKED(IDC_PREF_UPNPONSTART, OnSettingsChange)
add under:
//b4
ON_BN_CLICKED(IDC_NEVERINC, OnBnClickedneverinc)
//b4
search:
CPropertyPage::OnInitDialog();
add under:
//b4
if (thePrefs.m_neverinc)
CheckDlgButton(IDC_NEVERINC,1);
//b4
search:
if (bRestartApp)
AfxMessageBox(GetResString(IDS_NOPORTCHANGEPOSSIBLE));
OnEnChangePorts(2);
add under:
//b4
if(IsDlgButtonChecked(IDC_NEVERINC))
thePrefs.m_neverinc = true;
else
thePrefs.m_neverinc = false;
//b4
search:
// TODO: actually we could offer the user to remove existing rules
AfxMessageBox(GetResString(IDS_FO_PREF_EXISTED), MB_ICONINFORMATION | MB_OK);
}
else
AfxMessageBox(GetResString(IDS_FO_PREF_FAILED), MB_ICONSTOP | MB_OK);
}
add under:
//b4
void CPPgConnection::OnBnClickedneverinc()
{
SetModified();
}
//b4
PPgConnection.h---------------------------------------------------------
search:
void Localize(void);
void LoadSettings(void);
add under:
//b4
afx_msg void OnBnClickedneverinc();
//b4
resource.h--------------------------------------------------------------
search:
#define IDC_EDITCOMMENTFILTER 2995
#define IDC_WIZZARDOBFUSCATION 2996
add under:
#define IDC_NEVERINC 2997
SharedFileList.cpp-----------------------------------------------------
search:
// khaos::kmod+ Fix: Shared files loaded multiple times.
CStringList l_sAdded;
CString tempDir;
CString ltempDir;
tempDir = thePrefs.GetMuleDirectory(EMULE_INCOMINGDIR);
if (tempDir.Right(1)!=_T("\\"))
tempDir+=_T("\\");
add under:
//B4n$h33 no share incoming
if (thePrefs.m_neverinc == 0)
{
search:
if( l_sAdded.Find( ltempDir ) ==NULL ) {
l_sAdded.AddHead( ltempDir );
AddFilesFromDirectory(tempDir);
}
add under:
} //b4 end
search:
if( l_sAdded.Find( ltempDir ) ==NULL ) {
l_sAdded.AddHead( ltempDir );
AddFilesFromDirectory(tempDir);
}
}
// khaos::kmod-
add under:
//B4n$h33 no share incoming
if (thePrefs.m_neverinc == 0)
{
search:
AddLogLine(false,GetResString(IDS_SHAREDFOUNDHASHING), m_Files_map.GetCount(), waitingforhash_list.GetCount());
HashNextFile();
}
add under:
}
// B4n$h33 end
emule.h--------------------------------------------------------------
searc:
class CemuleApp : public CWinApp
{
public:
CemuleApp(LPCTSTR lpszAppName = NULL);
// ZZ:UploadSpeedSense -->
UploadBandwidthThrottler* uploadBandwidthThrottler;
LastCommonRouteFinder* lastCommonRouteFinder;
// ZZ:UploadSpeedSense <-- add under: //b4 static bool m_neverinc; //b4 PartFile.cpp--------------------------------------------------------- search: SetStatus(PS_COMPLETE); // (set status and) update status-modification related GUI elements theApp.knownfiles->SafeAddKFile(this);
add under:
//b4 dazzle - remove downloaded file from share if file is not in a shared directory
if (thePrefs.m_neverinc !=0)
{
bool keepshared = false;
for (POSITION pos = thePrefs.shareddir_list.GetHeadPosition();pos != 0 ; )
{
CString tempDir = thePrefs.shareddir_list.GetNext(pos);
CString fileDir = GetFilePath();
fileDir = fileDir.Left(fileDir.ReverseFind('\\'));
if (tempDir.Right(1)!=_T("\\"))
tempDir+=_T("\\");
if (fileDir.Right(1)!=_T("\\"))
fileDir+=_T("\\");
if (!fileDir.CompareNoCase(tempDir)) keepshared = true;
}
//remove file from share if..
if (!keepshared) theApp.sharedfiles->RemoveFile(this);
}
//end
search:
// Criterion 3. Request state (downloading in process from other source(s))
//const bool critRequested = IsAlreadyRequested(uStart, uEnd);
bool critRequested = false; // <--- This is set as a part of the second critCompletion loop below add under: //b4 - dazzle - if part files are shared (share level <=1) then, if the part file is not in the shared //file list yet, try to complete a chunk as soon as possible. once the file is shared, normal chunk selection is good enough bool critRequested; if (thePrefs.m_neverinc <=1 && !theApp.m_neverinc->IsFilePtrInList(this))
critRequested = false; // <--- This is set as a part of the second critCompletion loop below else critRequested = cur_chunk.frequency > veryRareBound && // => CPU load
IsAlreadyRequested(uStart, uEnd);
//end
For auto reload shared files just add this in partfile.cpp
theApp.sharedfiles->Reload(); // g_m : auto reload share files
after
// 05-Jän-2004 [bc]: ed2k and Kad are already full of totally wrong and/or not properly attached meta data. Take
// the chance to clean any available meta data tags and provide only tags which were determined by us.
UpdateMetaDataTags();
Simple partfile push
In uploadclient.cpp
at the end of
int CUpDownClient::GetFilePrioAsNumber()
at the end of
int CUpDownClient::GetFilePrioAsNumber()
if(currequpfile->IsPartFile() &&
thePrefs.GetUpData_File() > (thePrefs.GetUpData_Partfile()*2) &&
thePrefs.GetUpSessionClientData() > thePrefs.GetDownSessionClientData())
filepriority *= 3;
return filepriority;
Push clients to upload
In UploadQueue.cpp search this part
In QueueListCtrl.cpp search
still QueueListCtrl.cpp search
at the end of MenuCmds.h add
InsertInUploadingList(cur_client);and add
}
theApp.uploadBandwidthThrottler->Pause(false);
}
}
//Start Push
void CUploadQueue::AddUpload(CUpDownClient* client){
RemoveFromWaitingQueue(client, true);
theApp.emuledlg->transferwnd->ShowQueueCount(waitinglist.GetCount());
AddUpNextClient(_T("Push2Upload"),client);
}
// End Push
In UploadQueue.h search
bool IsDownloading(CUpDownClient* client) const {return (uploadinglist.Find(client) != 0);}and add
void AddUpload(CUpDownClient* client); // Push
In QueueListCtrl.cpp search
ClientMenu.AppendMenu(MF_STRING | ((client && client->IsEd2kClient() && !client->IsFriend()) ? MF_ENABLED : MF_GRAYED), MP_ADDFRIEND, GetResString(IDS_ADDFRIEND), _T("ADDFRIEND"));and add
//Start Push
ClientMenu.AppendMenu(MF_SEPARATOR);
ClientMenu.AppendMenu(MF_STRING | (client ? MF_ENABLED : MF_GRAYED), MP_ADDUPLOAD, _T("Push2Upload"), _T("WPUSH"));
//End Push
still QueueListCtrl.cpp search
case MP_BOOT:and add
if (client && client->GetKadPort())
Kademlia::CKademlia::bootstrap(ntohl(client->GetIP()), client->GetKadPort());
break;
//Start Push
case MP_ADDUPLOAD:{
theApp.uploadqueue->AddUpload(client);
break;
}
//End Push
at the end of MenuCmds.h add
#define MP_ADDUPLOAD 999999 // Push //Note: choose instead of 999999 the next free value
Connected Server in Blue/bold/greyout
erverListCtrl.cpp:
search:
add under this:
search:
COLORREF crOldTextColor = dc.SetTextColor(m_crWindowText);
add under this:
//Xman our server in blubold
//+
//grey out dead servers (BlueSonic/TK4)
LOGFONT lfFont = {0};
CFont fontCustom;
if(theApp.serverconnect->IsConnected()
&& (cur_srv = theApp.serverconnect->GetCurrentServer()) != NULL
&& cur_srv->GetPort() == server->GetPort()
//&& cur_srv->GetConnPort() == server->GetConnPort()//Morph - added by AndCycle, aux Ports, by lugdunummaster
&& _tcsicmp(cur_srv->GetAddress(), server->GetAddress()) == 0)
{
//it's our server
GetFont()->GetLogFont(&lfFont);
lfFont.lfWeight = FW_BOLD;
fontCustom.CreateFontIndirect(&lfFont);
dc.SelectObject(&fontCustom);
dc->SetTextColor(RGB(0,0,192));
}
else //TK4 Mod grey out Filtered servers or Dead servers
if(server->GetFailedCount() >= thePrefs.GetDeadServerRetries() || theApp.ipfilter->IsFiltered(server->GetIP()))
{
GetFont()->GetLogFont(&lfFont);
fontCustom.CreateFontIndirect(&lfFont);
dc.SelectObject(&fontCustom);
dc->SetTextColor(RGB(192,192,192));
} else if(server->GetFailedCount() >= 2)
{ //unreliable servers
GetFont()->GetLogFont(&lfFont);
fontCustom.CreateFontIndirect(&lfFont);
dc.SelectObject(&fontCustom);
dc->SetTextColor(RGB(128,128,128));
}
//Xman end
订阅:
博文 (Atom)