void rewritehdr(Fcall *f, uchar *pkt) { int i, n; n = GBIT32(pkt); PBIT16(pkt+5, f->tag); switch(f->type){ case Tversion: case Rversion: restring(pkt, n, f->version); break; case Tauth: PBIT32(pkt+7, f->afid); restring(pkt, n, f->uname); restring(pkt, n, f->aname); break; case Tflush: PBIT16(pkt+7, f->oldtag); break; case Tattach: restring(pkt, n, f->uname); restring(pkt, n, f->aname); PBIT32(pkt+7, f->fid); PBIT32(pkt+11, f->afid); break; case Twalk: PBIT32(pkt+7, f->fid); PBIT32(pkt+11, f->newfid); for(i=0; i<f->nwname; i++) restring(pkt, n, f->wname[i]); break; case Tcreate: restring(pkt, n, f->name); /* fall through */ case Topen: case Tclunk: case Tremove: case Tstat: case Twstat: case Twrite: PBIT32(pkt+7, f->fid); break; case Tread: PBIT32(pkt+7, f->fid); PBIT64(pkt+11, f->offset); break; case Rerror: restring(pkt, n, f->ename); break; } }
//------------------------------------------------------- // //------------------------------------------------------- BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: { Loaded = false; ConfigOn = false; // do a version check to make sure users dont have older versions of HGooey if (!HGVersionCheck(HGVersion)) return FALSE; // load and create stuff here (ie load extensions, create textures/images/objects/etc) // make sure the no one moved the extension if (GetFileAttributes("HGooey Files/XenDLL/Extensions/Eye_Map/HG_SDK.dll") == 0xFFFFFFFF) return FALSE; // make sure the menu item texture exists if (GetFileAttributes("HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.bmp") == 0xFFFFFFFF) return FALSE; // make sure the menu memory file exists if (GetFileAttributes("HGooey Files/XenDLL/Common/Memory.xml") == 0xFFFFFFFF) return FALSE; /// const char* Data; bool write = false; bool not_found = false; if (Data = ReadConfigItem("Location X", "HGooey Files/XenDLL/Common/Memory.xml")) { // check the location x memory address try { Location_X = (DWORD*)atoi(Data); } catch (...) { return FALSE; } } else { return FALSE; } if (Data = ReadConfigItem("Location Y", "HGooey Files/XenDLL/Common/Memory.xml")) { // check the location y memory address try { Location_Y = (DWORD*)atoi(Data); } catch (...) { return FALSE; } } else { return FALSE; } if (Data = ReadConfigItem("Screen", "HGooey Files/XenDLL/Common/Memory.xml")) { // check the screen memory address try { Screen = (DWORD*)atoi(Data); } catch (...) { return FALSE; } } else { return FALSE; } if (Data = ReadConfigItem("Chatmode", "HGooey Files/XenDLL/Common/Memory.xml")) { // check the chatmode memory address try { Chatmode = (DWORD*)atoi(Data); } catch (...) { return FALSE; } } else { return FALSE; } /// bZoomIN = false; bZoomOUT = false; Eye_Map = CreateExtension(); IDDTexture* texture = CreateIDDTextureFromFile("HGooey Files/Images/list.bmp", COLOR_RED); // set the menu item SetExtensionMenuItem( Eye_Map, CreateIDDTextureFromFile("HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.bmp", COLOR_RED)); /// if (Data = ReadConfigItem("Hide/Show Using DIK_[Key]", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml")) { if ((HIDESHOW_KEY = convertDIK_Name(Data)) == 0x00) not_found = true; } else { not_found = true; } if (not_found) { HIDESHOW_KEY = 0x00; WriteConfigItem("Hide/Show Using DIK_[Key]", "DIK_", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); } /// if (Data = ReadConfigItem("MenuItemIO", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml")) { if (strcmp(Data, "true") == 0) SetExtMenuIO(Eye_Map, true); else if (strcmp(Data, "false") == 0) SetExtMenuIO(Eye_Map, false); else { SetExtMenuIO(Eye_Map, false); write = true; } } else { write = true; } if (write) { WriteConfigItem("MenuItemIO", "false", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); write = false; } /// RECT rect; SetRect(&rect, DefaultList_left, DefaultList_top, DefaultList_right, DefaultList_bottom); Background = CreateImage( 1.0f, 1.0f, texture, &rect); if (!AttachObject(Eye_Map, Background)) { UnloadExtension(Eye_Map); Eye_Map = NULL; return FALSE; } /// ZoomIN = CreateButton(" + ", 1.0f); if (!AttachObject(Background, ZoomIN)) { UnloadExtension(Eye_Map); Eye_Map = NULL; return FALSE; } /// ZoomOUT = CreateButton(" - ", 1.0f); if (!AttachObject(Background, ZoomOUT)) { UnloadExtension(Eye_Map); Eye_Map = NULL; return FALSE; } /// ZoomRESET = CreateButton("reset", 1.0f); if (!AttachObject(Background, ZoomRESET)) { UnloadExtension(Eye_Map); Eye_Map = NULL; return FALSE; } /// MapButtonText[0] = "Main"; MapButtonText[1] = "2"; MapButtonText[2] = "3"; /// // set a default and then read the config file bool DisplayMoveAlways = false; if (Data = ReadConfigItem("DisplayMoveAlways", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml")) { if (_stricmp(Data, "true") == 0) DisplayMoveAlways = true; else if (_stricmp(Data, "false") != 0) write = true; } else { write = true; } if (write) { WriteConfigItem("DisplayMoveAlways", "false", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); write = false; } if (DisplayMoveAlways) Background->SetMoveable(MOVE_ALWAYS); else Background->SetMoveable(MOVE_LIMITED); float DisplaySizeOriginal = 128.0f; DisplaySize = DisplaySizeOriginal; if (Data = ReadConfigItem("DisplaySizeScale", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml")) { DisplaySize *= (float)atof(Data) / 100.0f; } else { char buffer[64]; sprintf_s(buffer, 64, "%f", 100.0f); WriteConfigItem("DisplaySizeScale", buffer, "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); } DisplayInitialScale = DisplaySizeOriginal / DisplaySize; /// if (Data = ReadConfigItem("MapButtonText[0]", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml")) { MapButtonText[0] = restring(Data, 0, strlen(Data)); } else { WriteConfigItem("MapButtonText[0]", MapButtonText[0], "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); } MapFile[0] = "xenmap0.bmp"; if (GetFileAttributes(MapFile[0]) == 0xFFFFFFFF) MapFile[0] = "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.bmp"; if (Data = ReadConfigItem("Map[0] Filename", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml")) { if (GetFileAttributes(Data) != 0xFFFFFFFF) MapFile[0] = restring(Data, 0, strlen(Data)); } else { WriteConfigItem("MapFile[0] Filename", MapFile[0], "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); } MapF2GX[0] = 6.2890625f; if (Data = ReadConfigItem("Map[0] File2Game X", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml")) { MapF2GX[0] = (float)atof(Data); } else { char buffer[64]; sprintf_s(buffer, 64, "%f", MapF2GX[0]); WriteConfigItem("Map[0] File2Game X", buffer, "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); } MapF2GY[0] = 6.2890625f; if (Data = ReadConfigItem("Map[0] File2Game Y", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml")) { MapF2GY[0] = (float)atof(Data); } else { char buffer[64]; sprintf_s(buffer, 64, "%f", MapF2GY[0]); WriteConfigItem("Map[0] File2Game Y", buffer, "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); } MapTexture[0] = CreateIDDTextureFromFile(MapFile[0], COLOR_DEFAULT); SetRect(&Zoom, 0, 0, (int)(DisplaySize * DisplayInitialScale), (int)(DisplaySize * DisplayInitialScale)); Map[0] = CreateImage( 1.0f, 1.0f, MapTexture[0], &Zoom); if (!AttachObject(Background, Map[0])) { UnloadExtension(Eye_Map); Eye_Map = NULL; return FALSE; } /// for (int i = 1; i < 3; i++) { char bufffffer[128]; sprintf_s(bufffffer, 128, "MapButtonText[%d]", i); if (Data = ReadConfigItem(bufffffer, "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml")) { MapButtonText[i] = restring(Data, 0, strlen(Data)); } else { WriteConfigItem(bufffffer, MapButtonText[i], "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); } MapFile[i] = "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.bmp"; sprintf_s(bufffffer, 128, "Map[%d] Filename", i); if (Data = ReadConfigItem(bufffffer, "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml")) { if (GetFileAttributes(Data) != 0xFFFFFFFF) MapFile[i] = restring(Data, 0, strlen(Data)); } else { WriteConfigItem(bufffffer, MapFile[i], "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); } MapF2GX[i] = 0.0f; sprintf_s(bufffffer, 128, "Map[%d] File2Game X", i); if (Data = ReadConfigItem(bufffffer, "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml")) { MapF2GX[i] = (float)atof(Data); } else { char buffer[64]; sprintf_s(buffer, 64, "%f", MapF2GX[i]); WriteConfigItem(bufffffer, buffer, "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); } MapF2GY[i] = 0.0f; sprintf_s(bufffffer, 128, "Map[%d] File2Game Y", i); if (Data = ReadConfigItem(bufffffer, "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml")) { MapF2GY[i] = (float)atof(Data); } else { char buffer[64]; sprintf_s(buffer, 64, "%f", MapF2GY[i]); WriteConfigItem(bufffffer, buffer, "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); } MapTexture[i] = CreateIDDTextureFromFile(MapFile[i], COLOR_DEFAULT); SetRect(&Zoom, 0, 0, (int)(DisplaySize * DisplayInitialScale), (int)(DisplaySize * DisplayInitialScale)); Map[i] = CreateImage( 1.0f, 1.0f, MapTexture[i], &Zoom); if (!AttachObject(Background, Map[i])) { UnloadExtension(Eye_Map); Eye_Map = NULL; return FALSE; } } /// for (int i = 0; i < 3; i++) { MapButton[i] = CreateButton(MapButtonText[i], 1.0f); if (!AttachObject(Background, MapButton[i])) { UnloadExtension(Eye_Map); Eye_Map = NULL; return FALSE; } MapButton[i]->SetStickyIO(true); } MapButton[0]->SetIO(true); /// Location = CreateImage( 1.0f, 1.0f, CreateIDDTextureFromFile("HGooey Files/XenDLL/Extensions/Eye_Map/location.bmp", COLOR_RED)); if (!AttachObject(Background, Location)) { UnloadExtension(Eye_Map); Eye_Map = NULL; return FALSE; } Location->SetAcceptAction(false); Location->SetCancelClick(false); /// float DisplayBorder = 7.5f * (DisplaySize / DisplaySizeOriginal); float MapButtonBorder = 2.5f * (DisplaySize / DisplaySizeOriginal); for (int i = 0; i < 3; i++) MapButton[i]->ReScale((DisplaySize / 3.0f) / MapButton[i]->GetWidth(), (DisplaySize / 3.0f) / MapButton[i]->GetWidth()); ZoomIN->ReScale((DisplaySize / 3.0f) / ZoomIN->GetWidth(), (DisplaySize / 3.0f) / ZoomIN->GetWidth()); ZoomOUT->ReScale((DisplaySize / 3.0f) / ZoomOUT->GetWidth(), (DisplaySize / 3.0f) / ZoomOUT->GetWidth()); ZoomRESET->ReScale((DisplaySize / 3.0f) / ZoomRESET->GetWidth(), (DisplaySize / 3.0f) / ZoomRESET->GetWidth()); // should all be the same, but... whatever... float largerHeight0 = MapButton[0]->GetHeight(); if (MapButton[1]->GetHeight() > largerHeight0) largerHeight0 = MapButton[1]->GetHeight(); if (MapButton[2]->GetHeight() > largerHeight0) largerHeight0 = MapButton[2]->GetHeight(); float largerHeight1 = ZoomIN->GetHeight(); if (ZoomOUT->GetHeight() > largerHeight1) largerHeight1 = ZoomOUT->GetHeight(); if (ZoomRESET->GetHeight() > largerHeight1) largerHeight1 = ZoomRESET->GetHeight(); float largerHeight2 = largerHeight0 + largerHeight1; Background->ReScale( (DisplaySize + (DisplayBorder*2.0f)) / (float)DefaultList_width, (DisplaySize + (DisplayBorder*2.0f) + MapButtonBorder + largerHeight2) / (float)DefaultList_height); DisplayX = 0.0f; if (Data = ReadConfigItem("DisplayX", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml")) { DisplayX = (float)atof(Data); if (DisplayX < 0.0f) { DisplayX = 0.0f; write = true; } else if ((DisplayX + Background->GetWidth()) * GuiScaleX() > ScreenWidth()) { DisplayX = (ScreenWidth() / GuiScaleX()) - Background->GetWidth(); write = true; } } else { write = true; } if (write) { char buffer[64]; sprintf_s(buffer, 64, "%f", DisplayX); WriteConfigItem("DisplayX", buffer, "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); write = false; } DisplayY = 0.0f; if (Data = ReadConfigItem("DisplayY", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml")) { DisplayY = (float)atof(Data); if (DisplayY < 0.0f) { DisplayY = 0.0f; write = true; } else if ((DisplayY + Background->GetHeight()) * GuiScaleY() > ScreenHeight()) { DisplayY = (ScreenHeight() / GuiScaleY()) - Background->GetHeight(); write = true; } } else { write = true; } if (write) { char buffer[64]; sprintf_s(buffer, 64, "%f", DisplayY); WriteConfigItem("DisplayY", buffer, "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); write = false; } Background->MoveBySize( DisplayX, DisplayY); MapButton[0]->MoveBySize( DisplayBorder, DisplayBorder); MapButton[1]->MoveBySize( DisplayBorder + (DisplaySize / 2.0f) - (MapButton[1]->GetWidth() / 2.0f), DisplayBorder); MapButton[2]->MoveBySize( DisplayBorder + DisplaySize - MapButton[2]->GetWidth(), DisplayBorder); ZoomIN->MoveBySize( DisplayBorder, DisplayBorder + largerHeight0); ZoomOUT->MoveBySize( DisplayBorder + (DisplaySize / 2.0f) - (ZoomOUT->GetWidth() / 2.0f), DisplayBorder + largerHeight0); ZoomRESET->MoveBySize( DisplayBorder + DisplaySize - ZoomRESET->GetWidth(), DisplayBorder + largerHeight0); for (int i = 0; i < 3; i++) { Map[i]->MoveBySize( DisplayBorder, DisplayBorder + MapButtonBorder + largerHeight2); } Location->MoveBySize( DisplayBorder, DisplayBorder + MapButtonBorder + largerHeight2); Loaded = true; } break; case DLL_PROCESS_DETACH: { if (!Loaded) return TRUE; Loaded = false; // unload and destroy stuff here (ie unload extensions) char buffer[64]; sprintf_s(buffer, 64, "%f", Background->GetX() / GuiScaleX()); WriteConfigItem("DisplayX", buffer, "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); sprintf_s(buffer, 64, "%f", Background->GetY() / GuiScaleY()); WriteConfigItem("DisplayY", buffer, "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); if (CheckExtMenuIO(Eye_Map)) WriteConfigItem("MenuItemIO", "true", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); else WriteConfigItem("MenuItemIO", "false", "HGooey Files/XenDLL/Extensions/Eye_Map/Eye_Map.xml"); UnloadExtension(Eye_Map); Eye_Map = NULL; } break; } return TRUE; }