| 1062 | } |
| 1063 | |
| 1064 | bool AddNewGameFile(char *fullpath, char *directory) { |
| 1065 | char cur_name[100]; |
| 1066 | char pathname[100], name[100], extension[100]; |
| 1067 | int gamefile_handle; |
| 1068 | |
| 1069 | if (!Network_up) { |
| 1070 | return false; |
| 1071 | } |
| 1072 | |
| 1073 | // Okay, we selected a file. Lets do what needs to be done here. |
| 1074 | ddio_SplitPath(fullpath, pathname, name, extension); |
| 1075 | sprintf(cur_name, "%s%s", name, extension); |
| 1076 | |
| 1077 | if ((FindGamefileName(cur_name)) != -1) { |
| 1078 | OutrageMessageBox("There is already a file with that name. Rename the file and then try to add it."); |
| 1079 | return false; |
| 1080 | } |
| 1081 | |
| 1082 | gamefile_handle = AllocGamefile(); |
| 1083 | |
| 1084 | strcpy(Gamefiles[gamefile_handle].name, cur_name); |
| 1085 | strcpy(Gamefiles[gamefile_handle].dir_name, directory); |
| 1086 | |
| 1087 | // Finally, save a local copy of the model/anim and alloc a tracklock |
| 1088 | mprintf(0, "Making a copy of this file locally...\n"); |
| 1089 | |
| 1090 | char destname[100]; |
| 1091 | ddio_MakePath(destname, LocalD3Dir, "data", directory, Gamefiles[gamefile_handle].name, NULL); |
| 1092 | if (stricmp(destname, fullpath)) // only copy if they are different |
| 1093 | cf_CopyFile(destname, fullpath); |
| 1094 | |
| 1095 | mng_AllocTrackLock(cur_name, PAGETYPE_GAMEFILE); |
| 1096 | return true; |
| 1097 | } |
| 1098 | |
| 1099 | bool CheckInGamefile(char *tempbuffer, bool show_ok_confirmation) { |
| 1100 | mngs_Pagelock temp_pl; |
no test coverage detected