| 1123 | }; |
| 1124 | |
| 1125 | static void SendReloadThread(void* _ctx) |
| 1126 | { |
| 1127 | ReloadedContext* ctx = (ReloadedContext*)_ctx; |
| 1128 | |
| 1129 | uint32_t msg_size = sizeof(dmResourceDDF::Reload) + sizeof(uintptr_t) + (strlen("__testrecreate__.foo") + 1); |
| 1130 | dmResourceDDF::Reload* reload_resources = (dmResourceDDF::Reload*) malloc(msg_size); |
| 1131 | memset(reload_resources, 0x0, msg_size); |
| 1132 | reload_resources->m_Resources.m_Count = 1; |
| 1133 | uintptr_t str_ofs_offset = 2 * sizeof(uintptr_t); // |
| 1134 | uintptr_t str_offset = str_ofs_offset + reload_resources->m_Resources.m_Count * sizeof(uintptr_t);//0x18; |
| 1135 | memcpy((uint8_t*)reload_resources, &str_ofs_offset, sizeof(uintptr_t)); // offset to path string offsets |
| 1136 | memcpy((uint8_t*)reload_resources + str_ofs_offset, &str_offset, sizeof(uintptr_t)); // offset to start of resource path string |
| 1137 | memcpy((uint8_t*)(reload_resources) + str_offset, "__testrecreate__.foo", strlen("__testrecreate__.foo") + 1); // the actual resource path |
| 1138 | |
| 1139 | dmMessage::URL url; |
| 1140 | url.m_Fragment = 0; |
| 1141 | url.m_Path = 0; |
| 1142 | dmMessage::Result result; |
| 1143 | result = dmMessage::GetSocket("@resource", &url.m_Socket); |
| 1144 | assert(result == dmMessage::RESULT_OK); |
| 1145 | result = dmMessage::Post(0, &url, dmResourceDDF::Reload::m_DDFHash, 0, (uintptr_t) dmResourceDDF::Reload::m_DDFDescriptor, reload_resources, msg_size, 0); |
| 1146 | assert(result == dmMessage::RESULT_OK); |
| 1147 | |
| 1148 | if (ctx) |
| 1149 | { |
| 1150 | dmAtomicStore32(ctx->m_Reloaded, 1); |
| 1151 | } |
| 1152 | free(reload_resources); |
| 1153 | } |
| 1154 | |
| 1155 | static void ResourceReloadedHttpCallback(const dmResource::ResourceReloadedParams* params) |
| 1156 | { |