noobs 0.0.60 → 0.0.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/noobs.node CHANGED
Binary file
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const path = require('path');
2
2
 
3
3
  process.env.Path += ";";
4
- process.env.Path += path.resolve(__dirname, 'dist', 'bin');
4
+ process.env.Path += path.resolve(__dirname, 'dist', 'bin').replace('app.asar', 'app.asar.unpacked');
5
5
 
6
6
  const packageName = 'noobs.node';
7
7
  const noobs = require(`./dist/${packageName}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noobs",
3
- "version": "0.0.60",
3
+ "version": "0.0.63",
4
4
  "description": "A native Node.js addon with libobs bindings for Warcraft Recorder.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/src/main.cpp CHANGED
@@ -54,7 +54,7 @@ Napi::Value ObsSetRecordingDir(const Napi::CallbackInfo& info) {
54
54
  }
55
55
 
56
56
  std::string recordingPath = info[0].As<Napi::String>().Utf8Value();
57
- obs->updateRecordingDir(recordingPath);
57
+ obs->setRecordingDir(recordingPath);
58
58
  return info.Env().Undefined();
59
59
  }
60
60
 
@@ -238,8 +238,9 @@ void ObsInterface::create_output(const std::string& recordingPath, bool bufferin
238
238
  create_signal_handlers(output);
239
239
  }
240
240
 
241
- void ObsInterface::updateRecordingDir(const std::string& recordingPath) {
242
- blog(LOG_INFO, "Updating recording directory");
241
+ void ObsInterface::setRecordingDir(const std::string& recordingPath) {
242
+ blog(LOG_INFO, "Set recording directory");
243
+ // TODO make this work for file output also.
243
244
 
244
245
  if (!output) {
245
246
  blog(LOG_ERROR, "No output to update recording directory");
@@ -481,68 +482,60 @@ void ObsInterface::create_signal_handlers(obs_output_t *output) {
481
482
  }
482
483
 
483
484
  bool draw_box(obs_scene_t *scene, obs_sceneitem_t *item, void *p) {
484
- // Get the item position and size
485
- vec2 pos; vec2 scale;
485
+ // Get the item position and size
486
+ vec2 pos; vec2 scale;
487
+ obs_sceneitem_get_pos(item, &pos);
488
+ obs_sceneitem_get_scale(item, &scale);
486
489
 
487
- obs_sceneitem_get_pos(item, &pos);
488
- obs_sceneitem_get_scale(item, &scale);
490
+ // Calculate actual size with scaling
491
+ obs_source_t *src = obs_sceneitem_get_source(item);
492
+ float width = obs_source_get_width(src) * scale.x;
493
+ float height = obs_source_get_height(src) * scale.y;
489
494
 
490
- obs_source_t *src = obs_sceneitem_get_source(item);
491
- uint32_t sizex = obs_source_get_width(src);
492
- uint32_t sizey = obs_source_get_height(src);
495
+ // Draw rectangle around the source using the position and size
496
+ gs_effect_t *solid = obs_get_base_effect(OBS_EFFECT_SOLID);
497
+ gs_eparam_t *color = gs_effect_get_param_by_name(solid, "color");
498
+ gs_technique_t *tech = gs_effect_get_technique(solid, "Solid");
493
499
 
494
- // Calculate actual size with scaling
495
- float width = sizex * scale.x;
496
- float height = sizey * scale.y;
500
+ vec4 col = {0.733f, 0.267f, 0.125f, 1.0f}; // #BB4420
501
+ gs_effect_set_vec4(color, &col);
497
502
 
498
- // Draw rectangle around the source using the position and size
499
- gs_effect_t *solid = obs_get_base_effect(OBS_EFFECT_SOLID);
500
- gs_eparam_t *color = gs_effect_get_param_by_name(solid, "color");
501
- gs_technique_t *tech = gs_effect_get_technique(solid, "Solid");
503
+ gs_technique_begin(tech);
504
+ gs_technique_begin_pass(tech, 0);
502
505
 
503
- vec4 col = {0.733f, 0.267f, 0.125f, 1.0f}; // #BB4420
504
- gs_effect_set_vec4(color, &col);
506
+ gs_matrix_push();
507
+ gs_matrix_identity();
505
508
 
506
- gs_technique_begin(tech);
507
- gs_technique_begin_pass(tech, 0);
509
+ // Top border
510
+ gs_matrix_push();
511
+ gs_matrix_translate3f(pos.x, pos.y, 0.0f);
512
+ gs_draw_sprite(nullptr, 0, width, 2.0f);
513
+ gs_matrix_pop();
508
514
 
509
- gs_matrix_push();
510
- gs_matrix_identity();
515
+ // Bottom border
516
+ gs_matrix_push();
517
+ gs_matrix_translate3f(pos.x, pos.y + height - 2.0f, 0.0f);
518
+ gs_draw_sprite(nullptr, 0, width, 2.0f);
519
+ gs_matrix_pop();
511
520
 
512
- // Top border
513
- gs_matrix_push();
514
- gs_matrix_translate3f(pos.x, pos.y, 0.0f);
515
- //gs_matrix_scale3f(width, 1.0f, 1.0f);
516
- gs_draw_sprite(nullptr, 0, width, 1.0f);
517
- gs_matrix_pop();
521
+ // Left border
522
+ gs_matrix_push();
523
+ gs_matrix_translate3f(pos.x, pos.y, 0.0f);
524
+ gs_draw_sprite(nullptr, 0, 2.0f, height);
525
+ gs_matrix_pop();
518
526
 
519
- // Bottom border
520
- gs_matrix_push();
521
- gs_matrix_translate3f(pos.x, pos.y + height - 1.0f, 0.0f);
522
- // gs_matrix_scale3f(width, 1.0f, 1.0f);
523
- gs_draw_sprite(nullptr, 0, width, 1.0f);
524
- gs_matrix_pop();
527
+ // Right border
528
+ gs_matrix_push();
529
+ gs_matrix_translate3f(pos.x + width - 2.0f, pos.y, 0.0f);
530
+ gs_draw_sprite(nullptr, 0, 2.0f, height);
531
+ gs_matrix_pop();
525
532
 
526
- // Left border
527
- gs_matrix_push();
528
- gs_matrix_translate3f(pos.x, pos.y, 0.0f);
529
- // gs_matrix_scale3f(1.0f, height, 1.0f);
530
- gs_draw_sprite(nullptr, 0, 1.0f, height);
531
- gs_matrix_pop();
533
+ gs_matrix_pop();
532
534
 
533
- // Right border
534
- gs_matrix_push();
535
- gs_matrix_translate3f(pos.x + width - 1.0f, pos.y, 0.0f);
536
- // gs_matrix_scale3f(1.0f, height, 1.0f);
537
- gs_draw_sprite(nullptr, 0, 1.0f, height);
538
- gs_matrix_pop();
535
+ gs_technique_end_pass(tech);
536
+ gs_technique_end(tech);
539
537
 
540
- gs_matrix_pop();
541
-
542
- gs_technique_end_pass(tech);
543
- gs_technique_end(tech);
544
-
545
- return true;
538
+ return true;
546
539
  }
547
540
 
548
541
  void draw_callback(void* data, uint32_t cx, uint32_t cy) {
@@ -809,9 +802,8 @@ std::string ObsInterface::getLastRecording() {
809
802
 
810
803
  const char* type = obs_output_get_id(output);
811
804
 
812
-
813
-
814
805
  if (strcmp(type, "ffmpeg_muxer") == 0) {
806
+ blog(LOG_INFO, "Getting last recording path from ffmpeg_muxer");
815
807
  return recording_path;
816
808
  }
817
809
 
@@ -822,6 +814,8 @@ std::string ObsInterface::getLastRecording() {
822
814
  throw std::runtime_error("Unknown output type!");
823
815
  }
824
816
 
817
+ success = proc_handler_call(ph, "get_last_replay", &cd);
818
+
825
819
  if (!success) {
826
820
  blog(LOG_ERROR, "Failed to call procedure handler");
827
821
  const char *err = obs_output_get_last_error(output);
@@ -24,7 +24,7 @@ class ObsInterface {
24
24
  void startRecording(int offset); // Convert the active buffered recording to a real one.
25
25
  void stopRecording(); // Stop the recording.
26
26
  std::string getLastRecording(); // Get the last recorded file path.
27
- void updateRecordingDir(const std::string& recordingPath); // Output must not be active when calling this.
27
+ void setRecordingDir(const std::string& recordingPath); // Output must not be active when calling this.
28
28
 
29
29
  void createSource(std::string name, std::string type); // Create a new source
30
30
  void deleteSource(std::string name); // Release a source.